A few days ago, I submit a pull request adding Path.Area, and Path::FeatureArea. The feature is supposed to be used to generate wires that can be later used to generate path. Because it can't generate path at that time, there is debate about how to incorporate the feature into current Path Mod.
With my latest push, the debate is over, which is why I started this new thread. Introducing the all powerfully Path.fromShapes() function. It can properly convert any number of shapes into path, with optimized travel distance, and ordering based on each wires Z height. It internally uses Path.Area, which is my FC wrapper for libarea, of course.
In case you want to try out my branch, its here
Now, prepare to be amazed!
Code: Select all
App.newDocument('test')
workpiece = App.ActiveDocument.addObject('Part::Feature','workpiece')
workpiece.Shape = Part.makeBox(10,10,10)
workpiece.ViewObject.Transparency = 70
model = App.ActiveDocument.addObject('Part::Feature','model')
model.Shape = Part.makeBox(10,10,8).cut(Part.makeCylinder(3,10,App.Vector(5,5,1)))
model.ViewObject.Transparency = 50
Code: Select all
import Path
# This is the profiling job
profile = Path.Area(Offset=1,SectionCount=-1)
profile.add(workpiece.Shape)
Path.show(Path.fromShapes(profile.getShape()))
# This is the pocketing job
pocket = Path.Area(PocketMode=4,SectionCount=-1)
pocket.add((workpiece.Shape,model.Shape),op=1)
Path.show(Path.fromShapes(pocket.getShape()))
Now, let's do some tunning.
Code: Select all
App.newDocument('test')
# Smaller tool, SectionOffset is the first layer depth
profile = Path.Area(Offset=0.5,SectionCount=-1,SectionOffset=0.5)
profile.add(workpiece.Shape)
# specify retraction height, and retraction return clearance
Path.show(Path.fromShapes(profile.getShape(),height=11,clearance=0.5))
# Smaller tool, fine tuning stepdown to get an accurate model top surface
pocket = Path.Area(PocketMode=4,SectionCount=-1,ToolRadius=0.5,SectionOffset=0.5,Stepdown=0.499)
pocket.add((workpiece.Shape,model.Shape),op=1)
# Choose a start position to minimize travel distance. Specify retraction threshold to keep tool down
Path.show(Path.fromShapes(pocket.getShape(),start=App.Vector(10),height=11,clearance=0.5,threshold=1))