Boolean failure : "must be list of 'DocumentObject', not NoneType"

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!
Tilli
Posts: 93
Joined: Thu Jan 25, 2018 10:38 pm

Boolean failure : "must be list of 'DocumentObject', not NoneType"

Postby Tilli » Wed Mar 14, 2018 3:03 pm

Hi Again

re : "Exception (Wed Mar 14 13:43:34 2018): type must be list of 'DocumentObject', not NoneType"

While reading the wiki PartDesign_Boolean my set of steps (that seems to be extremely simple) has resulted in an unexpected pop-up error-message dialog-box. :shock:

Using PartDesign workbench, I clicked the toolbar icon "Create a new empty document (Ctrl+N)" and the new empty window appeared.

I clicked the toolbar icon "Create a new body and make it active" then the icon "Create an additive box by its width, height and length" and accepted the default settings. It created Body.

I clicked the toolbar icon "Create a new body and make it active" then the icon "Create an additive sphere by its radius and various angles" and accepted all default settings except for the radius which was reduced. It created Body001.

I clicked the toolbar icon "Create a new body and make it active" then the icon "Create an additive cylinder by its radius, height and angle" and accepted all default settings except for the radius which was reduced. It created Body002.

I selected Body002 (the cylinder) in the Combo View model-tree, and then below in the Data tab I changed its placement, position, x to 10 mm.

I selected Body (the box) in the Combo View model-tree and right-clicked to "Toggle active body" then clicked the toolbar icon "Boolean operation with two or more bodies" . . . at which moment the error-message dialog-box appeared.

The message from the Report View window is copied/pasted above, at the beginning of this post.

The entire Python Console output is copied/pasted below. File attached too.

I believe I'm following the Wiki's instructions for doing Booleans. So, another bug, or between keyboard and chair?

Thanks. :)

.
weird-buggy-boolean.fcstd
(13.47 KiB) Downloaded 6 times

Code: Select all

Python 2.7.12 (default, Dec  4 2017, 14:50:18) 
[GCC 5.4.0 20160609] on linux2
Type 'help', 'copyright', 'credits' or 'license' for more information.
>>> App.newDocument("Unnamed")
>>> App.setActiveDocument("Unnamed2")
>>> App.ActiveDocument=App.getDocument("Unnamed2")
>>> Gui.ActiveDocument=Gui.getDocument("Unnamed2")
>>> App.activeDocument().addObject('PartDesign::Body','Body')
>>> Gui.activeView().setActiveObject('pdbody', App.activeDocument().Body)
>>> Gui.Selection.clearSelection()
>>> Gui.Selection.addSelection(App.ActiveDocument.Body)
>>> App.ActiveDocument.recompute()
>>> App.ActiveDocument.addObject('PartDesign::AdditiveBox','Box')
>>> App.ActiveDocument.Body.addObject(App.activeDocument().Box)
>>> App.ActiveDocument.recompute()
>>> Gui.activeDocument().setEdit('Box')
>>> App.ActiveDocument.Box.Length=10.00
>>> App.ActiveDocument.Box.Width=10.00
>>> App.ActiveDocument.Box.Height=10.00
>>> 
>>> App.ActiveDocument.recompute()
>>> App.ActiveDocument.recompute()
>>> Gui.activeDocument().resetEdit()
>>> App.activeDocument().addObject('PartDesign::Body','Body001')
>>> Gui.activeView().setActiveObject('pdbody', App.activeDocument().Body001)
>>> Gui.Selection.clearSelection()
>>> Gui.Selection.addSelection(App.ActiveDocument.Body001)
>>> App.ActiveDocument.recompute()
>>> App.ActiveDocument.addObject('PartDesign::AdditiveSphere','Sphere')
>>> App.ActiveDocument.Body001.addObject(App.activeDocument().Sphere)
>>> App.ActiveDocument.recompute()
>>> Gui.activeDocument().setEdit('Sphere')
>>> App.ActiveDocument.Sphere.Radius=3.00
>>> App.ActiveDocument.Sphere.Angle1=-90.00
>>> App.ActiveDocument.Sphere.Angle2=90.00
>>> App.ActiveDocument.Sphere.Angle3=360.00
>>> 
>>> App.ActiveDocument.recompute()
>>> App.ActiveDocument.recompute()
>>> Gui.activeDocument().resetEdit()
>>> App.activeDocument().addObject('PartDesign::Body','Body002')
>>> Gui.activeView().setActiveObject('pdbody', App.activeDocument().Body002)
>>> Gui.Selection.clearSelection()
>>> Gui.Selection.addSelection(App.ActiveDocument.Body002)
>>> App.ActiveDocument.recompute()
>>> App.ActiveDocument.addObject('PartDesign::AdditiveCylinder','Cylinder')
>>> App.ActiveDocument.Body002.addObject(App.activeDocument().Cylinder)
>>> App.ActiveDocument.recompute()
>>> Gui.activeDocument().setEdit('Cylinder')
>>> App.ActiveDocument.Cylinder.Radius=3.00
>>> App.ActiveDocument.Cylinder.Height=3.00
>>> App.ActiveDocument.Cylinder.Angle=360.00
>>> 
>>> App.ActiveDocument.recompute()
>>> App.ActiveDocument.recompute()
>>> Gui.activeDocument().resetEdit()
>>> FreeCAD.getDocument("Unnamed2").getObject("Body002").Placement = App.Placement(App.Vector(1,0,0),App.Rotation(App.Vector(0,0,1),0))
>>> FreeCAD.getDocument("Unnamed2").getObject("Body002").Placement = App.Placement(App.Vector(10,0,0),App.Rotation(App.Vector(0,0,1),0))
>>> Gui.getDocument('Unnamed2').ActiveView.setActiveObject('pdbody', App.getDocument('Unnamed2').getObject('Body'))
>>> App.activeDocument().Body.newObject('PartDesign::Boolean','Boolean')
>>> App.activeDocument().Boolean.addObjects(None)
>>> Gui.SendMsgToActiveView("Save")
>>> App.getDocument("Unnamed2").saveAs(u"/stuff/weird-buggy-boolean.fcstd")
>>> 

