Need for a tooling precheck.

Here's the place for discussion related to CAM/CNC and the development of the Path module.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
jonasthomas
Posts: 162
Joined: Wed Feb 01, 2012 3:29 am

Need for a tooling precheck.

Post by jonasthomas »

It's been a while.....
I was trying to submit a bug report but my I forgot my password.
When I reset my password for the forum it seems that the bug tracker didn't recognize this.
Anyway... I got this error message (see bottom of post)

I think the issue is here:
toolLoad = PathUtils.getLastToolLoad(obj)
if toolLoad is None or toolLoad.ToolNumber == 0:
self.vertFeed = 100
self.horizFeed = 100
self.radius = 0.25
obj.ToolNumber = 0
obj.ToolDescription = "UNDEFINED"
else:
self.vertFeed = toolLoad.VertFeed.Value
self.horizFeed = toolLoad.HorizFeed.Value
tool = PathUtils.getTool(obj, toolLoad.ToolNumber)
self.radius = tool.Diameter/2
obj.ToolNumber = toolLoad.ToolNumber
obj.ToolDescription = toolLoad.Name

Some how it looks like I had a tool defined with zero diameter...
I'm pretty sure I had a diameter defined (so the real issue is further upstream.)
It seems to me that if there is an issue with the tool definition:, PathSurface.py execute or any other method

Shouldn't there be a method in the tool object that it checks itself.. So basically,
Do I have a diameter specified?
Do I have a surface feed?
Do I have a spindle RPM?

So.... pseudo code refactor
toolLoad = PathUtils.getLastToolLoad(obj)
if toolLoad is None
print "You need to define a tool before proceeding"

else:
toolIssues = toolLoad.getToolingDefinitonIssues()


self.vertFeed = toolLoad.VertFeed.Value
self.horizFeed = toolLoad.HorizFeed.Value
tool = PathUtils.getTool(obj, toolLoad.ToolNumber)
self.radius = tool.Diameter/2
obj.ToolNumber = toolLoad.ToolNumber
obj.ToolDescription = toolLoad.Name


Side note stupid question....
I did an out of source build.. The python executable got copied
from:
/home/jonasthomas/FreeCADPath/FreeCAD/src/Mod/Path/PathScripts/PathSurface.py
To:
/home/jonasthomas/FreeCADPath/build-FreeCAD-Desktop-Default/Mod/Path/PathScripts/PathSurface.py

