Ansys workbench commands (APDL) step number
Hello,
How one set the same commands (APDL) for several steps?
Here is the image for more clarification.
Thank you.
Answers
-
@AKD-Scripting-Team - someone must have some thoughts here?
0 -
@fab88 - Also the reason you have probably not gotten any replies here is that you posted your question in the announcements area which is for news and updates about the forum. None of the developers will look there for questions so it is easy for them to be overlooked.
Sorry this sat so long, but I have moved it to the correct forum.
0 -
Hello, you might need to create several command snippets with the same input.
You can do it with something like this:
analysis = ExtAPI.DataModel.Project.Model.Analyses[0] stepNumbers = [1,2,5] for stepNumber in stepNumbers: cs = analysis.AddCommandSnippet() cs.AppendText("!My APDL code here \n") cs.StepSelectionMode=SequenceSelectionType.ByNumber cs.StepNumber = stepNumber
Best Regards
0 -
@fab88 You can't do this directly. Step Number will only take a single value input.
APDL solution:
What you will need to do is set the Step Selection Mode to All and then in the APDL commands put in a loop and boolean/logic to only run the commands based on your requirements/step.0 -
Hi @fab88 ,
I would suggest using "Python Code" object (RMB on Analysis --> Insert --> Python Code) with default "Target Callback" which is "Get Solve Commands"
Here you can add APDL commands the same way you do for Command objects, but the only difference is you enclose each command in the way as shown below.
solver_input_file.WriteLine("!Your command")
The advantage with this method is, this python code object has easy access to current step number.
Example code
stepNumbers = [1,3] if solver_data.CurrentStep in stepNumbers: solver_input_file.WriteLine("/com,Step number is " + str(solver_data.CurrentStep))
0