General Mechanical

General Mechanical

Topics relate to Mechanical Enterprise, Motion, Additive Print and more

Active mechanical system name in ACT scrippting

    • m.vp2209


      I am writting a code which saves my temperature solutions directly as a text file after the solution is calculated. For the name of the .txt file I would like to also include the name of my system. In my project I have many systems and I want to just get the name (Display Text) of the system that is currently in use, without having to know its index in the project. 

      My current code to get the Display name of the project and which runs in Mechanical looks like: 

      import wbjn
      system1 = GetAllSystems()[1]
      my_name = system1.DisplayText
      then I use the system_name to create a filepath where the txt file of the solution should be stored. 

      Unfortunately, this is not what I want because I would have to know the GetAllSystems index of every system and change it manually. 
      I have also though about using GetSystem(Name="Static1"), but I run into the same problem that I would have to know the name of the system to start with, rather than retrieving it from WB. 

      Do you have any better approaches? 

    • Aniket
      Forum Moderator

      If you are using a workbench-level script and SendCommand API to Mechanical as mentioned on the other thread, you can take this DisplayText directly to Mechanical, to export the files. Will that work?


      How to access Ansys help links

      Guidelines for Posting on Ansys Learning Forum

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