selection.py — Selection Module
Wraps SpinFire.Scripting.API.Utilities.SelectionUtilities. Provides interactive, prompt-driven selection of geometry from the active SpinFire view.
Function |
Parameters |
Returns |
Description |
|---|---|---|---|
|
|
The selected point, or |
Prompts the user to pick a point. |
|
|
|
Prompts the user to pick an edge. |
|
|
A surface with |
Prompts the user to pick a surface. |
What the Results Hold
Edge (
SpinFire.Scripting.API.Geometry.Edge). Its only data member isPoints, the points along the edge in order. It prints as a list such as[14.48, -26.51, 5.45] mm. This was confirmed by the probe. Sample 15 uses it.Surface.
Pointsholds the vertices andVertexNormalsthe normal at each vertex, in the same order. Each point and normal has.X,.Y,.Z. This is used by Sample 06 and Sample 08, and by the built-in Calculate Cylindrical Radius sample. The surface’s type name and any other members haven’t been probed.Point. Not yet probed. Sample 05 reads it by trying
.X/.Y/.Z, then aPoint,PositionorLocationmember, then indexing.
Coordinates are in the model’s units (mm for Filter.CATPart).
Usage
1import spinfirescript as sfs
2
3point = sfs.SelectPoint('Select a point.')
4edge = sfs.SelectEdge('Select an edge.')
5surface = sfs.SelectSurface('Select a surface.')
6
7if edge is not None:
8 print(f"Edge has {len(list(edge.Points))} points")
9if surface is not None:
10 print(f"Surface has {len(list(surface.Points))} vertices")
Each function returns None if the user cancels the selection dialog without picking anything. Check for this before using the result, as the samples do.