Code: Select all

OS: Linux Mint 18.1 Serena
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.13387 (Git)
Build type: None
Branch: master
Hash: c5f4079252b11e3c54cd603be7d3697fa9f9d922
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: English/UnitedKingdom (en_GB)
User avatar
Willem
Posts: 1252
Joined: Fri Aug 12, 2016 3:27 pm
Location: Lisse, The Netherlands

Re: Boolean failure : "must be list of 'DocumentObject', not NoneType"

Postby Willem » Wed Mar 14, 2018 3:31 pm

I do not understand what you are doing wrong but here is a small video how it should work
phpBB [video]
Tilli
Posts: 93
Joined: Thu Jan 25, 2018 10:38 pm

Unfortunately, Videos are Blocked

Postby Tilli » Wed Mar 14, 2018 7:22 pm

Willem wrote:
Wed Mar 14, 2018 3:31 pm
. . . here is a small video . . .
Thanks for replying, Willem, :D very kind, but unfortunately --- and it's a constant source of annoyance and frustration here, given how many replies and tutorials on this forum rely on the "here's a video..." approach --- internet access is limited here and videos are blocked. :(

At this end, the forum is peppered with unusable blank black rectangles. :roll:
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Boolean failure : "must be list of 'DocumentObject', not NoneType"

Postby NormandC » Thu Mar 15, 2018 12:43 am

Hello Tilli,

The problem is twofold: user error, and software bug.

Tilli wrote:
Wed Mar 14, 2018 3:03 pm
I selected Body (the box) in the Combo View model-tree and right-clicked to "Toggle active body" then clicked the toolbar icon "Boolean operation with two or more bodies" . . . at which moment the error-message dialog-box appeared.
When launching the Boolean operation, the active Body should not be selected. The Boolean operation will attempt to import any selected Body into the active Body; but it can't here, because the active Body is also the one selected.

So either ensure there is nothing selected, or select one Body that is not the active one. See the documentation PartDesign Boolean (not a video ;) ).

