ugly crash when deburring shapestring pad

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
freman
Veteran
Posts: 2214
Joined: Tue Nov 27, 2018 10:30 pm

ugly crash when deburring shapestring pad

Post by freman »

Hi,

I started having problems with this model using a December '19 AppImage. I just built todays master and get the same results.

If I try to add a debur to either of the eliptical edges, the face between or any segment the number 9 pocket I get a splurt of red messages. If I try to debur the lower face of the figure 9 pocket, I does a dump on the console.

Here is the output from the outer elipse ( basically the same for the other cases stated ).

Code: Select all

Deburr Select Mode
Free Select
PathGeom.WARNING: <class 'Part.OffsetCurve'> not support for flipping
Traceback (most recent call last):
  File "~/freecad-master-build/Mod/Path/PathScripts/PathUtils.py", line 59, in new_function
    res = function(*args, **kwargs)
  File "~/freecad-master-build/Mod/Path/PathScripts/PathOp.py", line 513, in execute
    result = self.opExecute(obj) # pylint: disable=assignment-from-no-return
  File "~/freecad-master-build/Mod/Path/PathScripts/PathDeburr.py", line 103, in opExecute
    wire = PathOpTools.offsetWire(w, base.Shape, offset, True)
  File "~/freecad-master-build/Mod/Path/PathScripts/PathOpTools.py", line 192, in offsetWire
    owire = orientWire(wire.makeOffset2D(offset), True)
  File "~/freecad-master-build/Mod/Path/PathScripts/PathOpTools.py", line 136, in orientWire
    wire = Part.Wire(_orientEdges(w.Edges))
  File "~/freecad-master-build/Mod/Path/PathScripts/PathOpTools.py", line 98, in _orientEdges
    last = e0.valueAt(e0.LastParameter)
<class 'AttributeError'>: 'NoneType' object has no attribute 'valueAt'
1.64e-06 <App> Document.cpp(3462): Failed to recompute pad_bug#Deburr: 'NoneType' object has no attribute 'valueAt'
Recompute failed! Please check report view.
and here is the mess if I select Clone.Face27 at the bottom of the pocket:

Code: Select all

