Ansys Free Student Software

Ansys Free Student Software

Accessing Development of ANSYS workbench and Mechanical

    • senior2020design
      Subscriber

      Hello Ansys users,


      I was reading up on the development of the Mechanical GUI of Ansys through this article post: https://www.simutechgroup.com/tips-and-tricks/fea-articles/95-fea-tips-tricks-macros 


      They mention that the Mechanical GUI is developed with Jscript from HTML and XML. The version they describe is 13.0 but I am assuming that the development of the GUI could still be the same as before. I am currently running the 19 R1 version of Ansys.


      I have been attempting to manipulate certain graphic settings in Ansys Mechanical to best suite my needs, and to do so I would have to manipulate the GUI development. For example, if I wanted  the background of the Ansys Mechanical window to be green, I am assuming I need to change things in the development code of creating Mechanical in Ansys. 


      I have followed the path to the Mechanical development given through the article, but not entirely sure which files in the many folders can be manipulated.


      Or point me in the direction where I can get more help with this? There is not much documentation about this with Ansys.


       


      Thank you very much,


      D

    • Aniket
      Ansys Employee

      JScript was not documented and supported back then and is not still now. You can use ACT to do this in 2019R1. 


      For more information regarding ACT developer resources please check:


      https://catalog.ansys.com/Developers.cshtml


      and


      https://ansyshelp.ansys.com/account/secured?returnurl=/Views/Secured/corp/prod_page.html?pn=Customization%20Suite&prodver=19.3&lang=en


      Coming to your question, using ACT, I am listing existing examples, which are not exactly the same what you want, but with some search, you should be able to find it. Basically you need to find 


      How do I get/set workbench preferences found in "Tools > Options" using ACT?


      Answer:


      These ACT commands exist in the project-level ACT
      GetPreferenceValue("Name")
      SetPreferenceValue("Name", Value)

      Example:
      (under "Mechanical > Auto Detect Contact on Attach"):
      SetPreference('Mechanical_ContactAutoDetectionOnAttach', 'False')

      Some of the names can be found in "ANSYS Incv{version}commonfilesregistrywinx64" folder.
      Many settings are in MainPreferences.XML, but other XML files in that folder contain settings for other categories.

      Example, the "Tools > Options" setting under "Extensions" called "Save Binary Extensions with Project" can be set to "Copied but locked to the project" with the following command:
      SetPreferenceValue("ACT_CopyExtensionOption", ["CopiedLocked"])

      This setting name was found in the ACTPreferences.XML. Look for " " under them. Use the GetPreferenceValue("Name") and change selections in the GUI to see available values.

      Mouse controls are found in MainPreferences.XML
      For example, the name "GraphicsCtrlLeftButton" is for the entry "Ctrl+left Button" in the "Tools > Options > Graphics Interaction." 


      How to get/set workbench preferences found in tools>options using ACT, so that they are persistent for the next workbench session?


      Answer:


      For making these changes persistent use:

      Ansys.Core.Preference.Commands.SavePreferencesCommand.InvokeAndWait("")

      This will save XML files to %AppData%Ansysv{version}UserRegFiles_{number}


      -Aniket


      Guidelines on the Student Community


      How to access ANSYS help links

    • senior2020design
      Subscriber

      Thank you, that definitely helped me find the files I needed to find. Could you tell me where GetPreference and SetPreference is in the project-level ACT https://storage.ansys.com/act/v191/ACTReferenceHTML/Project/index.html#frame-index.html ...?


      It is taking me very long to find it and I have not found it yet.


      The reason I am asking about graphic preference is because, I have created an extension button in Mechanical using ANSYS ACT (xml and ironpython file). The button when clicked captures the model viewer window and saves the image. So I can just use the same .py file and create a function that uses GetPreference and SetPreference to change the background.


       


      Thank you

Viewing 2 reply threads
  • You must be logged in to reply to this topic.