def buildFaceBotUp(): """Following procedure in Roman Lygen's blog """ origin = gp_Pnt(0, 0, 0) wDir = gp_Dir(0, 0, 1) uDir = gp_Dir(1, 0, 0) vDir = gp_Dir(0, 1, 0) xyzAx3 = gp_Ax3(origin, wDir, uDir) gpPlane = gp_Pln(xyzAx3) # type OCC.gp.gp_Pln # gpPlane = gp_XOY() # type gp_Ax2 plane = Geom_Plane(gpPlane) # type: OCC.Geom.Geom_Plane aSurf = Handle_Geom_Surface(plane) # type: Handle_Geom_Surface anExtC = Geom_Circle(gp_XOY(), 10.0) # type: OCC.Geom.Geom_Circle anIntC = Geom_Circle(gp_XOY(), 5.0) # type: OCC.Geom.Geom_Circle anExtE = BRepBuilderAPI_MakeEdge(anExtC.GetHandle()) anIntE = BRepBuilderAPI_MakeEdge(anIntC.GetHandle()) anExtWire = BRepBuilderAPI_MakeWire(anExtE.Edge()) anIntWire = BRepBuilderAPI_MakeWire(anIntE.Edge()) aFace = BRepBuilderAPI_MakeFace(anExtWire.Wire()) aFace.Add(anIntWire.Wire()) # adds wire to the face as a hole display.DisplayShape(aFace.Face()) edgeList = [] anEdgeExplorer = TopExp_Explorer(aFace.Face(), TopAbs_EDGE) while anEdgeExplorer.More(): anEdge = topods.Edge(anEdgeExplorer.Current()) anEdgeExplorer.Next() edgeList.append(anEdge) print 'Number of edges: ', len(edgeList) Topology.dumpTopology(aFace.Face()) topo = Topology.Topo(aFace.Face()) print 'Number of wires: ', topo.number_of_wires_from_face(aFace.Face()) wires = topo.wires_from_face(aFace.Face()) for wire in wires: display.DisplayShape(wire)
def topoDumpAP(): if win.activePart: Topology.dumpTopology(win.activePart)