Solid
Program received signal SIGSEGV, Segmentation fault.
#0  /lib64/libpthread.so.0(+0x14b20) [0x7f763febfb20]
#1  0x7f760dc2ce00 in TopoDS_Shape::ShapeType() const from ~/freecad-master-build/Mod/Path/Path.so+0x18
#2  0x7f760d7b4c9b in Part::BRepOffsetAPI_MakeOffsetFix::Shape() from ~/freecad-master-build/Mod/Part/Part.so+0x61
#3  0x7f760d80d2fc in Part::TopoShape::makeOffset2D(double, short, bool, bool, bool) const from ~/freecad-master-build/Mod/Part/Part.so+0xad4
#4  0x7f760d6f4dd0 in Part::TopoShapePy::makeOffset2D(_object*, _object*) from ~/freecad-master-build/Mod/Part/Part.so+0x154
#5  0x7f760d6decc0 in Part::TopoShapePy::staticCallback_makeOffset2D(_object*, _object*, _object*) from ~/freecad-master-build/Mod/Part/Part.so+0xaa
#6  /lib64/libpython3.7m.so.1.0(_PyMethodDef_RawFastCallKeywords+0x298) [0x7f7640a99658]
#7  /lib64/libpython3.7m.so.1.0(_PyCFunction_FastCallKeywords+0x23) [0x7f7640a99753]
#8  /lib64/libpython3.7m.so.1.0(+0x141923) [0x7f7640acc923]
#9  /lib64/libpython3.7m.so.1.0(_PyEval_EvalFrameDefault+0x55d2) [0x7f7640b07c92]
#10  /lib64/libpython3.7m.so.1.0(_PyEval_EvalCodeWithName+0x2f0) [0x7f7640ab9cb0]
#11  /lib64/libpython3.7m.so.1.0(_PyFunction_FastCallKeywords+0x2a2) [0x7f7640abacb2]
#12  /lib64/libpython3.7m.so.1.0(+0x14180f) [0x7f7640acc80f]
#13  /lib64/libpython3.7m.so.1.0(_PyEval_EvalFrameDefault+0x55d2) [0x7f7640b07c92]
#14  /lib64/libpython3.7m.so.1.0(_PyFunction_FastCallKeywords+0x102) [0x7f7640abab12]
#15  /lib64/libpython3.7m.so.1.0(+0x14180f) [0x7f7640acc80f]
#16  /lib64/libpython3.7m.so.1.0(_PyEval_EvalFrameDefault+0xbfe) [0x7f7640b032be]
#17  /lib64/libpython3.7m.so.1.0(_PyFunction_FastCallDict+0x11a) [0x7f7640abb17a]
#18  /lib64/libpython3.7m.so.1.0(_PyEval_EvalFrameDefault+0x2328) [0x7f7640b049e8]
#19  /lib64/libpython3.7m.so.1.0(_PyEval_EvalCodeWithName+0x2f0) [0x7f7640ab9cb0]
#20  /lib64/libpython3.7m.so.1.0(_PyFunction_FastCallDict+0x2ee) [0x7f7640abb34e]
#21  /lib64/libpython3.7m.so.1.0(_PyObject_Call_Prepend+0x66) [0x7f7640a8ef76]
#22  /lib64/libpython3.7m.so.1.0(PyObject_Call+0x7e) [0x7f7640abb88e]
#23  0x7f76431c853b in Base::pyCall(_object*, _object*) from ~/freecad-master-build/lib/libFreeCADGui.so+0x28
#24  0x7f7641e593b8 in App::FeaturePythonImp::execute() from ~/freecad-master-build/lib/libFreeCADApp.so+0x1f2
#25  0x7f760dc0bbb0 in App::FeaturePythonT<Path::Feature>::execute() from ~/freecad-master-build/Mod/Path/Path.so+0x22
#26  0x7f7641daaa7e in App::DocumentObject::recompute() from ~/freecad-master-build/lib/libFreeCADApp.so+0xc2
#27  0x7f7641cd0ca7 in App::Document::_recomputeFeature(App::DocumentObject*) from ~/freecad-master-build/lib/libFreeCADApp.so+0x1b5
#28  0x7f7641ccec2f in App::Document::recompute(std::vector<App::DocumentObject*, std::allocator<App::DocumentObject*> > const&, bool, bool*, int) from ~/freecad-master-build/lib/libFreeCADApp.so+0x8bf
#29  0x7f7641e1f329 in App::DocumentPy::recompute(_object*) from ~/freecad-master-build/lib/libFreeCADApp.so+0x355
#30  0x7f7641e170de in App::DocumentPy::staticCallback_recompute(_object*, _object*) from ~/freecad-master-build/lib/libFreeCADApp.so+0xea
#31  /lib64/libpython3.7m.so.1.0(_PyMethodDef_RawFastCallKeywords+0x25e) [0x7f7640a9961e]
#32  /lib64/libpython3.7m.so.1.0(_PyCFunction_FastCallKeywords+0x23) [0x7f7640a99753]
#33  /lib64/libpython3.7m.so.1.0(+0x141923) [0x7f7640acc923]
#34  /lib64/libpython3.7m.so.1.0(_PyEval_EvalFrameDefault+0x55d2) [0x7f7640b07c92]
#35  /lib64/libpython3.7m.so.1.0(_PyFunction_FastCallDict+0x11a) [0x7f7640abb17a]
#36  /lib64/libpython3.7m.so.1.0(_PyObject_Call_Prepend+0x66) [0x7f7640a8ef76]
#37  /lib64/libpython3.7m.so.1.0(PyObject_Call+0x7e) [0x7f7640abb88e]
#38  0x7f76430d6ddd in Py::Callable::apply(Py::Tuple const&) const from ~/freecad-master-build/lib/libFreeCADGui.so+0x3b
#39  0x7f7643532017 in Gui::TaskView::TaskDialogPython::clicked(int) from ~/freecad-master-build/lib/libFreeCADGui.so+0x17f
#40  0x7f764352ad49 in Gui::TaskView::TaskView::clicked(QAbstractButton*) from ~/freecad-master-build/lib/libFreeCADGui.so+0x55
#41  ~/freecad-master-build/lib/libFreeCADGui.so(+0x128e248) [0x7f764352b248]
#42  0x7f763ec90ecb in QMetaObject::activate(QObject*, int, int, void**) from /lib64/libQt5Core.so.5+0x69b
#43  0x7f763f7670a3 in QDialogButtonBox::clicked(QAbstractButton*) from /lib64/libQt5Widgets.so.5+0x43
#44  /lib64/libQt5Widgets.so.5(+0x30b869) [0x7f763f767869]
#45  0x7f763ec90ecb in QMetaObject::activate(QObject*, int, int, void**) from /lib64/libQt5Core.so.5+0x69b
#46  0x7f763f6c03f6 in QAbstractButton::clicked(bool) from /lib64/libQt5Widgets.so.5+0x46
#47  /lib64/libQt5Widgets.so.5(+0x26461e) [0x7f763f6c061e]
#48  /lib64/libQt5Widgets.so.5(+0x265a63) [0x7f763f6c1a63]
#49  0x7f763f6c1c25 in QAbstractButton::mouseReleaseEvent(QMouseEvent*) from /lib64/libQt5Widgets.so.5+0xe5
#50  0x7f763f60e34e in QWidget::event(QEvent*) from /lib64/libQt5Widgets.so.5+0x24e
#51  0x7f763f5cbad6 in QApplicationPrivate::notify_helper(QObject*, QEvent*) from /lib64/libQt5Widgets.so.5+0x86
#52  0x7f763f5d53a3 in QApplication::notify(QObject*, QEvent*) from /lib64/libQt5Widgets.so.5+0x583
#53  0x7f76431deae5 in Gui::GUIApplication::notify(QObject*, QEvent*) from ~/freecad-master-build/lib/libFreeCADGui.so+0xff
#54  0x7f763ec66df8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) from /lib64/libQt5Core.so.5+0x88
#55  0x7f763f5d44b7 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) from /lib64/libQt5Widgets.so.5+0x1b7
#56  /lib64/libQt5Widgets.so.5(+0x1ce0dd) [0x7f763f62a0dd]
#57  /lib64/libQt5Widgets.so.5(+0x1d0f6c) [0x7f763f62cf6c]
#58  0x7f763f5cbad6 in QApplicationPrivate::notify_helper(QObject*, QEvent*) from /lib64/libQt5Widgets.so.5+0x86
#59  0x7f763f5d5150 in QApplication::notify(QObject*, QEvent*) from /lib64/libQt5Widgets.so.5+0x330
#60  0x7f76431deae5 in Gui::GUIApplication::notify(QObject*, QEvent*) from ~/freecad-master-build/lib/libFreeCADGui.so+0xff
#61  0x7f763ec66df8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) from /lib64/libQt5Core.so.5+0x88
#62  0x7f763f038c43 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) from /lib64/libQt5Gui.so.5+0x6f3
#63  0x7f763f03a46b in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) from /lib64/libQt5Gui.so.5+0x26b
#64  0x7f763f01656b in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /lib64/libQt5Gui.so.5+0xbb
#65  /lib64/libQt5XcbQpa.so.5(+0x76b5e) [0x7f763429fb5e]
#66  /lib64/libglib-2.0.so.0(g_main_context_dispatch+0x160) [0x7f763bc124a0]
#67  /lib64/libglib-2.0.so.0(+0x51830) [0x7f763bc12830]
#68  /lib64/libglib-2.0.so.0(g_main_context_iteration+0x33) [0x7f763bc128d3]
#69  0x7f763ecbbd85 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /lib64/libQt5Core.so.5+0x65
#70  0x7f763ec65cfb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) from /lib64/libQt5Core.so.5+0x12b
#71  0x7f763ec6da26 in QCoreApplication::exec() from /lib64/libQt5Core.so.5+0x96
#72  0x7f76430d151d in Gui::Application::runApplication() from ~/freecad-master-build/lib/libFreeCADGui.so+0x248d
#73  ./FreeCAD(main+0xb1e) [0x409148]
#74  /lib64/libc.so.6(__libc_start_main+0xf3) [0x7f763e48f1a3]
#75  ./FreeCAD(_start+0x2e) [0x4084be]

