-
-
November 11, 2019 at 7:16 pm
senior2020design
SubscriberHello 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
-
November 14, 2019 at 2:59 pm
Aniket
Ansys EmployeeJScript 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
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
-
December 1, 2019 at 12:32 am
senior2020design
SubscriberThank 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
-
- You must be logged in to reply to this topic.

Boost Ansys Fluent Simulations with AWS
Computational Fluid Dynamics (CFD) helps engineers design products in which the flow of fluid components is a significant challenge. These different use cases often require large complex models to solve on a traditional workstation. Click here to join this event to learn how to leverage Ansys Fluids on the cloud, thanks to Ansys Gateway powered by AWS.

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- Limitations to Student License?
- Not seeing any items in the ANSYS Workbench toolbox?
- Missing Analysis Systems from toolbox
- “An error occurred while starting the solver module.” – Maybe licence problem?
- FLUENT application Failed to start
- Please recommend the configuration of the computer workstation
- No license available at this time
- ANSYS License Manager Error
- I am using MacBook Pro with M1chip, how can I install or any other ways to use Ansys ?
- Your product license has numerical problem size limits…..
-
5290
-
3311
-
2471
-
1308
-
1016
© 2023 Copyright ANSYS, Inc. All rights reserved.