> Finding out where the intersection lies at and than building 2 faces is a > good >idea it seams to me.
Yes, it depends on tolerances. Sometimes small loops are just sampling errors (then it is better to collapse the vertices) and sometimes the faces should be split. But the question is: are there algorithms available in OCC/pythonOCC that perform either of these modifications? I do not want to reinvent the wheel. > * do you have the doxygen documentation? I do have OCC's ShapeFix doxygen documentation. But I don't see what I am doing wrong. Or do you mean pythonOCC's documentation, because it is not 100% compatible with the C++ libraries? Or ShapeHeal documentation? I cannot find it. Thank you Björn ----- Ursprüngliche Mail ---- > Von: Jelle Feringa <jelleferi...@gmail.com> > An: pythonOCC users mailing list. <pythonocc-users@gna.org> > Gesendet: Donnerstag, den 12. August 2010, 11:53:14 Uhr > Betreff: Re: [Pythonocc-users] face from self-intersecting wire, ShapeFix > > Finding out where the intersection lies at and than building 2 faces is a > good >idea it seams to me. > > * do you have the doxygen documentation? > * if I understood correctly, shape healing is made of the Shape* API > > > > On Aug 12, 2010, at 11:20 AM, Free Cad wrote: > > > Hi again, > > can you help me use ShapeFix in the correct way, or suggest other > > solutions >to a > > > problem with self-intersecting wires? > > > > The code below generates an example of such a wire. There is a small loop >close > > > to the point (1.0,1.0,0.0) which is the reason why no face can be made > > from >it, > > > I guess. > > > > The code also shows my attempt to solve the problem using >sf=ShapeFix_Wire(). > > > But sf.Perform() always fails, even if the wire is without problems (using > > vertex definitions as in the line which is commented out). > > > > What is the simplest solution to generate a face from self-intersecting >wires > > > _automatically_? In my example, the small loop could be collapsed to a >single > > > vertex, or the wire could be split into two (the large loop and the small >loop) > > > - both solutions would be fine. > > How about OCC's ShapeHealing functions? Are they more powerful than >ShapeFix? I > > > don't understand the relation between ShapeFix and ShapeHealing. Is >ShapeHealing > > > available in the non-commercial OCC distribution? > > > > > > Thank you > > Björn > > > > --- code example: --- > > from OCC.BRepBuilderAPI import * > > from OCC.gp import * > > from OCC.ShapeFix import * > > from OCC.TopoDS import * > > > > def fixWire(wire): > > sf=ShapeFix_Wire() > > sf.Load(wire) > > sf.SetFixIntersectingEdgesMode(1) > > sf.SetFixNonAdjacentIntersectingEdgesMode(1) > > sf.SetFixSelfIntersectingEdgeMode(1) > > if sf.Perform(): > > print 'Fix Successful' > > return sf.Wire() > > else: > > print 'Fix Unsuccessful' > > return wire > > > > def vertex(x,y,z): > > mv=BRepBuilderAPI_MakeVertex(gp_Pnt(x,y,z)) > > return mv.Vertex() > > def edge(v1,v2): > > me=BRepBuilderAPI_MakeEdge(v1,v2) > > return me.Edge() > > def face(w): > > mf=BRepBuilderAPI_MakeFace(w) > > return mf.Face() > > def wire(e1,e2,e3,e4): > > mw=BRepBuilderAPI_MakeWire(e1) > > mw.Add(e2); mw.Add(e3); mw.Add(e4); > > return mw.Wire() > > > > v=[vertex(0,0,0),vertex(1,0,0),vertex(0.95,1,0),vertex(1,1,0)] #self > > intersecting, no face visible > > #v=[vertex(0,0,0),vertex(1,0,0),vertex(1,1,0),vertex(0.9,1,0)] #valid wire > > e=[] > > for i in range(4): > > e.append(edge(v[i-1],v[i])) > > w=wire(e[0],e[1],e[2],e[3]) > > f=face(fixWire(w)) > > > > from OCC.Display.SimpleGui import * > > display, start_display, add_menu, add_function_to_menu = init_display() > > display.DisplayShape([w,f]) > > start_display() > > > > > > > > > > > > _______________________________________________ > > Pythonocc-users mailing list > > Pythonocc-users@gna.org > > https://mail.gna.org/listinfo/pythonocc-users > > _______________________________________________ Pythonocc-users mailing list Pythonocc-users@gna.org https://mail.gna.org/listinfo/pythonocc-users