BRepOffsetAPI_MakePipeShellPy.setAuxiliarySpine problems

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

BRepOffsetAPI_MakePipeShellPy.setAuxiliarySpine problems

Post by looo »

The API for MakePipeShell.setAuxiliarySpine has slightly changed. I used this to create helical gears in this functions

This is the error I get for all 3 possibilities of typeOfCOntact

Code: Select all

Traceback (most recent call last):
  File "/home/lo/.FreeCAD/Mod/FCGear/gearfunc/_Classes.py", line 152, in execute
    wi, fp.height.Value, fp.height.Value * tan(fp.gear.beta) * 2 / fp.gear.d)
  File "/home/lo/.FreeCAD/Mod/FCGear/gearfunc/_Classes.py", line 451, in helicalextrusion
    pipeshell.build()
<class 'Base.FreeCADError'>: Unknown C++ exception
Is there any example/documentation on how to use this for newer occ-versions?
User avatar
Chris_G
Veteran
Posts: 2579
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: BRepOffsetAPI_MakePipeShellPy.setAuxiliarySpine problems

Post by Chris_G »

Hi,
I have been experimenting with PipeShell last week.
I was able to use the auxiliary spine with :

Code: Select all

ps.setAuxiliarySpine( auxSpine, True, long(2))
I was evaluating the possibility to use this tool to make a Sweep on 2 rails.
But I get crashes when I have more than 1 profile.
example code :

Code: Select all

from FreeCAD import Base
import Part
import FreeCADGui

DEBUG = 1

def debug(string):
    if DEBUG:
        FreeCAD.Console.PrintMessage(string)
        FreeCAD.Console.PrintMessage("\n")

doc = App.ActiveDocument

def parseSel(selectionObject):
    res = []
    for obj in selectionObject:
        if obj.HasSubObjects:
            i = 0
            for subobj in obj.SubObjects:
                if issubclass(type(subobj),Part.Edge):
                    res.append((obj.Object,[obj.SubElementNames[i]]))
                    #res.append(obj.SubElementNames[i])
                i += 1
        else:
            res.append((obj.Object,['']))
    return res

selection = FreeCADGui.Selection.getSelection()
RailObj1 = Part.Wire(selection[0].Shape.Edges)
RailObj2 = Part.Wire(selection[1].Shape.Edges)
profiles = selection[2:]

Profiles = []
for prof in profiles:
    Profiles.append(Part.Wire(prof.Shape.Edges))

ps = Part.BRepOffsetAPI.MakePipeShell(RailObj1)
ps.setAuxiliarySpine( RailObj2, True, long(2))
for pro in Profiles:
    debug("Adding profile")
    ps.add( pro, False, False) # Shape, contact, rotate ortho

if ps.isReady():
    ps.build()
    Part.show(ps.shape())

doc.recompute()
With the attached test-file:
- select 2 opposite edges (rails) and 1 profile (crash with 2 profiles)
- run the code
PipeShell.fcstd
(7.75 KiB) Downloaded 54 times

Code: Select all

