-
-
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.
- The legend values are not changing.
- LPBF Simulation of dissimilar materials in ANSYS mechanical (Thermal Transient)
- Convergence error in modal analysis
- How to model a bimodular material in Mechanical
- APDL, memory, solid
- Meaning of the error
- Simulate a fan on the end of shaft
- Nonlinear load cases combinations
- Real Life Example of a non-symmetric eigenvalue problem
- How can the results of Pressures and Motions for all elements be obtained?
-
3892
-
1414
-
1256
-
1118
-
1015
© 2025 Copyright ANSYS, Inc. All rights reserved.