OS: Fedora 31 (Thirty One) (LXDE/LXDE)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.19235 (Git)
Build type: Release
Branch: master
Hash: 19c37012dd00c9581d809dc9f94c5f57b0cd93c0
Python version: 3.7.5
Qt version: 5.12.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United Kingdom (en_GB)
Attachments
deburr-bug.FCStd
(76.11 KiB) Downloaded 20 times
chrisb
Veteran
Posts: 54293
Joined: Tue Mar 17, 2015 9:14 am

Re: ugly crash when deburring shapestring pad

Post by chrisb »

Isn't this a similar issue as before, that ellipses don't work well with Path?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
freman
Veteran
Posts: 2214
Joined: Tue Nov 27, 2018 10:30 pm

Re: ugly crash when deburring shapestring pad

Post by freman »

I don't recall using ellipses before but maybe it is a known issue.

How about that totally falling in heap with stringShape.
User avatar
freman
Veteran
Posts: 2214
Joined: Tue Nov 27, 2018 10:30 pm

Re: ugly crash when deburring shapestring pad

Post by freman »

chrisb wrote: Fri Jan 10, 2020 7:05 pm Isn't this a similar issue as before, that ellipses don't work well with Path?
it seems that it's Part.makeOffset2D which is being called and is not able to handle an ellipse:

