sliptonic made a start here in this comment thread:
He referred to this github branch of the FC.
(I've cloned this, checked it out, and compiled from scratch again.)
There are further details here:
https://github.com/sliptonic/FreeCAD/wi ... g-for-Path
** If we did develop a model NEWOP, it might be worthwhile putting all these instructions into the comments in the source-code to make them easier to follow.
The operations I'd like to develop might best be calculated in separate subprocesses. So, ideally, we'd save an STL file of the model, a properties file of things like toolshape, tolerance, stepdown -- and the calculated toolpaths would return through the stdout of the process.
Developing the FC code
The following cannot be the best way to do this, but I just had to get somewhere.
I made a FC file with a JOB and a NEWOP operation and have been hacking the file:
https://github.com/sliptonic/FreeCAD/bl ... WOP.py#L71
in the place it's been copied in the build directory:
./freecad-build/Mod/Path/PathScripts/PathNEWOP.py
I set the logging level to debug:
Code: Select all
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
Code: Select all
PathLog.info(self.__dict__)
PathLog.info(obj.__dict__)
I've managed to generate a ZigZaggy toolpath in the opExecute() function, like this:
Code: Select all
for i in range(21):
self.commandlist.append(Path.Command("G1", {"X": [bb.XMin,bb.XMax][i%2], "Y":bb.YMin + (bb.YMax-bb.YMin)*i/20.0, "Z": bb.ZMax, "F": 101}))
I can also save an STL file, like this:
Code: Select all
for base in self.model:
m = MeshPart.meshFromShape(base.Shape)
m.write("test_%s.stl" % base.Name)
So I need help getting this PathNEWOP module into a completed state, particularly with:
(1) finding the correct Shape to dump into the stl-file,
(2) dumping out all the properties/parameters into a second file, one per line,
(3) streaming the toolpath motion code back from the stdout of the calculating process, back into the FC ui so you can see the progress.