Quantity function equivalent CPython
Dear All,
I am currently working on a script in Ansys Mechanical Scripting for which it is very easy to work with CPython (in BETA version unfortunately). Whatever, everything is working except when i have to define values which need the function Quantity (to define a temperature with attached unit for instance). Indeed, CPython does not recognize this Quantity function and return "Quantity" is not defined...
Any idea how can i bypass this difficulty ?
Thank you for your help,
Best regards,
Pierre
Answers
-
Perhaps use the full path to the Quantity creator function. To get this, make a quantity in ironpython and then do MyQuantity.GetType()
This will print the full object type path (I think it starts with Ansys. )0 -
Dear Mike,
Thank you for your quick reply !
By typing Quantity.GetType(), i obtain:
System.RuntimeTypeNot sure how can i use this...
Thank you !
Pierre0 -
Dear Mike,
Finally, I found ! To use Quantity in CPython, you just need to use the full link (as you said !)
Ansys.Core.Units.Quantity()Problem fixed !
Thank you !
Pierre0