I was hoping someone could explain the following odd wrapper behavior: if I build a TopoDS_Face inside a Python function, then return it from the function, the returned face seems to be different/invalid in the calling scope. Here is the output:
faceInsideFunction.IsNull: 0 <OCC.TopoDS.TopoDS_Face; proxy of <Swig Object of type 'TopoDS_Face *' at 0x01BE4640> > returnedFace.IsNull: 1 <OCC.TopoDS.TopoDS_Face; proxy of <Swig Object of type 'TopoDS_Face *' at 0x01BDF7E0> > And here is the code that generated this output: from OCC import gp, BRepBuilderAPI, TopoDS def MakeFace(pts): gpnts = [gp.gp_Pnt(x,y,z) for x,y,z in pts] n = len(gpnts) gpnts.append(gpnts[0]) mkwire = BRepBuilderAPI.BRepBuilderAPI_MakeWire() for i in range(n): mkedge = BRepBuilderAPI.BRepBuilderAPI_MakeEdge(gpnts[i], gpnts[i+1]) mkwire.Add(mkedge.Edge()) mkface = BRepBuilderAPI.BRepBuilderAPI_MakeFace(mkwire.Wire()) f = mkface.Face() print 'faceInsideFunction.IsNull:', f.IsNull() print f return f def Test1(): y = 0.000 o = 0.000 d = 0.100 fpts = [ [o, y,o ], [o+d,y,o ], [o+d,y,o+d], [o, y,o+d], ] f1 = MakeFace(fpts) print print 'returnedFace.IsNull:', f1.IsNull() print f1 if __name__ == '__main__': Test1() Thanks for a great project! Frank Conradie Rossland, BC, Canada _______________________________________________ Pythonocc-users mailing list Pythonocc-users@gna.org https://mail.gna.org/listinfo/pythonocc-users