Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.
General Mechanical

General Mechanical

Topics related to Mechanical Enterprise, Motion, Additive Print and more.

Is it possible to run ACT Mechanical Scripting in batch mode?

    • Azarias
      Subscriber

      Hello,

      I have not found a way to run my ACT Mechanical script file in batch mode. Is there any possibility?

      I have found in my research that there is a possibility to run Workbench in batch mode. And you can pass a Workbench Journal there.

    • ErKo
      Ansys Employee
    • ErKo
      Ansys Employee

      Below is a small example that we can run in batch from the command prompt and that creates first a static system in workbench, adds a Geometry (obviously you need to add your own geometry file as you can not use the one define here Bracket is just for this example ), and then it adds an ACT API call to add a comment (see cmd'' AddComment()"" and the model.SendCommand in the wbjn below). Be aware though that not all API calls might come through (this is a limitation). Also if you want to read the command in from a file, so instead of typing them in as below in the wbjn example, then see the above post and the link where this is done (read in api calls from file, using the open and read methods). Finally it saves the wbpj.
      wbjn journal sample file:
      --

      SetScriptVersion(Version="19.4.112")
      template1 = GetTemplate(TemplateName="Static Structural",Solver="ANSYS")
      system1 = template1.CreateSystem geometry1 = system1.GetContainer(ComponentName ="Geometry")
      geometry1.SetFile(FilePath ="C:\Bracket.agdb")

      cmd='''
      ExtAPI.DataModel.Project.Model.AddComment '''

      modelComponent1 = system1.GetComponent(Name="Model")
      modelComponent1.Refresh
      model = system1.GetContainer(ComponentName="Model")
      model.Edit(Interactive=False)
      model.SendCommand(Language="Python", Command=cmd)
      Save(FilePath="C:/testcomment.wbpj",Overwrite=True)


      --


      Below is what you need to copy paste into the command prompt (this is for version v212 so you might need to change that part accordingly depending on your version and installation location) - also you (command prompt) need to be in the same directory as the wbjn file:

      "C:\\Program Files\\ANSYS Inc\\v212\\Framework\\bin\\Win64\\runwb2" -B -R "testcomment.wbjn"

      Hope this helps -

      Erik
    • Azarias
      Subscriber
      Thank you both for your help. Unfortunately, due to the limitations of the commands in batch mode for my script, it does not seem to be possible to run this using it.
Viewing 3 reply threads
  • The topic ‘Is it possible to run ACT Mechanical Scripting in batch mode?’ is closed to new replies.
[bingo_chatbox]