Paths inside PathCompound fail to compute.

Here's the place for discussion related to CAM/CNC and the development of the Path module.
roivai
Posts: 5
Joined: Thu Feb 02, 2017 5:29 pm
Location: Oulu, Finland

Paths inside PathCompound fail to compute.

Postby roivai » Sat Feb 04, 2017 8:27 pm

Hi,

I was trying to compound a few paths but received error:

Code: Select all

File "/home/pekka/builds/FreeCAD/freecad-build/Mod/Path/PathScripts/PathHelix.py", line 409, in execute
    job["zsafe"], tool.Diameter,
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'Diameter'


I was able to reproduce that with a simple Profile around a simple box. First, the path is generated just fine, but when I select the Path object and click the Compound icon, error is given.

After browsing inside the PathScripts source for a while, I was able to point out the problem in the findParentJob function inside PathUtils. It seems that it cannot iterate itself out of the Compound object and this again makes the Path unable to determine which tool is loaded by the Tool Controller.

I made a quick fix for it. It is available in my fork. At my very limited testing, it works.
https://github.com/pekkaroi/FreeCAD/commit/1156306f6d80dedf6bf78d7789b1c49eb2a71fd7

I have no idea if that is the correct way to deal with that, so I did not want to create any pull requests, but rather ask here. So, is that a bug or am I doing something wrong when creating the compound. And if it really is a bug, is that any good way to fix it?
mlampert
Posts: 279
Joined: Fri Sep 16, 2016 9:28 pm

Re: Paths inside PathCompound fail to compute.

Postby mlampert » Sat Feb 04, 2017 9:37 pm

Looks good to me - can you create a pull request?
roivai
Posts: 5
Joined: Thu Feb 02, 2017 5:29 pm
Location: Oulu, Finland

Re: Paths inside PathCompound fail to compute.

Postby roivai » Sat Feb 04, 2017 10:31 pm

I just did. Let's hope I did it right, first time using github for that. :)