TAGGED: act, mechanical
-
-
August 2, 2023 at 7:50 am
-
August 4, 2023 at 11:27 pm
-
August 4, 2023 at 11:31 pmmjmiddleAnsys Employee
Also, the default usually has a quantity:
default="0.0 [m]"
-
August 7, 2023 at 9:15 amAzmin ZamsaniraniSubscriber
Thank you, It is currently functioning; however, the coordinates' initial values after evaluation will consistently be in inches ("in"). The problem arises when opening ANSYS Mechanical with the unit system set to another unit. For example, if your current unit is set to "meters," and you evaluate a coordinate that is originally in inches (e.g., 0.2 inches), the software might display it as "0.2 m," which is meters. The only way to make it work as it should currently is to set the units in inches before evaluating the result.
-
-
August 14, 2023 at 11:11 pmmjmiddleAnsys Employee
-
August 15, 2023 at 10:25 ammjmiddleAnsys Employee
When your python code sets the value, you have to get the current unit and convert:
import units
#toUnit = ExtAPI.DataModel.CurrentUnitFromQuantityName(“Length”)
toUnit = result.Properties[“MyProperty”].GetCurrentUnit() # assuming unit=”Length” in property in XML
fromUnit = ‘m'
result.Properties[“MyProperty”].Value = units.ConvertUnit(2.54, fromUnit, toUnit)-
August 17, 2023 at 7:41 amAzmin ZamsaniraniSubscriber
Thank you so much. It is now working after some modification I did but may I know where does units library and GetCurrentUnit() come from? Because I cant find both of it from global python documentation nor the ANSYS API and XML reference.
-
-
August 18, 2023 at 1:32 ammjmiddleAnsys Employee
The units module is in the Ansys installation at:
ANSYS Inc\v{version}\Addins\ACT\libraries\Mechanical\units.py
It is dicussed in the Ansys online documentation (https://ansyshelp.ansys.com/):
"Customization Suite > ACT Developer's Guide > Extensions > Libraries and Advanced Programming > Function Libraries"
Example at:
"Mechanical Application > Scripting in Mechanical Guide > Scripting Examples > Script Examples for Interacting with Tree Objects > Transform Coordinate Systems (with Math)"You can use the basic python command dir() with an object inside the parentheses to see the objects underneath it. So with some exploration you could find the GetCurrentUnit() under the property.
-
- The topic ‘ACT Mechanical Coordinates Units’ is closed to new replies.
- RSS is disabled.
- ANSYS Mechanical won’t open and stays on Blank Gray Screen (Path environment va)
- ansys fluent error when opening it “unexpected license problem”
- Elastic Licensing DNS gateway changes
- Ansys 2024 R1 – The installation completed with warnings/errors.
- Poor quality mesh at trailing edge for 3d wing
- Not find helic___[]_.tgz file
- LS-Dyna Beam elements outputs
- Fluent
-
421
-
192
-
178
-
162
-
140
© 2024 Copyright ANSYS, Inc. All rights reserved.