Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import DraftGeomUtils
- import Draft
- from FreeCAD import Vector,Base
- import math
- def findOutsideWire(wires):
- biggest = wires[0]
- for i in wires:
- if i.BoundBox.DiagonalLength >= biggest.BoundBox.DiagonalLength:
- biggest = i
- return i
- sel=Gui.Selection.getSelection()
- obj = sel[0]
- bb = obj.Shape.BoundBox
- cutterdia = 1.25
- offset = cutterdia/2.0
- stepdown = 1
- zbelow_bottom= -1
- ztop = bb.ZMax
- height = bb.ZMax-bb.ZMin
- numsteps = int(math.fabs(height/stepdown))
- wires=list()
- slicelist=[]
- z = height-stepdown
- for n in range(0,numsteps-1):
- outside = findOutsideWire(obj.Shape.slice(Base.Vector(0,0,1),z))
- outerPath = outside.makeOffset(offset)
- slicelist.append(outerPath)
- z= z-stepdown
- lastpass = findOutsideWire(obj.Shape.slice(Base.Vector(0,0,1),bb.ZMin+.0001)).makeOffset(offset)
- slicelist.append(lastpass)
- comp=Part.Compound(slicelist)
- Part.show(comp)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement