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

Member, Moderator, Employee Posts: 242
50 Answers 100 Comments Second Anniversary 25 Likes
✭✭✭✭

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

Answers

  • Member, Moderator, Employee Posts: 242
    50 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭
    edited October 2024

    Try the below script.

    1. #Please follow the below script to print the radius of the edges in a Named Selection
    2. namedSelectionName = "All Edges"
    3. myNS = [child for child in Model.NamedSelections.Children if child.Name == namedSelectionName][0]
    4. for edgeId in myNS.Location.Ids:
    5. edgeObj = DataModel.GeoData.GeoEntityById(edgeId)
    6. #Print radius in Length unit appearing under Details window of Geometry --> Length Unit
    7. print(edgeObj.Radius)
    8.  
  • Member, Moderator, Employee Posts: 242
    50 Answers 100 Comments Second Anniversary 25 Likes
    ✭✭✭✭

    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.

    1. import math
    2. print(pi)
    3. #Please follow the below script to print the radius of the edges in a Named Selection
    4. namedSelectionName = "Selection 2"
    5. myNS = [child for child in Model.NamedSelections.Children if child.Name == namedSelectionName][0]
    6. for edgeId in myNS.Location.Ids:
    7. edgeObj = DataModel.GeoData.GeoEntityById(edgeId)
    8. #Print radius in Length unit appearing under Details window of Geometry --> Length Unit
    9. edgeRadius = edgeObj.Length/(2*pi)
    10. print(edgeRadius)

Welcome!

It looks like you're new here. Sign in or register to get started.