How to print edge radius of an edge in a Named selection?

Rohith Patchigolla
Member, Moderator, Employee Posts: 242
✭✭✭✭
in Structures
Answers
-
Try the below script.
- #Please follow the below script to print the radius of the edges in a Named Selection
- namedSelectionName = "All Edges"
- myNS = [child for child in Model.NamedSelections.Children if child.Name == namedSelectionName][0]
- for edgeId in myNS.Location.Ids:
- edgeObj = DataModel.GeoData.GeoEntityById(edgeId)
- #Print radius in Length unit appearing under Details window of Geometry --> Length Unit
- print(edgeObj.Radius)
0 -
The above script works only for v2023R2 or newer. One workaround for pre 2023R2, only if the edge is a full circle is to extract radius from length of the edge.
- import math
- print(pi)
- #Please follow the below script to print the radius of the edges in a Named Selection
- namedSelectionName = "Selection 2"
- myNS = [child for child in Model.NamedSelections.Children if child.Name == namedSelectionName][0]
- for edgeId in myNS.Location.Ids:
- edgeObj = DataModel.GeoData.GeoEntityById(edgeId)
- #Print radius in Length unit appearing under Details window of Geometry --> Length Unit
- edgeRadius = edgeObj.Length/(2*pi)
- print(edgeRadius)
0