Code: Select all

<Exception> makeOffset2D: input shape is not an edge, wire or face or compound of those.
44.2272 <App> Document.cpp(3440): Failed to recompute deburr_bug#Offset2D: makeOffset2D: input shape is not an edge, wire or face or compound of those.
Recompute failed! Please check report view.
debur has special code for full circles and straight lines, it looks like it needs similar for ellipses.
User avatar
freman
Veteran
Posts: 2214
Joined: Tue Nov 27, 2018 10:30 pm

Re: ugly crash when deburring shapestring pad

Post by freman »

I tried adapting the code for circles

Code: Select all

        if Part.Circle == type(curve) and wire.isClosed():
            # it's a full circle and there are some problems with that, see
            # http://www.freecadweb.org/wiki/Part%20Offset2D
            # it's easy to construct them manually though
            z = -1 if forward else 1
            edge = Part.makeCircle(curve.Radius + offset, curve.Center, FreeCAD.Vector(0, 0, z))
            if base.isInside(edge.Vertexes[0].Point, offset/2, True):
                if offset > curve.Radius or PathGeom.isRoughly(offset, curve.Radius):
                    # offsetting a hole by its own radius (or more) makes the hole vanish
                    return None
                edge = Part.makeCircle(curve.Radius - offset, curve.Center, FreeCAD.Vector(0, 0, -z))
            w = Part.Wire([edge])
            return w
        if Part.Ellipse == type(curve) and wire.isClosed():
            # it's a full ellipse and there are some problems with that, see
            # it's easy to construct them manually though
            z = -1 if forward else 1
            edge = Part.Ellipse(FreeCAD.Vector(0, 0, z), curve.MajorRadius+offset, curve.MinorRadius+offset)
            if base.isInside(wire.Edges[0].Vertexes[0].Point, offset/2, True):
                if offset > curve.MinorRadius or PathGeom.isRoughly(offset, curve.MinorRadius):
                    # offsetting a hole by its own radius (or more) makes the hole vanish
                    return None
                edge = Part.Ellipse(FreeCAD.Vector(0, 0, -z), curve.MajorRadius+offset, curve.MinorRadius+offset)
            w = Part.Wire([edge])
            return w
        if Part.Line == type(curve) or Part.LineSegment == type(curve):

... but it seems there is something fundamentally lacking in the ellipse object.

Code: Select all

   wire = PathOpTools.offsetWire(w, base.Shape, offset, True)
  File "/svn/freecad-master-build/Mod/Path/PathScripts/PathOpTools.py", line 177, in offsetWire
    w = Part.Wire([edge])
<class 'TypeError'>: item is not a shape
1.68e-06 <App> Document.cpp(3462): Failed to recompute plate9#Deburr: item is not a shape
This seems similar to the " input shape is not an edge, wire or face" from makeOffset2D. Does anyone know what is needed here. What props does a circle have which ellipse is missing.

Oddly profile work on the ellipse, but deburr fails. I can probably trick FC by doing a profile with a 8mm countersink bit and lying to FC that it's a 4mm endmill and rigging z=0 for the tool. More messy workarounds. It really would be better if this can be made to work.

There still remains messy crash on shapeString pocket.

thx
Post Reply