Working with Command Snippets

The API CommandSnippet provides for defining a MAPDL script that you want to invoke during the preprocessing, solution solving, or postprocessing phase of your analysis. Use the function AddCommandSnippet() to insert a new child command snippet into the project tree:

sol = ExtAPI.DataModel.Project.Model.Analyses[0].Solution 
cs = sol.AddCommandSnippet()
cs.Input = "/COM, New input"
cs.AppendText("\n/POST1")

You can also use ImportTextFile(string) to import content from a text file or use ExportTextFile(string) to export a command snippet to a text file.


Release 18.2 - © ANSYS, Inc. All rights reserved.