> vs=[[0,0,0],[1,0,0],[1,1,0],[0,1,0]];
> es=TopTools_HSequenceOfShape()
> es.Append(BRepBuilderAPI_MakeEdge(gp_Pnt(*vs[0]),gp_Pnt(*vs[1])).Edge())
> es.Append(BRepBuilderAPI_MakeEdge(gp_Pnt(*vs[1]),gp_Pnt(*vs[2])).Edge())
> es.Append(BRepBuilderAPI_MakeEdge(gp_Pnt(*vs[2]),gp_Pnt(*vs[3])).Edge())
> es.Append(BRepBuilderAPI_MakeEdge(gp_Pnt(*vs[3]),gp_Pnt(*vs[0])).Edge())
> ws=TopTools_HSequenceOfShape()
> safb=ShapeAnalysis_FreeBounds()
> safb.ConnectEdgesToWires(es.GetHandle(),1e-3,False,ws.GetHandle())


Hi Björn,

I'm getting a little annoyed by a somewhat threatening and demanding  tone on 
this list; giving our readers homework ( last thread ) and now threatening to 
abandon pythonocc if we do not fix some issue in a week. Be a little more 
respectful, please.

Back to the problem;

Just to understand your issue in more detail; let me ask you why you would 
create in the suggested manner.
There's a pythonic way to do it.


( oops… from OCC.Utils.Construct import * )
In [25]: vs = map( lambda x: gp_Pnt(*x), [[0,0,0],[1,0,0],[1,1,0],[0,1,0]])

In [26]: vs
Out[26]: 
[<OCC.gp.gp_Pnt; proxy of <Swig Object of type 'gp_Pnt *' at 0x10b409b50> >,
 <OCC.gp.gp_Pnt; proxy of <Swig Object of type 'gp_Pnt *' at 0x10b409b70> >,
 <OCC.gp.gp_Pnt; proxy of <Swig Object of type 'gp_Pnt *' at 0x10b409b90> >,
 <OCC.gp.gp_Pnt; proxy of <Swig Object of type 'gp_Pnt *' at 0x10b409bb0> >]

In [27]: edg1 = make_edge(vs[0], vs[1])

In [28]: edg2 = make_edge(vs[1], vs[2])

In [29]: edg2 = make_edge(vs[2], vs[3])

In [30]: edg3 = make_edge(vs[2], vs[3])

In [31]: edg4 = make_edge(vs[3], vs[0])

In [32]: wire = make_wire([edg1,edg2,edg3,edg4])

In [33]: wire
Out[33]: <OCC.TopoDS.TopoDS_Wire; proxy of <Swig Object of type 'TopoDS_Wire *' 
at 0x102b04040> >

Take care, be nice,

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

Reply via email to