How can I set a Design Point as current from Mechanical?

Ayush Kumar
Ayush Kumar Member, Moderator, Employee Posts: 444
250 Likes Solution Developer Community of Practice Member Ansys Employee First Anniversary
✭✭✭✭
edited June 2023 in Structures

I tried the following (they look promising but don't even work on the Project Page)

design_point_2 = Parameters.GetDesignPoint(Name="1")
Parameters.SetCurrentDesignPoint(DesignPoint=design_point_2)
Parameters.SetActiveDesignPoint(DesignPoint=design_point_2)

What seems to work on the Project page but when tried with Mechanical the project freezes, I am not sure if this is the correct command:

def make_current_dp():
    import wbjn
    wbjn.ExecuteCommand(ExtAPI, 'Parameters.SetBaseDesignPoint(DesignPoint=Parameters.GetDesignPoint(Name="1"))')

thread=System.Threading.Thread(System.Threading.ThreadStart(make_current_dp))
thread.Start()
Tagged:

Answers

  • Rajesh Meena
    Rajesh Meena Moderator, Employee Posts: 85
    Photogenic 5 Likes Name Dropper Ansys Employee
    ✭✭✭✭

    @Ayush Kumar do not use wbjn. Rather use ExtAPI.Application.ScriptByName('journaling').ExecuteCommand(cmd, args, res).Also keep track of the thread. Proceed to next step only when the thread ends.

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 444
    250 Likes Solution Developer Community of Practice Member Ansys Employee First Anniversary
    ✭✭✭✭

    @Rajesh Kumar Meena Thanks! Have you tested it? We tried this command too. But in general I guess you can't change DPs from within Mechanical, because if you try to do it even manually, WB prompts you to close the opened Mechanical session?

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 444
    250 Likes Solution Developer Community of Practice Member Ansys Employee First Anniversary
    ✭✭✭✭
    Answer ✓

    After some discussion, it seems like it is not meant to be changed from within Mechanical. Because, even if one tries to change the DPs from WB manually, it prompts you to close Mechanical before switching the DP.

    From WB Project Page SetBaseDesignPoint seem to work perfectly.

  • Kerstin
    Kerstin Member, Employee Posts: 7
    5 Up Votes 5 Likes Photogenic Ansys Employee
    ✭✭✭

    @Ayush Kumar If you are using it within an ACT extension and the ACT ext is called from the project level for each DP, you can try to use the (Mechanical) callback. For example, I am using that callback to enable beta options in an pure Mechanical ACT, in the oninit callback it works fine, but cannot be called direct from Mechanical (due to the GUI changes).As I understood, you always want to change to the current DP, so I assume the ACT and therefore the 'oninit' function will be called each time.

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 444
    250 Likes Solution Developer Community of Practice Member Ansys Employee First Anniversary
    ✭✭✭✭

    @Kerstin Thanks for the input. This will be very useful!