Python code to access CAD Parameter value in DOE/DP
Hello,
I'm using below script to get CAD parameter information inside mechanical by running it in mechanical scripting window. But when I create a Python code for the same script it says null value for L,H and R.
Can you please help me in this, or can you please suggest a way to access DP parameter values in python code so that my script will run over all DP points. Thanks.
Scirpt :
import wbjn
parameters_cmd ='''
parameter, parameterName, parameterValueType, parameterValue, parameterValueUnit = ([] for i in range(5))
for param in Parameters.GetAllParameters():
parameter.append(param.Name)
parameterValue.append(param.Value.Value)
parameterName.append(param.DisplayText)
parameterValueUnit.append(param.Value.Unit)
parameters = [parameter,parameterValue,parameterName,parameterValueUnit]
returnValue(parameters)
'''
parameter= wbjn.ExecuteCommand(ExtAPI,parameters_cmd)
These are geometric parameters
L=parameter[1][0]
H=parameter[1][1]
R=parameter[1][2]
print(L,H,R)
Comments
-
@AKD-Scripting-Team Could someone have a look? Many thanks
0 -
I have not worked with Python code objects much, so just guessing here, but probably you need to add the location of the wbjn module to your system path. Something like:
import sys pyDir = r"C:\Program Files\ANSYS Inc\v241\Addins\ACT\libraries\Mechanical" sys.path.append(pyDir)
0 -
@SK resolved?
0