As for the error message, I think it's a bug. It is further compounded by the fact that it cancels the command, but it creates an empty Boolean feature set as tip. Which causes the Body to fail, since the tip is empty. Deleting the Boolean feature fixes the problem and resets the tip to the Box feature.

This is worthy of being reported on the bug tracker. Ideally it should be fixed before the 0.17 release.

EDIT: submitted issue #3376.
Tilli
Posts: 93
Joined: Thu Jan 25, 2018 10:38 pm

DE-selecting the Active Body ... Thanks NormandC

Postby Tilli » Thu Mar 15, 2018 2:22 am

NormandC wrote:
Thu Mar 15, 2018 12:43 am
Hello Tilli,

The problem is twofold: user error, and software bug.

Tilli wrote:
Wed Mar 14, 2018 3:03 pm
I selected Body (the box) in the Combo View model-tree and right-clicked to "Toggle active body" then clicked the toolbar icon "Boolean operation with two or more bodies" . . . at which moment the error-message dialog-box appeared.
When launching the Boolean operation, the active Body should not be selected. The Boolean operation will attempt to import any selected Body into the active Body; but it can't here, because the active Body is also the one selected.

So either ensure there is nothing selected, or select one Body that is not the active one. See the documentation PartDesign Boolean (not a video ;) ).

As for the error message, I think it's a bug. It is further compounded by the fact that it cancels the command, but it creates an empty Boolean feature set as tip. Which causes the Body to fail, since the tip is empty. Deleting the Boolean feature fixes the problem and resets the tip to the Box feature.

This is worthy of being reported on the bug tracker. Ideally it should be fixed before the 0.17 release.

Thanks for taking a look and helping, NormandC.

I've done what you've described, de-selecting Body after Activating it, and that does indeed work : the Boolean operation proceeds as expected in keeping with the Wiki page.

Permission to speak freely Sir? ;) . . . well, it does seem like a bit of a cruel gotcha for FreeCAD noobs whose prior experience with 2D/3D graphics Booleans has always been "order of selection matters, so first select the element from which the cut will..." etc. Having instead to here "Activate the Body" but then ensure it's deselected really is outside what I would have considered during trial-and-error based on intuition and previous software.

From what you explained I guess it must be a consequence of the way it's been programmed, possibly even having potential for speedier workflow down the line or ninja tricks for those in the know. At my point on the learning-curve however, it's definitely counter-intuitive.

Glad to see you've already edited the "How To Use" section on the Wiki page. I'm sure it will be helpful to other noobs. Moreso if gurus elaborate on any subtleties and potential power this implementation has, given how important Booleans are in the wider scheme of things.

I won't mark as [Solved] until you think any bugs have been ironed out.

Nevertheless, it's yet another "Thank You NormandC" --- the forum's bursting that phrase :D
User avatar
NormandC
Posts: 18534
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Boolean failure : "must be list of 'DocumentObject', not NoneType"

Postby NormandC » Thu Mar 15, 2018 2:34 am

Tilli wrote:
Thu Mar 15, 2018 2:22 am
Permission to speak freely Sir? ;) . . . well, it does seem like a bit of a cruel gotcha for FreeCAD noobs whose prior experience with 2D/3D graphics Booleans has always been "order of selection matters, so first select the element from which the cut will..." etc. Having instead to here "Activate the Body" but then ensure it's deselected really is outside what I would have considered during trial-and-error based on intuition and previous software.
I understand what you're saying. It does indeed go against the usual FreeCAD work flow too. But the fact is that the PD Boolean operation is very different from the ones in Part workbench, because there is a fundamental difference between the two workbenches: in Part, you work with separate objects and combine them to create a new object; in PartDesign, you always work on a single object to which you add features. Not sure if you noticed it, but last week I updated the PartDesign Workbench documentation page to reflect the upcoming 0.17 release. I wrote a section about the concept of feature, which I think was missing before.

https://www.freecadweb.org/wiki/PartDes ... c_Concepts

In my opinion, the PartDesign workbench is almost like a separate CAD program nested inside FreeCAD. It's the only workbench that works with features.

The Boolean operation in PartDesign is an odd duck. It is the only feature that works with outer Bodies. All other features are always contained inside the active Body.