-
-
May 4, 2023 at 3:35 pm
Jake
SubscriberHello,Â
Â
I have a parametric inventor model that is loaded into Spaceclaim and Modified to be 2D geometry as shown below.Â
Using SCDM scripting in python, how can I find the flats (edges) on the nut geometry that contact the bolt flats (edges) and create named selections for each pair. For example: Â
Named selections for the first thread shown above.Â
Named selections for the second set of threads shown above, Etc.
I can calculate the length of the flats from the pitch on the bolt and nut threads, in this case they’re 0.111" in length.
Â
-
May 5, 2023 at 10:06 am
Aniket
Forum Moderatoryou can use PowerSelection APIs to filter all edges with the same length (note this is what it records in the script editor when I select one edge in the tree, and then from the "selection" tab choose "select edges with same length", and insert selection in the script editor):
PowerSelection.Edges.ByLength(EdgeSelection.Create(GetRootPart().Bodies[0].Edges[2]),Â
  PowerSelectOptions(True), #true if you want to search across all bodies, false if you want to search only in the bodies[0]
  SearchCriteria.SizeComparison.Equal)now you can get 2 selections for same length, you can pythonically loop in one group of edges, to find if there is another edge coincident with it:
for example:
GetRootPart().Bodies[0].Edges[3].Shape.Geometry.IsCoincident(GetRootPart().Bodies[1].Edges[0].Shape.Geometry)
-Aniket
-
May 5, 2023 at 3:03 pm
-
May 8, 2023 at 10:18 am
Aniket
Forum Moderator -
May 8, 2023 at 12:17 pm
Jake
SubscriberNo they are not coincident.Â
-
May 9, 2023 at 8:31 am
Aniket
Forum ModeratorIsCoincident will only work if the edges are coincident. If they are not, you may have to try and check the bounding box of these edges and then decide this.
You can get a bounding box by:
e1=GetRootPart().Bodies[0].Edges[0]
b1=e1.Shape.GetBoundingBox(Matrix.Identity)
b1.Center
b1.corner
-Aniket
How to access Ansys help links
Guidelines for Posting on Ansys Learning Forum
Â
-
-
- The topic ‘SCDM Scripting Parametric Selection of Thread Flats on a Nut and Bolt’ is closed to new replies.
- Unable to attach geometry 2024 R2
- Data Center Simulation
- DXF file loaded incorrectly
- Inventor 2025 files
- Masonry Brick Simulation
- Ansys SpaceClaim and Discovery 2024 Facet shelling bug – 2022 version is better
- solidwork parameters for optimization in ansys
- Spaceclaim 2024 error FNE activation failed
- Simulating PCB
-
1937
-
839
-
599
-
591
-
366
© 2025 Copyright ANSYS, Inc. All rights reserved.