Crash in 0.17 while padding sketch

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
cox
Posts: 971
Joined: Wed Nov 26, 2014 11:37 pm

Crash in 0.17 while padding sketch

Post by cox »

Can someone please verify this behaviour. I am sorry my version is not completely up to date but I am not able to rebuild at the moment.

Every time i try to pad this sketch I am having FreeCAD crash on me.

The origin of this sketsh is from the wire witch is taken from an imported iges file from https://github.com/seemecnc/Rostock-MAX ... 0Plate.IGS and Draft:Draft<->Sketch

I get the following complaint when trying to pad, clicking ok leads to segmentation fault.
Spectacle.AK7923.png
Spectacle.AK7923.png (22.15 KiB) Viewed 3207 times

Code: Select all

(gdb) run
Starting program: /usr/bin/freecad 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
FreeCAD 0.17, Libs: 0.17R9592 (Git)
© Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2016
  #####                 ####  ###   ####  
  #                    #      # #   #   # 
  #     ##  #### ####  #     #   #  #   # 
  ####  # # #  # #  #  #     #####  #   # 
  #     #   #### ####  #    #     # #   # 
  #     #   #    #     #    #     # #   #  ##  ##  ##
  #     #   #### ####   ### #     # ####   ##  ##  ##

[New Thread 0x7fffd622d700 (LWP 32451)]
[New Thread 0x7fff95720700 (LWP 32452)]
[New Thread 0x7fff94865700 (LWP 32453)]
[New Thread 0x7fff8ec33700 (LWP 32454)]
[New Thread 0x7fff8e432700 (LWP 32455)]
[New Thread 0x7fff8db8a700 (LWP 32456)]
Can't find Origin for "Body"
Can't find Origin for "Body"
Can't find Origin for "Body"
Can't find Origin for "Body"
[New Thread 0x7fff73fc4700 (LWP 32457)]
[New Thread 0x7fff737c3700 (LWP 32458)]
[Thread 0x7fff73fc4700 (LWP 32457) exited]
[New Thread 0x7fff72fc2700 (LWP 32459)]
[Thread 0x7fff737c3700 (LWP 32458) exited]
[New Thread 0x7fff727c1700 (LWP 32460)]
[Thread 0x7fff72fc2700 (LWP 32459) exited]
[New Thread 0x7fff71fc0700 (LWP 32461)]
[Thread 0x7fff727c1700 (LWP 32460) exited]
[New Thread 0x7fff717bf700 (LWP 32462)]
[Thread 0x7fff71fc0700 (LWP 32461) exited]
[New Thread 0x7fff70fbe700 (LWP 32463)]
[Thread 0x7fff717bf700 (LWP 32462) exited]
[New Thread 0x7fff707bd700 (LWP 32464)]
[Thread 0x7fff70fbe700 (LWP 32463) exited]
[Thread 0x7fff707bd700 (LWP 32464) exited]
[New Thread 0x7fff707bd700 (LWP 32465)]
[New Thread 0x7fff70fbe700 (LWP 32466)]
[Thread 0x7fff707bd700 (LWP 32465) exited]
[New Thread 0x7fff717bf700 (LWP 32467)]
[Thread 0x7fff70fbe700 (LWP 32466) exited]
[New Thread 0x7fff71fc0700 (LWP 32468)]
[Thread 0x7fff717bf700 (LWP 32467) exited]
[New Thread 0x7fff73fc4700 (LWP 32469)]
[Thread 0x7fff71fc0700 (LWP 32468) exited]
[New Thread 0x7fff737c3700 (LWP 32470)]
[Thread 0x7fff73fc4700 (LWP 32469) exited]
[New Thread 0x7fff72fc2700 (LWP 32471)]
[Thread 0x7fff737c3700 (LWP 32470) exited]
[New Thread 0x7fff727c1700 (LWP 32472)]
[Thread 0x7fff72fc2700 (LWP 32471) exited]
[Thread 0x7fff727c1700 (LWP 32472) exited]
[Thread 0x7fff8e432700 (LWP 32455) exited]
[Thread 0x7fff8db8a700 (LWP 32456) exited]
[New Thread 0x7fff8db8a700 (LWP 32473)]
[New Thread 0x7fff8e432700 (LWP 32474)]
[New Thread 0x7fff727c1700 (LWP 32475)]
[Thread 0x7fff8e432700 (LWP 32474) exited]
[Thread 0x7fff8db8a700 (LWP 32473) exited]
[New Thread 0x7fff72fc2700 (LWP 32476)]
[New Thread 0x7fff73fc4700 (LWP 32477)]
[Thread 0x7fff72fc2700 (LWP 32476) exited]
[New Thread 0x7fff737c3700 (LWP 32478)]
[Thread 0x7fff73fc4700 (LWP 32477) exited]
[New Thread 0x7fff6f10f700 (LWP 32479)]
[Thread 0x7fff737c3700 (LWP 32478) exited]
[Thread 0x7fff727c1700 (LWP 32475) exited]
[New Thread 0x7fff6e90e700 (LWP 32480)]
[Thread 0x7fff6f10f700 (LWP 32479) exited]
[Thread 0x7fff6e90e700 (LWP 32480) exited]

