I want to find circle edges in mechanical model

Options
Lukas
Lukas Member Posts: 11
Name Dropper First Comment
edited June 2023 in Structures

I wrote following code to get ID´s of circle edges :

g = ExtAPI.DataModel.Project.Model.Geometry
allbodies = g.GetChildren[Ansys.ACT.Automation.Mechanical.Body](True)
geo_bodies = [x.GetGeoBody() for x in allbodies if x.Suppressed == False]

circles=[]
for geo in geo_bodies:
  for edge in geo.Edges:
    if edge.Type == EdgeType.Circle:
      circles.append(edge.Id)
print(circles)


However I get empty list. Any idea what is wrong? Thank you

Best Answer

  • Nick R
    Nick R Member Posts: 12
    First Answer 5 Likes First Comment
    edited January 2023 Answer ✓
    Options

    Edges have two properties, one for its type (which is edge) and one for curve type.

    edge.CurveType == GeoCurveTypeEnum.GeoCurveCircle
    

    If you replace Type with CurveType and EdgeType with the GeoCurveTypeEnum you should be able to filter different edge properties

Answers

  • Lukas
    Lukas Member Posts: 11
    Name Dropper First Comment
    Options

    @Nick R thank you. I´ve found also "Circle" edge type in API Reference Quide along with "Line", "Spline" etc. so it´s quite confusing whether to go for Type or GeoCurveTypeEnum property.