How do I check if two edges in a named selection are connected?
Ayush Kumar
Member, Moderator, Employee Posts: 467
✭✭✭✭
Answers
-
You check for a common Vertex ID by retrieving the
Vertex
fromEdgeWrapper
. The following code expects a named selection with 2 edges called "EDGES"# Get both edges edges = ExtAPI.DataModel.GetObjectsByName("EDGES")[0] # Get Geo Data geo_data = ExtAPI.DataModel.Project.Model.Analyses[0].GeoData # Store all vertex ids in a list edge_vertices = [vertex.Id for edge_id in edges.Ids for vertex in geo_data.GeoEntityById(edge_id).Vertices] # Check if there is a duplicate entry if len(set(edge_vertices)) == len(edge_vertices): print("Edges are discontinuous") else: print("Edges are continuous")
2