Thread 1 "freecad" received signal SIGSEGV, Segmentation fault.
0x00007fff7425f80e in prepareProfileBased(Gui::Command*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, boost::function<void (Part::Feature*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)>) () from /opt/freecad/lib/PartDesignGui.so
(gdb) bt
#0  0x00007fff7425f80e in prepareProfileBased(Gui::Command*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, boost::function<void (Part::Feature*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)>) () at /opt/freecad/lib/PartDesignGui.so
#1  0x00007fff7425fb89 in CmdPartDesignPad::activated(int) () at /opt/freecad/lib/PartDesignGui.so
#2  0x00007ffff7400b7c in Gui::Command::invoke(int) () at /opt/freecad/lib/libFreeCADGui.so
#3  0x00007ffff5410c50 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) ()
    at /usr/lib/libQtCore.so.4
#4  0x00007ffff5964082 in QAction::triggered(bool) () at /usr/lib/libQtGui.so.4
#5  0x00007ffff59653e3 in QAction::activate(QAction::ActionEvent) () at /usr/lib/libQtGui.so.4
#6  0x00007ffff5d402f3 in  () at /usr/lib/libQtGui.so.4
#7  0x00007ffff5d40444 in QAbstractButton::mouseReleaseEvent(QMouseEvent*) () at /usr/lib/libQtGui.so.4
#8  0x00007ffff5e05a7a in QToolButton::mouseReleaseEvent(QMouseEvent*) () at /usr/lib/libQtGui.so.4
#9  0x00007ffff59c0840 in QWidget::event(QEvent*) () at /usr/lib/libQtGui.so.4
#10 0x00007ffff5969f2c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/libQtGui.so.4
#11 0x00007ffff59725b7 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/libQtGui.so.4
#12 0x00007ffff73d6a80 in Gui::GUIApplication::notify(QObject*, QEvent*) () at /opt/freecad/lib/libFreeCADGui.so
#13 0x00007ffff53fcb2d in QCoreApplication::notifyInternal(QObject*, QEvent*) () at /usr/lib/libQtCore.so.4
#14 0x00007ffff59705db in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () at /usr/lib/libQtGui.so.4
#15 0x00007ffff59eba89 in  () at /usr/lib/libQtGui.so.4
#16 0x00007ffff59ea43c in QApplication::x11ProcessEvent(_XEvent*) () at /usr/lib/libQtGui.so.4
#17 0x00007ffff5a12db2 in  () at /usr/lib/libQtGui.so.4
#18 0x00007fffed92a587 in g_main_context_dispatch () at /usr/lib/libglib-2.0.so.0
#19 0x00007fffed92a7f0 in  () at /usr/lib/libglib-2.0.so.0
#20 0x00007fffed92a89c in g_main_context_iteration () at /usr/lib/libglib-2.0.so.0
#21 0x00007ffff542cece in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
---Type <return> to continue, or q <return> to quit---
OS: "Arch Linux"
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.9592 (Git)
Build type: Release
Branch: master
Hash: c2f2a250549163947592069262ce1cd3328b3669
Python version: 2.7.13
Qt version: 4.8.7
Coin version: 3.1.3
OCC version: 6.9.1
Attachments
seemecnc.fcstd
(7.6 KiB) Downloaded 49 times
Last edited by r-frank on Sat Jan 14, 2017 11:31 am, edited 1 time in total.
Reason: Typos ...
Need help? Feel free to ask, but please read the guidelines first
User avatar
Willem
Veteran
Posts: 1854
Joined: Fri Aug 12, 2016 3:27 pm
Location: Lisse, The Netherlands