Along the way I noticed that PathSurface.pyc gets generated. (I don't fully understand what this does)

Soo... if I make changes to the PathSurface.py , do I need to recompile to get the pyc file updated?
(That would imply that I need to update..
/home/jonasthomas/FreeCADPath/FreeCAD/src/Mod/Path/PathScripts/PathSurface.py

Can I make an edit to /home/jonasthomas/FreeCADPath/build-FreeCAD-Desktop-Default/Mod/Path/PathScripts/PathSurface.py that works without rebuilding the project?

I suppose I should just test this. The reason I ask this question, is that I launch freecad from the eric4 ide.
I'm wondering that If I
replaced:
/home/jonasthomas/FreeCADPath/build-FreeCAD-Desktop-Default/Mod/Path/PathScripts/PathSurface.py
with a symlink to:
/home/jonasthomas/FreeCADPath/FreeCAD/src/Mod/Path/PathScripts/PathSurface.py
That if any changes in the eric4 ide could be updated through git?

Sorry... this is what happens when I have a good nights sleep but decide to drink coffee too late in the day.
:twisted:



jonasthomas@JTLapTop:~/FreeCADPath/build-FreeCAD-Desktop-Default/bin$ ./FreeCAD
FreeCAD 0.17, Libs: 0.17R7702 (Git)

© Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2015
##### #### ### ####
# # # # # #
# ## #### #### # # # # #
#### # # # # # # # ##### # #
# # #### #### # # # # #
# # # # # # # # # ## ## ##
# # #### #### ### # # #### ## ## ##

Attacher: linked object spock is unexpected, assuming it has no shape.
Attacher: linked object spock is unexpected, assuming it has no shape.
Attacher: linked object spock is unexpected, assuming it has no shape.
Cannot find icon: Path-Remote
Path workbench activated
Path workbench deactivated
Path workbench activated
Pocketing Select Mode
Free Select
Hold on. This might take a minute.
Surface calculations can be slow. Don't Panic.
Surfacing Select Mode
Hold on. This might take a minute.
Hold on. This might take a minute.
Hold on. This might take a minute.
Traceback (most recent call last):
File "/home/jonasthomas/FreeCADPath/build-FreeCAD-Desktop-Default/Mod/Path/PathScripts/PathSurface.py", line 411, in accept
self.getFields()
File "/home/jonasthomas/FreeCADPath/build-FreeCAD-Desktop-Default/Mod/Path/PathScripts/PathSurface.py", line 442, in getFields
self.obj.Proxy.execute(self.obj)
File "/home/jonasthomas/FreeCADPath/build-FreeCAD-Desktop-Default/Mod/Path/PathScripts/PathSurface.py", line 313, in execute
output = self._dropcutter(obj, s, bb)
File "/home/jonasthomas/FreeCADPath/build-FreeCAD-Desktop-Default/Mod/Path/PathScripts/PathSurface.py", line 215, in _dropcutter
Ny = int(bb.YLength / cutter.getDiameter())
<type 'exceptions.ZeroDivisionError'>: float division by zero
Surface calculations can be slow. Don't Panic.
Surfacing Select Mode
Cannot work with this object
Hold on. This might take a minute.
Traceback (most recent call last):
File "/home/jonasthomas/FreeCADPath/build-FreeCAD-Desktop-Default/Mod/Path/PathScripts/PathSurface.py", line 411, in accept
self.getFields()
File "/home/jonasthomas/FreeCADPath/build-FreeCAD-Desktop-Default/Mod/Path/PathScripts/PathSurface.py", line 442, in getFields
self.obj.Proxy.execute(self.obj)
File "/home/jonasthomas/FreeCADPath/build-FreeCAD-Desktop-Default/Mod/Path/PathScripts/PathSurface.py", line 313, in execute
output = self._dropcutter(obj, s, bb)
File "/home/jonasthomas/FreeCADPath/build-FreeCAD-Desktop-Default/Mod/Path/PathScripts/PathSurface.py", line 215, in _dropcutter
Ny = int(bb.YLength / cutter.getDiameter())
<type 'exceptions.ZeroDivisionError'>: float division by zero
Surface calculations can be slow. Don't Panic.
Surfacing Select Mode
Cannot work with this object
Path workbench deactivated
Hold on. This might take a minute.
Traceback (most recent call last):
File "/home/jonasthomas/FreeCADPath/build-FreeCAD-Desktop-Default/Mod/Path/PathScripts/PathSurface.py", line 313, in execute
output = self._dropcutter(obj, s, bb)
File "/home/jonasthomas/FreeCADPath/build-FreeCAD-Desktop-Default/Mod/Path/PathScripts/PathSurface.py", line 215, in _dropcutter
Ny = int(bb.YLength / cutter.getDiameter())
<type 'exceptions.ZeroDivisionError'>: float division by zero
Path workbench activated
Path workbench deactivated
Killed
jonasthomas@JTLapTop:~/FreeCADPath/build-FreeCAD-Desktop-Default/bin$
jonasthomas
Posts: 162
Joined: Wed Feb 01, 2012 3:29 am

Re: Need for a tooling precheck.

Post by jonasthomas »

To answer part of my own question... the pyc is byte code which saves time so python doesn't need to recompile.

From some quick tests I did.. It appears py files in the out of source build are copied instead of being symlink to the source file.

What would be the downsides to symlinking the out of source build py files to the actual source files?
It seems like the main benefit would be that you could that python files tweaked in the out of source build would be automatically be updated in the source so you got commit in git?
What am I not considering?

I found something interesting here:
http://stackoverflow.com/questions/1395 ... thon-files
User avatar
sliptonic
Veteran
Posts: 3460
Joined: Tue Oct 25, 2011 10:46 pm
Location: Columbia, Missouri
Contact:

Re: Need for a tooling precheck.

Post by sliptonic »

Regarding the original problem, make sure you've rebuilt since May 31. There was a significant change to PathSurface.py where it wasn't storing certain settings so it would default to 0 and cause havoc.

jonasthomas wrote: I did an out of source build.. The python executable got copied
from:
/home/jonasthomas/FreeCADPath/FreeCAD/src/Mod/Path/PathScripts/PathSurface.py
To:
/home/jonasthomas/FreeCADPath/build-FreeCAD-Desktop-Default/Mod/Path/PathScripts/PathSurface.py

Along the way I noticed that PathSurface.pyc gets generated. (I don't fully understand what this does)
The cached compiled python gets generated at run time. You can edit the files and it will be regenerated automatically. No need to rebuild FreeCAD.

I'm wondering that If I
replaced:
/home/jonasthomas/FreeCADPath/build-FreeCAD-Desktop-Default/Mod/Path/PathScripts/PathSurface.py
with a symlink to:
/home/jonasthomas/FreeCADPath/FreeCAD/src/Mod/Path/PathScripts/PathSurface.py
That if any changes in the eric4 ide could be updated through git?
I've gotten bit more than once by forgetting to copy modified python files back to the source tree before doing a commit. Using symlinks is interesting. I don't know much about cmake though so I'll let smarter people answer.
jonasthomas
Posts: 162
Joined: Wed Feb 01, 2012 3:29 am

Re: Need for a tooling precheck.

Post by jonasthomas »

sliptonic wrote:Regarding the original problem, make sure you've rebuilt since May 31. There was a significant change to PathSurface.py where it wasn't storing certain settings so it would default to 0 and cause havoc.
I had generated from a fresh copy of your repo and am 99% sure it was current to that.
Even if previous critter was neutered, I think you still may have an issue with the program seizing if the user enters a 0 diameter in the tooltable.
I'm wondering that If I
replaced:
/home/jonasthomas/FreeCADPath/build-FreeCAD-Desktop-Default/Mod/Path/PathScripts/PathSurface.py
with a symlink to:
/home/jonasthomas/FreeCADPath/FreeCAD/src/Mod/Path/PathScripts/PathSurface.py
That if any changes in the eric4 ide could be updated through git?
I've gotten bit more than once by forgetting to copy modified python files back to the source tree before doing a commit. Using symlinks is interesting. I don't know much about cmake though so I'll let smarter people answer.
I tried hacking up the cmake in the top level cmake with the link that I gave and I sort of screwed things up... It did what it was designed to do, it installed symlinks in the src subfolders in the out of source build. It seems that the actual python excecutables are installed in a slightly different location. So who is the the current freecad Cmake guru?
Post Reply