Thank you, Jelle.
This may answer my questions. I will have a look at the suggested classes. And 
of course, I can share the example, when I find a solution.

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:59:03 Uhr
> Betreff: Re: [Pythonocc-users] face from self-intersecting wire, ShapeFix
> 
> Sorry, hit send too soon…
> 
> Have you had a look at 
> 
> ShapeUpgrade_WireDivide
> 
> ShapeAnalysis_Wire will help you find out  which are intersecting edges.
> 
> Björn, if you manage to fix this (  confident you will ;) than would you 
> please 
>share this example with us, such  that way may include it in the /examples  ?
> 
> Thanks,
> 
> -jelle
> 
> 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
> 




_______________________________________________
Pythonocc-users mailing list
Pythonocc-users@gna.org
https://mail.gna.org/listinfo/pythonocc-users

Reply via email to