OS: Ubuntu Zesty Zapus (development branch)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10460 (Git)
Build type: None
Branch: master
Hash: 91c59c7910436c44ede608e29d9a90a287121a11
Python version: 2.7.13
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
crash log :

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
#0  /lib/x86_64-linux-gnu/libc.so.6(+0x35860) [0x7fe284d75860]
#1  0x7fe24b251a30 in BRep_Tool::Surface(TopoDS_Face const&) from /usr/lib/x86_64-linux-gnu/libTKBRep.so.7+0x20
#2  0x7fe24bc537aa in BRepFill_PipeShell::Add(TopoDS_Shape const&, TopoDS_Vertex const&, bool, bool) from /usr/lib/x86_64-linux-gnu/libTKBool.so.7+0x1fa
#3  0x7fe24bc54272 in BRepFill_PipeShell::Add(TopoDS_Shape const&, bool, bool) from /usr/lib/x86_64-linux-gnu/libTKBool.so.7+0x62
#4  0x7fe24e706e61 in Part::BRepOffsetAPI_MakePipeShellPy::add(_object*) from /usr/lib/freecad-daily/lib/Part.so+0xc1
#5  0x7fe24e706ed3 in Part::BRepOffsetAPI_MakePipeShellPy::staticCallback_add(_object*, _object*) from /usr/lib/freecad-daily/lib/Part.so+0x33
#6  /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x8541) [0x7fe2869110a1]
#7  /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x86c) [0x7fe286a7816c]
#8  /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCode+0x19) [0x7fe2869089d9]
#9  /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyRun_FileExFlags+0x8e) [0x7fe2869bff7e]
#10  0x7fe286ebb584 in Base::InterpreterSingleton::runFile(char const*, bool) from /usr/lib/freecad-daily/lib/libFreeCADBase.so+0xa4
#11  0x7fe28793467a in Gui::MacroManager::run(Gui::MacroManager::MacroType, char const*) from /usr/lib/freecad-daily/lib/libFreeCADGui.so+0x1da
#12  0x7fe287a6a56e in Gui::PythonEditorView::executeScript() from /usr/lib/freecad-daily/lib/libFreeCADGui.so+0x6e
#13  0x7fe287a6a720 in Gui::PythonEditorView::onMsg(char const*, char const**) from /usr/lib/freecad-daily/lib/libFreeCADGui.so+0x70
#14  0x7fe2878f40e7 in Gui::Application::sSendActiveView(_object*, _object*, _object*) from /usr/lib/freecad-daily/lib/libFreeCADGui.so+0x67
#15  /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x8541) [0x7fe2869110a1]
#16  /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x86c) [0x7fe286a7816c]
#17  /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyEval_EvalCode+0x19) [0x7fe2869089d9]
#18  /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0(PyRun_StringFlags+0x76) [0x7fe2869c00d6]
#19  0x7fe286ebad56 in Base::InterpreterSingleton::runString[abi:cxx11](char const*) from /usr/lib/freecad-daily/lib/libFreeCADBase.so+0x66
#20  0x7fe287952830 in Gui::Command::doCommand(Gui::Command::DoCmd_Type, char const*, ...) from /usr/lib/freecad-daily/lib/libFreeCADGui.so+0x130
#21  0x7fe28795722c in Gui::Command::invoke(int) from /usr/lib/freecad-daily/lib/libFreeCADGui.so+0x7c
#22  0x7fe285845f70 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) from /usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x4d0
#23  0x7fe285d57dc2 in QAction::triggered(bool) from /usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x42
#24  0x7fe285d59113 in QAction::activate(QAction::ActionEvent) from /usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x83
#25  /usr/lib/x86_64-linux-gnu/libQtGui.so.4(+0x5a0fa3) [0x7fe286139fa3]
#26  0x7fe28613a0f4 in QAbstractButton::mouseReleaseEvent(QMouseEvent*) from /usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x74
#27  0x7fe2862000aa in QToolButton::mouseReleaseEvent(QMouseEvent*) from /usr/lib/x86_64-linux-gnu/libQtGui.so.4+0xa
#28  0x7fe285db4930 in QWidget::event(QEvent*) from /usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x2a0
#29  0x7fe285d5e03c in QApplicationPrivate::notify_helper(QObject*, QEvent*) from /usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x8c
#30  0x7fe285d65136 in QApplication::notify(QObject*, QEvent*) from /usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x476
#31  0x7fe2879320f4 in Gui::GUIApplication::notify(QObject*, QEvent*) from /usr/lib/freecad-daily/lib/libFreeCADGui.so+0x54
#32  0x7fe2858318ad in QCoreApplication::notifyInternal(QObject*, QEvent*) from /usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x8d
#33  0x7fe285d6473d in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) from /usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x14d
#34  /usr/lib/x86_64-linux-gnu/libQtGui.so.4(+0x249452) [0x7fe285de2452]
#35  0x7fe285de1ce3 in QApplication::x11ProcessEvent(_XEvent*) from /usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x16b3
#36  /usr/lib/x86_64-linux-gnu/libQtGui.so.4(+0x272592) [0x7fe285e0b592]
#37  /lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_dispatch+0x2a7) [0x7fe27e4948a7]
#38  /lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x4ab10) [0x7fe27e494b10]
#39  /lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_iteration+0x2c) [0x7fe27e494bbc]
#40  0x7fe28586220e in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x7e
#41  /usr/lib/x86_64-linux-gnu/libQtGui.so.4(+0x272666) [0x7fe285e0b666]
#42  0x7fe28583012f in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x3f
#43  0x7fe285830495 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) from /usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x1b5
#44  0x7fe285836459 in QCoreApplication::exec() from /usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x99
#45  0x7fe2878ead52 in Gui::Application::runApplication() from /usr/lib/freecad-daily/lib/libFreeCADGui.so+0x15e2
#46  freecad-daily(main+0x661) [0x55ad8b2e50e1]
#47  /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf1) [0x7fe284d603f1]
#48  freecad-daily(_start+0x2a) [0x55ad8b2e633a]
ickby
Veteran
Posts: 3116
Joined: Wed Oct 05, 2011 7:36 am

