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

Rohith Patchigolla
Rohith Patchigolla Member, Moderator, Employee Posts: 193
100 Comments 25 Answers Second Anniversary 25 Likes
✭✭✭✭

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

Answers

  • Rohith Patchigolla
    Rohith Patchigolla Member, Moderator, Employee Posts: 193
    100 Comments 25 Answers Second Anniversary 25 Likes
    ✭✭✭✭
    edited October 10

    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)
    
    
  • Rohith Patchigolla
    Rohith Patchigolla Member, Moderator, Employee Posts: 193
    100 Comments 25 Answers 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.

    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)