What happened to Part.BOPTools?

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
nmt
Posts: 29
Joined: Sun Feb 19, 2017 2:45 pm

What happened to Part.BOPTools?

Post by nmt »

Hello,
I must be going crazy. I just updated FreeCAD and I no longer have Part.BOPTools etc.. Am I missing something?? Has this been deprecated? And if so, what is the new way of doing things? This is the code I am trying to run:

Code: Select all

import Part

doc = FreeCAD.newDocument('Embed')
Gui.ActiveDocument.ActiveView.viewAxonometric()

b1 = Part.makeBox(10,10,60,App.Vector(0,0,0),App.Vector(0,0,1))
b2 = Part.makeBox(10,10,60,App.Vector(6,6,6),App.Vector(0,0,1))
r = Part.BOPTools.SplitAPI.booleanFragments([b1,b2],"Standard", 0.0)
Part.show(r)
Gui.SendMsgToActiveView("ViewFit")
I am getting:

Code: Select all

>>> r = Part.BOPTools.SplitAPI.booleanFragments([b1,b2],"Standard", 0.0)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
AttributeError: 'module' object has no attribute 'BOPTools'

Code: Select all

OS: Mac OS X
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.10641 (Git)
Build type: Release
Branch: (detached from 3074c2e)
Hash: 3074c2e756b14c2f06ada11da14b1123e9ecd0f8
Python version: 2.7.13
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.1.0
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: What happened to Part.BOPTools?

Post by looo »

import has changed. The previously method to import the BOPTools would not have worked with python3.
So now it's directly available (this was already possible all the time.)

Code: Select all

import BOPTools
User avatar
Chris_G
Veteran
Posts: 2580
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: What happened to Part.BOPTools?

Post by Chris_G »

Hi,
Maybe there has been some changes in BOPTools recently ? ( I just started using BOPTools a couple a days ago, so I'm not aware of BOPTools history )
It looks like it is not part of the Part WB anymore.
So you need to import it, and call it directly ( not through Part. )

This should work :

Code: Select all

import Part
import BOPTools

doc = FreeCAD.newDocument('Embed')
Gui.ActiveDocument.ActiveView.viewAxonometric()

b1 = Part.makeBox(10,10,60,App.Vector(0,0,0),App.Vector(0,0,1))
b2 = Part.makeBox(10,10,60,App.Vector(6,6,6),App.Vector(0,0,1))
r = BOPTools.SplitAPI.booleanFragments([b1,b2],"Standard", 0.0)
Part.show(r)
Gui.SendMsgToActiveView("ViewFit")
EDIT : looo has been faster. One point for you, looo :lol:
User avatar
nmt
Posts: 29
Joined: Sun Feb 19, 2017 2:45 pm

Re: What happened to Part.BOPTools?

Post by nmt »

Worked. Many thanks to both!
TheCook
Posts: 10
Joined: Wed Mar 07, 2018 4:17 am

Re: What happened to Part.BOPTools?

Post by TheCook »

I have a similar issue.

I have tried to install the curves workbench using the addons_installer.FCMacro and it seems to go OK but when I attempt to change to the curves workbench I get a Workbench Failure message that says: No module named BOPTools.SplitAPI.

When I go to the python console it says:
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.
>>> import WebGui
>>> from StartPage import StartPage
>>> WebGui.openBrowserHTML(StartPage.handle(),'file://' + App.getResourceDir() + 'Mod/Start/StartPage/','Start page')
>>> Gui.activateWorkbench("CurvesWorkbench")
>>>
I tried to import BOPTools and the response was
import BOPTools
Traceback (most recent call last):
File "<input>", line 1, in <module>
ImportError: No module named BOPTools
>>>
I am running :
OS: Linux Mint 18 Sarah
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6712 (Git)
Build type: None
Branch: releases/FreeCAD-0-16
Hash: da2d364457257a7a8c6fb2137cea12c45becd71a
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Does anyone know what I am missing?
User avatar
Chris_G
Veteran
Posts: 2580
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: What happened to Part.BOPTools?

Post by Chris_G »

TheCook wrote: Wed Mar 07, 2018 4:31 am I have tried to install the curves workbench
Hi,
The Curves WB is not compatible with FC 0.16.
And it is an experimental WB, so you should not do any serious work with it.
TheCook
Posts: 10
Joined: Wed Mar 07, 2018 4:17 am

Re: What happened to Part.BOPTools?

Post by TheCook »

Got it... Don't do serious work with FreeCAD.

Is there a way to have fun with FreeCAD?

I 'upgraded' to 0.16 because I had the same fault with an older version (the Ubuntu standard install version).

Any hints on what version of FreeCAD works with curves?
TheCook
Posts: 10
Joined: Wed Mar 07, 2018 4:17 am

Re: What happened to Part.BOPTools?

Post by TheCook »

Removed version 0.16 and installed 0.15. I still get "No module named BOPTools.SplitAPI".

Now running
OS: Linux Mint 18 Sarah
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4671 (Git)
Branch: releases/FreeCAD-0-15
Hash: 244b3aef360841646cbfe80a1b225c8b39c8380c
Python version: 2.7.11
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Not much 'Fun' any more. Please Help.
chrisb
Veteran
Posts: 53945
Joined: Tue Mar 17, 2015 9:14 am

Re: What happened to Part.BOPTools?

Post by chrisb »

TheCook wrote: Mon Mar 12, 2018 1:04 am Removed version 0.16 and installed 0.15. I still get "No module named BOPTools.SplitAPI".

Now running
OS: Linux Mint 18 Sarah
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4671 (Git)
Branch: releases/FreeCAD-0-15
Hash: 244b3aef360841646cbfe80a1b225c8b39c8380c
Python version: 2.7.11
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Not much 'Fun' any more. Please Help.
Not compatible means that 0.16 is too old, not too young. The new version 0.17 is soon to be released. I am not sure with your OS but you probably can use the Appimage: https://github.com/FreeCAD/FreeCAD/rele ... g/0.17_pre
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: What happened to Part.BOPTools?

Post by GeneFC »

TheCook wrote: Mon Mar 12, 2018 12:50 am Got it... Don't do serious work with FreeCAD.
Your snarky comment was directed at the author of the Curves Workbench. He is overly modest, but his understanding of FreeCAD and his programming ability are both first rate.

You might want to look at the thread describing the evolution of the Curves Workbench and reconsider your criticism.

https://forum.freecadweb.org/viewtopic.php?f=8&t=22675

Gene
Post Reply