Perhaps your offset value is so small that it is roughly as large as your Precision().Confusion() tolerance.
Does it segfault with larger values?
Are you checking offset.IsDone()?

-jelle


On Apr 18, 2010, at 2:06 PM, Dave Cowden wrote:

Segfault. I am able to diagnose once i have a stack trace.. I was hoping you knew of a way to get a stacktrace from a segfault, but sounds like you end up diving into the source at that point...

thanks for the help, i know where to get the c++ source so i'll poke around...

thanks as always for the quick response and help !


On Sun, Apr 18, 2010 at 7:54 AM, Thomas Paviot <tpav...@gmail.com> wrote: What do you mean exactly with 'crash'? Do OCC raise an exception catched by pythonOCC (like Standard_ConstructionError for instance) or is it a segfault?

If the error is not reproductible (ie. according to the wires passed to the BRepOffsetAPI_MakeOffset class, the Perform() method passes or fails), it may come from an issue in the algorithm used by OCC de perform the operation. In that case, it's really difficult to identify the problem, unless diving into the C++ code.

Thomas

2010/4/18 Dave Cowden <dave.cow...@gmail.com>
Hi, Thomas, thanks!

That definitely makes my code much more readable: but unfortunately the crash still occurs at that same place. I also switched to using Topo in a couple of other places ( where the face you see passed into that method is created ), but that did not help either.

How do you go about finding what's going on when you encounter these?

On Sun, Apr 18, 2010 at 12:30 AM, Thomas Paviot <tpav...@gmail.com> wrote:
2010/4/18 Dave Cowden <dave.cow...@gmail.com>

Hi, all:

I'm struggling with a couple of problems that I presume to be null pointers that are crashing OCC. I have a feeling this may be related to memory management.

For example, I've tracked down one crash to one line: BRepBuilderAPI_MakeOffset.Perform(). I load it with several wires, each of which I can display successfully immediately before invoking perform. Yet, Perform() crashes. See example below. I do not believe any object scoping issues are at play that I can see: all of the objects in question seem to be in scope when the crash happens.

I am also fairly certain that its something I'm doing: all of the 'simple' test cases I create work fine.

So my question is: are there any tricks/techniques I can use to isolate the problem when a crash occurs? Right now i'm using old school print statements to get to what method call dies, but I still cannot see what exactly is going wrong. Help is appreciated, this is completely kicking my butt :(


        #offset a face, returning the offset shape
        def _offsetFace(self,face,offset ):
                brt = BRepTools.BRepTools();
                ow = brt.OuterWire(face);
                bo = BRepOffsetAPI.BRepOffsetAPI_MakeOffset();

                bo.AddWire(ow);

                #now get the other wires
                te = TopExp.TopExp_Explorer();
                te.Init(face,TopAbs.TopAbs_WIRE);
                while te.More():
                                w = ts.Wire(te.Current());
TestDisplay.display.showShape(w); # this line succesfully shows the wires on screen
                                if not w.IsSame(ow):
                                                bo.AddWire(w);
                                te.Next();
                te.ReInit();
                
                print "about to offset...";


bo.Perform(offset,0.00001); #this line crashes hard, but only sometimes.
                print "done offsetting..";

                if  not bo.IsDone():
                        raise Exception, "Offset Was Not Successful.";
                else:
                        return  bo.Shape();


Hi Dave,

If you want to traverse topology, I suggest you use the Topo class available from the High-Level Topology subpackage (the 'Topo' name for this class is maybe not the best one). This is a wrapper over the TopExp class which fixes issues related to TopExp (with the use of the __hash__ method):

from OCC.Utils.Topology import Topo

        #offset a face, returning the offset shape
        def _offsetFace(self,face,offset ):
                brt = BRepTools.BRepTools();
                ow = brt.OuterWire(face);
                bo = BRepOffsetAPI.BRepOffsetAPI_MakeOffset();

                bo.AddWire(ow);

                #now get the other wires
                for w in Topo(face).wires():
                    bo.AddWire(w);
                print "about to offset...";

                bo.Perform(offset,0.00001);
                print "done offsetting..";

                if  not bo.IsDone():
                        raise Exception, "Offset Was Not Successful.";
                else:
                        return  bo.Shape();

Hope this helps,

Regards,

Thomas



_______________________________________________
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


_______________________________________________
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