2010/1/21 Bryan Bishop <kanz...@gmail.com> > On Thu, Jan 21, 2010 at 10:47 AM, Charles McCreary > <charles.r.mccre...@gmail.com> wrote: > > Now I want to extract some information from the imported geometry. The > > geometry consists of 3 b-spline curves with knots. I've perused the > doxygen > > generated documents but I'm still rather lost on how to begin. I'm > unclear > > on how to even start a simple task like extracting the points from the > > spline. Suggestions? > > Holy crap, a PE :-). Welcome aboard Charles. Let's see if this does the > trick: > > def process_shape(shape): > '''extracts faces from a shape > note: if this doesnt work you should try process_face(shape) > returns a list of faces''' > faces = [] > explorer = TopExp_Explorer(shape, TopAbs_FACE) > while explorer.More(): > face = TopoDS().Face(explorer.Current()) > faces.append(face) > explorer.Next() > return faces > > def process_face(face): > '''traverses a face for wires > returns a list of wires''' > wires = [] > explorer = TopExp_Explorer(face, TopAbs_EDGE) > while explorer.More(): > edge = TopoDS().Edge(explorer.Current()) > wire = BRepBuilderAPI_MakeWire(edge).Wire() > wires.append(wire) > explorer.Next() > return wires > > At least, this might get you a good head start: check out the > TopExp_Explorer class for sure. Another good technique is to use > bpython-interpreter.org, which can really help figure out pythonOCC's > deep internals without too much pain. Also, some of us pythonOCC users > are in #hplusroadmap on irc.freenode.net if you would like real-time > support over IRC. > > - Bryan > http://heybryan.org/ > 1 512 203 0507 > > Hi Bryan,
You should definitely not use directly the TopExp_Explorer builtin OCC class but rather the Topology.py high level module. This implementation adds hash check of objects returned by TopExp_Explorer iterator to ensure that an element (either a vertex, wire etc.) matching the criterion (TopABS_VERTEX, TopAbs_WIRE etc.) is unique in the returned list. Regards, Thomas
_______________________________________________ Pythonocc-users mailing list Pythonocc-users@gna.org https://mail.gna.org/listinfo/pythonocc-users