mjmiddle
Ansys Employee

 

If the ACT object is run as part of the solution being generated, such as a load object under the analysis branch, then the Outline object structure is fixed. It is not allowed to change it at that stage because as the APDL input file is written (generally in the order of Outline objects seen from top-to-bottom) certain Outline objects depend on others such as loads/supports written in certain coordinate systems defined higher. Changing some Outline objects at solution time could invalidate other Outline objects.

With control=”scoping” in the XML, why not just have the user selection a named selection instead of geometry selection? Vertex, edge, face selections create nodal components in APDL while body and element selections cause element components in APDL. So instead of converting to an element named selection, you could enforce body/element selections when “geometry” type is selected for control=”scoping”:

Or document your extension that the user needs to select named selection from the dropdown and select a body or element named selection.

Or use control=”select” to make a manual dropdown and populate the list with only those named selections for which your code has checked are body or element named selections.

Or instead of a "load" use an "object" as a load:

And use an "ongenerate" callback. This will cause the load to have a yellow lightning bolt until the user right clicks to “Generate” from a popup menu. This may still be a problem since the ongenerate is done automatically when the solution is initiated if the user had not right clicked to generate it first. The Outline is locked during solution as decribed above, so it may cause an error at that time.

So another suggestion would be to use an "action" callback under an "object":

This also creates a selection in a right click popup menu. This function could create the named selections and set a global variable used by an "isvalid" callback you would define to check that variable value for whether your Outline object is in a valid state.

If your load sends APDL commands, such as with a "getsolvecommands" callback or

,then another idea would be to handle the conversion to attached elements in APDL from a nodal component or nodal selection. Use NSEL to select the node IDs from the user selection, then ESLN to select attached elements. You can then just use that selection or use CM to create an element component from that.