Re: Crash in 0.17 while padding sketch

Post by Willem »

Hi,
In Freecad 0.17 you have to create:
- a Part, in this part you create
- a Body, in the body you create
- a sketch

In your file the part is missing. When you add the part the sketch will Pad
cox
Posts: 971
Joined: Wed Nov 26, 2014 11:37 pm

Re: Crash in 0.17 while padding sketch

Post by cox »

Willem wrote:Hi,
In Freecad 0.17 you have to create:
- a Part, in this part you create
- a Body, in the body you create
- a sketch

Thanks Willem, :D

I was not aware of this Part requirement, used to be able to make a Body without it earlier. :shock:

I do encounter some issues trying to fix this:
Make a new Part and move(drag) the existing Body into it. Nothing happens, the small icon gets a green + indicating the move should be possible.

Make a new Part with new Body inside, and moving sketch into the new Body ->Crash

This works:
Make a new Part, select sketch from old Body and create a new Body with new Part active.
Need help? Feel free to ask, but please read the guidelines first
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Crash in 0.17 while padding sketch

Post by NormandC »

cox wrote:I was not aware of this Part requirement, used to be able to make a Body without it earlier. :shock:
I wasn't aware of it either. In fact, nowhere have I read that it was mandatory: if you don't plan on leaving the PartDesign workbench, and if you plan on having a single body, having a mandatory Part on top it adds an unnecessary level of complexity.

I'm hoping ickby will shed light on this subject.
cox wrote:I get the following complaint when trying to pad, clicking ok leads to segmentation fault.
To improve future searches, here's the text of the error with which I'm familiar as well for having it before:
Dialog wrote: You selected geometries which are not part of the active body. Please define how to handle those selections. If you do not want those references cancel the command.
  • Make independent copy (recommended)
  • Make dependent copy
  • Create cross-reference
OK | Cancel
I'm puzzled, because it implies that the Sketch is not part of the Body, when it's actually nested under it.

Could you tell us how you created it? Did you make sure that Body was active when you created the sketch? Or did you create the sketch while in the Sketcher rather than the PartDesign workbench?

In any case, I was not ready to blindly accept the Part container rule. ;)

The first thing I tried to eliminate this error was by remapping the Sketch to Body's XZ_Plane: I selected the XZ_Plane, then I click on the Image Sketcher MapSketch tool and selected Sketch. Next a Sketch Attachment dialog appeared:
Sketch Attachment

Current attachment mode is incompatible with the new selection. Select the method to attach this sketch to selected objects.

Don't attach
Deactivated (incompatible with selection)
ObjectXY
ObjectXZ
ObjectYZ
FlatFace (suggested)
Intertial CS
Deactivated (incompatible with selection)
Notice "Deactivated" is listed twice. No matter what selection I make, nothing happens (it should bring up the Sketch edit mode), and a recompute symbol appears over the Sketch label in the Model tree. Recomputing changes the sketch plane, but trying to map the Sketch again produces the same original error dialog.

Next I tried right-clicking on the Sketch, and selecting "Move object to other body" in the contextual menu. In the small dialog, of course there is a single available choice, "Body", so I clicked OK.

And guess what: this fixes the issue. :D

