Can I access the arguments in a command snippet through ACT scripting?

Pernelle Marone-Hitz
Pernelle Marone-Hitz Member, Moderator, Employee Posts: 871
100 Answers 500 Comments 250 Likes First Anniversary
✭✭✭✭
edited June 2023 in Structures

Is it possible to access the details view, and especially read/edit the “ARG1”, “ARG2”, etc. values of a command snippet in Mechanical?

Tagged:

Answers

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 871
    100 Answers 500 Comments 250 Likes First Anniversary
    ✭✭✭✭
    Answer ✓

    Yes, this is possible:

    analysis = ExtAPI.DataModel.Project.Model.Analyses[0] # reference analysis
    snippet = analysis.GetChildren(DataModelObjectCategory.CommandSnippet,True)[0] # get first command snippet object in the analysis
    print(snippet.InputArgument1) # print the value of “ARG1”
    snippet.InputArgument1="342" # change the value of “ARG1”
    
  • M
    M Member, Employee Posts: 241
    50 Answers 100 Comments 100 Likes Second Anniversary
    ✭✭✭✭
    Answer ✓

    OutputParameter_1 = snippet.OutputParameters[0].Value