Creating Solids from a Deformed Mesh in Ansys SpaceClaim

June 25, 2021 Dan Dart

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):

  1. The original model geometry (solids)
  2. The undeformed mesh, exported from Ansys Mechanical
  3. 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.


Finally, to create your deformed solid, select Run from the Script Editor.

Running the script creates a 4th entity called “Warp0” seen in the below Structure tree, which is the deformed geometry in solid form.

Picture8 Picture9
Now you are ready to use your deformed components in any number of new applications!

About the Author

Dan Dart

Senior Support Engineer

Follow on Linkedin More Content by Dan Dart
Previous Article
Battery Energy Storage System (BESS) Design using Ansys Fluent
Battery Energy Storage System (BESS) Design using Ansys Fluent

The Challenge Fueled by an increasing desire for renewable energies and battery storage capabilities, many ...

Next Article
CFD for Electronics Cooling?
CFD for Electronics Cooling?

It goes without saying that electronics and high temperatures don’t generally mix well; overheating electro...


Have Questions?
Just Ask.

First Name:
Last Name:
Thank you!
Error - something went wrong!