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.
- Workbench license error
- Unexpected error on Workbench: Root element not found.
- Unable to recover corrupted project in Workbench
- Unexpected issues with SCCM deployment of Ansys Fluids and Structures 2024 R1
- Questions and recommendations: Septum Horn Antenna
- AQWA: Hydrodynamic response error
- Tutorial or Help for 2 way FSI
- Moment Reaction probe with Large deformation
- 2 way coupled FSI for ball bearing
- Issue with force and current density calculations in Fluent MHD
-
1281
-
591
-
544
-
524
-
366
© 2024 Copyright ANSYS, Inc. All rights reserved.