Re: BRepOffsetAPI_MakePipeShellPy.setAuxiliarySpine problems

Post by ickby »

I reportet a bug regarding this functionality quite some time ago, maybe it is the same problem that you hit:
https://tracker.dev.opencascade.org/view.php?id=26295

That functionality is currently exposed in PartDesign pipe tool, you can experiment there to see if your shapes work.
User avatar
Chris_G
Veteran
Posts: 2579
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: BRepOffsetAPI_MakePipeShellPy.setAuxiliarySpine problems

Post by Chris_G »

I reportet a bug regarding this functionality quite some time ago, maybe it is the same problem that you hit:
https://tracker.dev.opencascade.org/view.php?id=26295
Hi ickby,
Mmm ... almost 2 years old, and no fix. That's sad.
Thanks
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: BRepOffsetAPI_MakePipeShellPy.setAuxiliarySpine problems

Post by Kunda1 »

Chris_G wrote:
I reportet a bug regarding this functionality quite some time ago, maybe it is the same problem that you hit:
https://tracker.dev.opencascade.org/view.php?id=26295
Hi ickby,
Mmm ... almost 2 years old, and no fix. That's sad.
Thanks
shoogen was active on their bugtracker and I'm under the impression that is why he got many prvevious OCC bugs implemented in to OCC7.0
We need folks to bump those issues so they get one someones radar
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: BRepOffsetAPI_MakePipeShellPy.setAuxiliarySpine problems

Post by Kunda1 »

Created and linking issue #2961 to track upstream process.
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: BRepOffsetAPI_MakePipeShellPy.setAuxiliarySpine problems

Post by looo »

thanks for the information.
I will try to use the suggestion provided by Chris_G.

Btw.: The function I used for the helical extrusion is copied from the scad-wb. So maybe there this feature is also broken...
keithsloan52
Veteran
Posts: 2756
Joined: Mon Feb 27, 2012 5:31 pm

Re: BRepOffsetAPI_MakePipeShellPy.setAuxiliarySpine problems

Post by keithsloan52 »

I too am having problems with Re: BRepOffsetAPI_MakePipeShellPy.setAuxiliarySpine problems

The code that used to work prior to change in OCC7 was
pipeshell.setAuxiliarySpine(auxspine,True,False)

But this gives
pipeshell.setAuxiliarySpine(auxspine,True,False)
<type 'exceptions.TypeError'>: must be long, not bool

So where do I find the documentation on pipeshell.setAuxiliarySpine ?
i.e. what should my code look like now
User avatar
Chris_G
Veteran
Posts: 2579
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: BRepOffsetAPI_MakePipeShellPy.setAuxiliarySpine problems

Post by Chris_G »

keithsloan52 wrote:But this gives
pipeshell.setAuxiliarySpine(auxspine,True,False)
<type 'exceptions.TypeError'>: must be long, not bool
Hi,
This function has changed.
The 3rd argument should now be a long :
- long(0) : No contact
- long(1) : Contact
- long(2) : Contact on border
https://github.com/FreeCAD/FreeCAD/blob ... p.cpp#L128
https://github.com/FreeCAD/FreeCAD/blob ... Py.xml#L55
https://www.opencascade.com/doc/occt-6. ... c43a8b7c96
But, as written above, this tool seems buggy ( probably OCC bug ).
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: BRepOffsetAPI_MakePipeShellPy.setAuxiliarySpine problems

Post by looo »

Also the "makePipeShell" command doesn't work for me.

Code: Select all

  File "/home/lo/.FreeCAD/Mod/FCGear/gearfunc/_Classes.py", line 446, in helicalextrusion
    shell = wire.makePipeShell(auxspine)
<type 'exceptions.TypeError'>: PyCXX: Error creating object of type N2Py7SeqBaseINS_6ObjectEEE from <Wire object at 0x5619d2559430>
Post Reply