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

Member, Moderator, Employee Posts: 873
100 Answers 500 Comments 250 Likes Second 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

  • Member, Moderator, Employee Posts: 873
    100 Answers 500 Comments 250 Likes Second Anniversary
    ✭✭✭✭
    Answer ✓

    Yes, this is possible:

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

    OutputParameter_1 = snippet.OutputParameters[0].Value

Welcome!

It looks like you're new here. Sign in or register to get started.