Quite often, engineers need to set up a model not by using ideal or undeformed geometry but by using a geometry that has been deformed as the result of structural loading. Checking for clearance or fit within a larger top-level assembly, using the deformed shape for additional simulation or physics, or using the deformed components in a production model could be a reason why a user would seek to create solid geometry from their deformed mesh. With some of the Python scripts available in Ansys SpaceClaim, this process is quite easy.
To start, open SpaceClaim and import the following objects (making sure that they all share the same coordinate system and origin):
- The original model geometry (solids)
- The undeformed mesh, exported from Ansys Mechanical
- The deformed mesh, exported from Ansys Mechanical
From the File menu, create a new Script:
Copy and Paste in the code below (This SpaceClaim 2021R1) (Copying the comment lines beginning with “#”is optional)
# Python Script, API Version = V20 Beta
from SpaceClaim.Api.V20.Scripting.Internal import CustomMethods
# m0 uses the Original Model in STL (Exported from Mechanical)
# m1 uses the Deformed Model in STL (Exported from Mechanical)
# b uses the Original Model geometry in imported or native to Space Claim
# 0.00001 is the tolerance in meters
Select Version V20 Beta
Next, we need to use the select tool to verify the entity ID numbers for m0, m1, and b. Change the select tool from the Script Editor to use the “Index” method:
Then, turn off recording, select the facet body of the original geometry (it should be inside of a component in the tree), then select the Select Tool from the Script Editor to define that selection. Repeat this process for the deformed mesh and the original body geometry. Verify that the IDs for those entities match the corresponding assignments for m0, m1, and b.
If it is helpful, you can simply Copy and Paste the portion of each line starting with “GetRootPart()…” to the definitions for m0, m1, and b. Once all three objects have been defined, comment out the selections by placing a # at the beginning of each line.
Running the script creates a 4th entity called “Warp0” seen in the below Structure tree, which is the deformed geometry in solid form.
About the AuthorFollow on Linkedin More Content by Dan Dart