-
-
August 7, 2023 at 2:47 pm
thermalsr71
SubscriberHi, I'm doing a script that applies an arbitrary thickness to the parts of the geometry tree, depending on whether they are stored in a previously made dictionary or not.
However, when I try to set the thickness manually, I'm getting the error:"expected Quantity, got float"
If someone could help me understand the error or the way to convert a floating number into the so-called "Quantity", I'd be very grateful to you.
My code goes:
for key, values in partAndBody.items():
for part in geom.Children:
for body in part.Children:
if values[2] == 'Plane Stress':
body.Behavior = Model2DBehavior.PlaneStress
body.Thickness = values[3]
thank you in advance. -
August 7, 2023 at 3:08 pm
thermalsr71
SubscriberJust found a way. Ansys works with its own particular data types. Had to declare my data as Quantity('{} [{}]'.format(values[3], 'mm')) and it worked!
-
August 8, 2023 at 5:21 am
Erik Kostson
Ansys EmployeeFor further discusions on the quantity function and how to use it see:
/forum/forums/topic/use-of-loop-in-python-scripting/
-
- The topic ‘Geometry Tree Body Thickness automation’ is closed to new replies.
-
3492
-
1057
-
1051
-
965
-
942
© 2025 Copyright ANSYS, Inc. All rights reserved.