Hi Dave and Thomas, Thank you for your help. Both methods (pickle and OCC.Utils.Topology.dumpTopology) worked. However, the dumpTopology output was more readable. It is limited to vertex data only, but that's all I need for now. I may update the function to output Tolerance and other features later now that I understand how to use BRep_Tool. FYI, the dumpTopology function did not work correctly in my version. I had to modify it as follows. I'm not sure if I misused the function, or if something changed since when it was written. Thanks once again.
- Charles from OCC.BRep import * from OCC.BRepPrimAPI import * from OCC.gp import * import OCC.TopoDS as TopoDS from OCC.TopAbs import * from OCC.Utils.Topology import shapeTypeString import pickle def dumpTopology(shape,level=0): """ Print the details of an object from the top down """ brt = BRep_Tool() s = shape.ShapeType() #ts = TopoDS.TopoDS() # Commented out by Charles print print "." * level,shapeTypeString(shape), if s == TopAbs_VERTEX: #pnt = brt.Pnt(ts.Vertex(shape)) # Commented out by Charles pnt = brt.Pnt(TopoDS.TopoDS_vertex(shape)) # Added by Charles print "<Vertex: %s %s %s>" % (pnt.X(), pnt.Y(), pnt.Z()) it = TopoDS.TopoDS_Iterator(shape) while it.More(): shp = it.Value() it.Next() dumpTopology(shp,level + 1 ) if __name__ == '__main__': print 'pickle dump' b1 = BRepPrimAPI_MakeBox(1.0, 1.0, 1.0).Shape() s = pickle.dumps(b1) print s print print 'OCC.Topology dump' dumpTopology(b1) _______________________________________________ Pythonocc-users mailing list Pythonocc-users@gna.org https://mail.gna.org/listinfo/pythonocc-users