Skip to content

Commit

Permalink
Fix feedrate bug #2597
Browse files Browse the repository at this point in the history
minor edits to linuxcnc post processor
  • Loading branch information
sliptonic authored and yorikvanhavre committed Jul 4, 2016
1 parent 1e333f4 commit fd57f47
Show file tree
Hide file tree
Showing 2 changed files with 131 additions and 105 deletions.
30 changes: 22 additions & 8 deletions src/Mod/Path/PathScripts/PathSurface.py
Expand Up @@ -138,16 +138,16 @@ def drawLoops(loops):
loopstring += "G0 Z" + str(obj.SafeHeight.Value) + "\n"
loopstring += "G0 X" + \
str(fmt(p.x)) + " Y" + str(fmt(p.y)) + "\n"
loopstring += "G1 Z" + str(fmt(p.z)) + "\n"
loopstring += "G1 Z" + str(fmt(p.z)) + " F" + str(self.vertFeed) + "\n"
for p in loop[1:]:
loopstring += "G1 X" + \
str(fmt(p.x)) + " Y" + str(fmt(p.y)) + \
" Z" + str(fmt(p.z)) + "\n"
" Z" + str(fmt(p.z)) + " F" + str(self.horizFeed)+ "\n"
zheight = p.z
p = loop[0]
loopstring += "G1 X" + \
str(fmt(p.x)) + " Y" + str(fmt(p.y)) + \
" Z" + str(fmt(zheight)) + "\n"
" Z" + str(fmt(zheight)) + " F" + str(self.vertFeed) + "\n"
loopstring += "(loop end)" + "\n"
print " loop ", nloop, " with ", len(loop), " points"
nloop = nloop + 1
Expand All @@ -157,8 +157,6 @@ def drawLoops(loops):

depthparams = depth_params(obj.ClearanceHeight.Value, obj.SafeHeight.Value,
obj.StartDepth.Value, obj.StepDown, obj.FinishDepth.Value, obj.FinalDepth.Value)
# stlfile = "../../stl/gnu_tux_mod.stl"
# surface = STLSurfaceSource(stlfile)
surface = s

t_before = time.time()
Expand All @@ -167,12 +165,20 @@ def drawLoops(loops):
# wl = ocl.AdaptiveWaterline() # this is slower, ca 60 seconds on i7
# CPU
wl.setSTL(surface)
diam = 0.5
diam = self.radius * 2

# FIXME: Need to get tool length from tool object
length = 10.0

# FIXME: Need to get correct tool shape. Hard coding to ball cutter
# is bad.

# any ocl MillingCutter class should work here
cutter = ocl.BallCutter(diam, length)

wl.setCutter(cutter)
# this should be smaller than the smallest details in the STL file

wl.setSampling(obj.SampleInterval)
# AdaptiveWaterline() also has settings for minimum sampling interval
# (see c++ code)
Expand Down Expand Up @@ -202,6 +208,8 @@ def _dropcutter(self, obj, s, bb):
pdc = ocl.PathDropCutter() # create a pdc
pdc.setSTL(s)
pdc.setCutter(cutter)

# FIXME: need to set minimumZ to something real
pdc.minimumZ = 0.25
pdc.setSampling(obj.SampleInterval)

Expand Down Expand Up @@ -249,7 +257,7 @@ def _dropcutter(self, obj, s, bb):

for c in clp:
output += "G1 X" + str(c.x) + " Y" + \
str(c.y) + " Z" + str(c.z) + "\n"
str(c.y) + " Z" + str(c.z) + " F" + str(self.horizFeed) + "\n"

return output

Expand Down Expand Up @@ -369,7 +377,13 @@ def GetResources(self):
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Path_Surface", "Creates a Path Surfacing object")}

def IsActive(self):
return FreeCAD.ActiveDocument is not None
if FreeCAD.ActiveDocument is None:
active = False
elif PathUtils.findProj() is None:
active = False
else:
active = True
return active

def Activated(self):

Expand Down

0 comments on commit fd57f47

Please sign in to comment.