TAGGED: script, spaceclaim, spaceclaim-python-scripting
-
-
April 4, 2023 at 7:20 pm
Bruno Iwanczyk
SubscriberHi,
I've been learning how to make a parametric model by scripting in SpaceClaim, but haven't been able to find much information on how Smart Variables work.
If I select a body, click Insert Selection, rerun the script (with a ClearAll() at the beginning), select the same body and click Insert Selection I end up with two smart variables: Body1 and Body2. However they seem to be interchangeable, I can type either one into a function and the result is the same. So why do they have different names?
I'm also curious as to how the smart variable is linked to the body it describes, so that I can know what will or won't break it.
-
April 7, 2023 at 7:18 pm
mjmiddle
Ansys EmployeeThe smart variable is compiled data to identify a selection. This means you can't look at any code to see exactly how it works. It is only saved to the script when you save as .scscript format. The .py format is only a text format and so will not save this complied data.
The smart variable, also known as metadata, is very much tied to the curent geometry. Because of this, I personally prefer to get rid of any compiled data so the script is more interchangable with other models. You can do this by setting index selection type:
You can also make sure your script continues by using the return values of previous functions:
result.CreatedPlanes, result.CreatedCurves, result.CreatedBodies, result.CreatedFaces, result.CreatedPlanes[0]
Normally your Body1 and Body2 smart variables would not work interchangeably, because each is tied to the specific body that you then deleted. It is only working because you are clearing everything and each seems to point to the first body.
-
- You must be logged in to reply to this topic.

Boost Ansys Fluent Simulations with AWS
Computational Fluid Dynamics (CFD) helps engineers design products in which the flow of fluid components is a significant challenge. These different use cases often require large complex models to solve on a traditional workstation. Click here to join this event to learn how to leverage Ansys Fluids on the cloud, thanks to Ansys Gateway powered by AWS.

Earth Rescue – An Ansys Online Series
The climate crisis is here. But so is the human ingenuity to fight it. Earth Rescue reveals what visionary companies are doing today to engineer radical new ideas in the fight against climate change. Click here to watch the first episode.

Ansys Blog
Subscribe to the Ansys Blog to get great new content about the power of simulation delivered right to your email on a weekly basis. With content from Ansys experts, partners and customers you will learn about product development advances, thought leadership and trends and tips to better use Ansys tools. Sign up here.
- How to work with STL file?
- Rotate tool in ANSYS Design Modeler
- Using Symmetry in DesignModeler and Expanding the Results
- section plane
- ANSYS FLUENT – Operation would result in non manifold bodies
- material properties
- drawing a geometry by importing a table of points
- Geometry scaling
- Coordinates orientation
- “contact pair has no element in it.” how to resolve this problem
-
5332
-
3311
-
2471
-
1308
-
1016
© 2023 Copyright ANSYS, Inc. All rights reserved.