How to get value in CAD Parameters to python variable?
Hello,
can you help me to get value of highlighted parameter to python variable? Thank you
Answers
-
For properties that are not directly exposed in the API, there is a general work around that often works. In the example below I get the property based on its caption string. You can then get either the InternalValue, or the StringValue and often convert to a usable variable based on simple logic.
Geometry=ExtAPI.DataModel.Project.Model.Geometry PropCaption = "Import Facet Quality" for Prop in Geometry.VisibleProperties: if Prop.Caption==PropCaption: break MyProp = Prop print MyProp.InternalValue print MyProp.StringValue
0 -
@Mike.Thompson thank you for your feedback. I tried this way but somehow it returnes wrong value. I was searching for while and figured out it returns value of standart deviation of mesh insted of my CAD Parameter? What do you suspect here?
Geometry=ExtAPI.DataModel.Project.Model.Geometry
PropCaption = "Part1:pleat_thickness"
name=[]
for Prop in Geometry.VisibleProperties:
if Prop.Caption==PropCaption:
break
MyProp = Prop
print MyProp.InternalValue
print MyProp.StringValue
print(Prop.name)
#######################################
It returns this no matter what string I put to PropCaption variable.
0.219009462339
0.21901
MeshMetricSTDV
0 -
is there another option? This does not seem to work properly. Thank you
0