Yep, after that, selecting the Sketch and padding it works as expected, without throwing an error, nor requiring to add a Part container on top of the Body.
:ugeek:

But the fact that FreeCAD crashes is definitely a bug.
Attachments
seemecnc_normandc1.fcstd
(15.92 KiB) Downloaded 40 times
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Crash in 0.17 while padding sketch

Post by NormandC »

I just thought of having a look at the Dependency graph on your file. And you can see that the Sketch is not attached to anything, even though it's under the Body:
Dependency graph for the original seemecnc.fcstd file.
Dependency graph for the original seemecnc.fcstd file.
FC_cox_seemecnc_01.png (18.31 KiB) Viewed 3171 times
So I'm guessing that you either made it before making a body, or made it from the Sketcher workbench rather than the PartDesign workbench?

I'm pretty sure that to avoid the "Make independent copy" dialog, your sketch needs to be attached to either of the BodyOrigin Datum elements.

Compare with my file's dependency graph:
Dependency graph for the seemecnc_normandc1.fcstd file.
Dependency graph for the seemecnc_normandc1.fcstd file.
FC_cox_seemecnc_02.png (30.78 KiB) Viewed 3171 times
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: Crash in 0.17 while padding sketch

Post by DeepSOIC »

Having a Part shouldn't be a requirement.

Here's a problem. Sketch was added to body as Base Feature, not as a contained object. Base feature is supposed to be a single solid, that all further Pads/Pockets/etc are fused to / cut off. Sketch is obviously not a single solid. And a base feature is not supposed to be used as a profile, so maybe PartDesign attempts to pad a sketch as it would pad a face.

PartDesign probably needs to check for shape type before using something as base feature.
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Crash in 0.17 while padding sketch

Post by NormandC »

The plot thickens :D

How could the Sketch be recognized as a Base feature? And how did you come to this conclusion, if you don't mind my asking?
cox
Posts: 971
Joined: Wed Nov 26, 2014 11:37 pm

Re: Crash in 0.17 while padding sketch

Post by cox »

NormandC wrote:
Could you tell us how you created it? Did you make sure that Body was active when you created the sketch? Or did you create the sketch while in the Sketcher rather than the PartDesign workbench?
Well, here goes, but It will not be accurate but in general terms this is how I went about it:

1 Imported igs file from first post
2 Used Draft downgrade until i could delete all items that was not relevant for getting the Wire
3 Combined the Edges to Wire with Draft upgrade
4 Copied the wire to a new document
5 Draft:Draft<->Sketch
6 Edited the sketch by constraining it and replacing circles with arcs.
7 Tried to pad the sketch, but was reminded that I needed a Body by popup.
8 By having Sketch selected added a body, when doing this the sketch is consumed by the new body.
9 This is where the pad resulted in a crash.
Need help? Feel free to ask, but please read the guidelines first
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Crash in 0.17 while padding sketch

Post by NormandC »

cox wrote:8 By having Sketch selected added a body, when doing this the sketch is consumed by the new body.
So that's how the Sketch was recognized as a base feature.

AFAIK selecting an object then creating a body is the method to convert an existing shape/solid to a PartDesign workflow.

Thus the bug here is as DeepSOIC said:
DeepSOIC wrote:PartDesign probably needs to check for shape type before using something as base feature.
I think there could be two choices:
  1. Upon detection of a sketch, it rejects the selection and throws an error
  2. Upon detection of a sketch, it opens the Sketch attachment dialog
My preference would go to #2, do you think it's manageable DeepSOIC?
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Crash in 0.17 while padding sketch

Post by NormandC »

I created issue #2862, but I feel like there are 2, maybe 3 different bugs in there...
  1. PartDesign does not check shape type for base feature (this one may need further testing with all types of shapes)
  2. A sketch added to a new Body should bring the attachment dialog
  3. Padding a sketch wrongly recognized as base feature crashes FreeCAD on 2 out of 3 choices
What do you guys think? I can edit my bug report if necessary.
Post Reply