General Mechanical

General Mechanical

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

Difference between 23R2 and 24R2 in Mechanical Scripting Behaviour

    • antoine.crestani.ext
      Subscriber

      Hello everyone,
      I work with Mechanical and workbench Scripting a lot .
      Specifically, I run calculations in Mechanical using gitlab runner to planify the execution of my tests.

      My scripts all follow the same structure , that i will simplify here.
      A first Bash Script calls a Main Journal using the following flags :
      #################
      "%AWP_ROOT242%\Framework\bin\Win64\RunWB2.exe" -B -R "%CI_PROJECT_DIR%\MainJournal.wbjn"
      #################

      MainJournal.wbjn :
      #################
      # Setup Environment variables
      ...
      # setup files
      ...
      # Run script
      RunScript(FilePath=Another_journal.wbjn)
      #################

       


      Another_journal.wbjn does operations that are specific to every calculation i run.

      Another_journal.wbjn : 
      #################
      # More setup
      ...
      # load model
      Unarchive(ArchivePath="Model.wbpz", ProjectPath="Model_name.wbpj")
      system1 = GetSystem(Name="SYS")
      container1 = system1.GetContainer(ComponentName="Setup")
      container1.Edit()
      Simulation.RunScript(FilePath="Macro_file.py", IsMeshing=False, ModelName="Model")
      #################

      In 23 R2, this worked flawlessly. 

      However, when we updated from Ansys 23R2 to Ansys 24R2, all my scripts stopped working. 
      I have narrowed the failure to the container1.Edit() line. my scripts would just stop there, and do nothing.
      Through trial and error, i realized that i could simply remove that .edit() line and most of my scripts would still work.
      Not all though. For example , i cannot use legend.Reset() specifically, as well as some other things like OnClick callbacks linked to Mechanical Interface buttons do not work .
      I understand that this is a very limited use case, but could anyone point me to what changed between versions 23 and 24 with the container.edit() function ?
      Additionnally, what could i do to re-add the .Edit() line ?
      Any help would be greatly appreciated


      PS:  If someone could tell me how to format a block of text as code i would appreciate it too !

    • Aniket
      Forum Moderator

      Hi antoine,

      ANSYS ACT Migration Notes does not indicate this API change, have you tried recording the same function in both versions? Is it any different? 

      -Aniket

      Forum Rules & Guidelines

Viewing 1 reply thread
  • You must be logged in to reply to this topic.