How can I set a Design Point as current from Mechanical?
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()
Answers
-
@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.
2 -
@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?
2 -
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 PageSetBaseDesignPoint
seem to work perfectly.4 -
@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.
2 -
@Kerstin Thanks for the input. This will be very useful!
2