Fixes for various gcode errors

Some operations were still outputting even if disabled.
Nested comments caused trouble in linuxcnc
Machine was producing an initial move that was potentially dangerous
This commit is contained in:
sliptonic 2016-06-08 08:57:36 -05:00
parent f55fb8cb99
commit dff173cd1f
7 changed files with 81 additions and 29 deletions

View File

@ -79,10 +79,13 @@ class ObjectDrilling:
def onChanged(self, obj, prop):
if prop == "UserLabel":
obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")"
obj.Label = obj.UserLabel + " :" + obj.ToolDescription
def execute(self, obj):
output = ""
if obj.Comment != "":
output += '(' + str(obj.Comment)+')\n'
toolLoad = PathUtils.getLastToolLoad(obj)
if toolLoad is None or toolLoad.ToolNumber == 0:
self.vertFeed = 100
@ -100,9 +103,9 @@ class ObjectDrilling:
obj.ToolDescription = toolLoad.Name
if obj.UserLabel == "":
obj.Label = obj.Name + " (" + obj.ToolDescription + ")"
obj.Label = obj.Name + " :" + obj.ToolDescription
else:
obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")"
obj.Label = obj.UserLabel + " :" + obj.ToolDescription
locations = []
output = "(Begin Drilling)\n"
@ -155,8 +158,20 @@ class ObjectDrilling:
output += "G80\n"
path = Path.Path(output)
obj.Path = path
# path = Path.Path(output)
# obj.Path = path
if obj.Active:
path = Path.Path(output)
obj.Path = path
obj.ViewObject.Visibility = True
else:
path = Path.Path("(inactive operation)")
obj.Path = path
obj.ViewObject.Visibility = False
def checkdrillable(self, obj, sub):
print "in checkdrillable"

View File

@ -81,10 +81,12 @@ class ObjectPathEngrave:
def onChanged(self, obj, prop):
if prop == "UserLabel":
obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")"
obj.Label = obj.UserLabel + " :" + obj.ToolDescription
def execute(self, obj):
output = ""
if obj.Comment != "":
output += '(' + str(obj.Comment)+')\n'
toolLoad = PathUtils.getLastToolLoad(obj)
if toolLoad is None or toolLoad.ToolNumber == 0:
@ -102,9 +104,9 @@ class ObjectPathEngrave:
obj.ToolDescription = toolLoad.Name
if obj.UserLabel == "":
obj.Label = obj.Name + " (" + obj.ToolDescription + ")"
obj.Label = obj.Name + " :" + obj.ToolDescription
else:
obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")"
obj.Label = obj.UserLabel + " :" + obj.ToolDescription
if obj.Base:
for o in obj.Base:
@ -118,8 +120,18 @@ class ObjectPathEngrave:
# print output
if output == "":
output += "G0"
path = Path.Path(output)
obj.Path = path
if obj.Active:
path = Path.Path(output)
obj.Path = path
obj.ViewObject.Visibility = True
else:
path = Path.Path("(inactive operation)")
obj.Path = path
obj.ViewObject.Visibility = False
# path = Path.Path(output)
# obj.Path = path
def buildpathocc(self, obj, wires):
import Part

View File

@ -73,8 +73,9 @@ class Machine:
def execute(self, obj):
obj.Label = "Machine_" + str(obj.MachineName)
# need to filter this path out in post- only for visualization
gcode = 'G0 X' + str(obj.X.Value) + ' Y' + \
str(obj.Y.Value) + ' Z' + str(obj.Z.Value)
#gcode = 'G0 X' + str(obj.X.Value) + ' Y' + \
# str(obj.Y.Value) + ' Z' + str(obj.Z.Value)
gcode = '(' + str(obj.Label) + ')'
obj.Path = Path.Path(gcode)
def onChanged(self, obj, prop):

View File

@ -111,7 +111,7 @@ class ObjectPocket:
obj.setEditorMode('RampSize', 2) # make this hidden
if prop == "UserLabel":
obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")"
obj.Label = obj.UserLabel + " :" + obj.ToolDescription
def __getstate__(self):
@ -233,6 +233,9 @@ class ObjectPocket:
# Build up the offset loops
output = ""
if obj.Comment != "":
output += '(' + str(obj.Comment)+')\n'
offsets = []
nextradius = (self.radius * 2) * (float(obj.StepOver)/100)
result = DraftGeomUtils.pocket2d(shape, nextradius)
@ -374,9 +377,9 @@ class ObjectPocket:
obj.ToolDescription = toolLoad.Name
if obj.UserLabel == "":
obj.Label = obj.Name + " (" + obj.ToolDescription + ")"
obj.Label = obj.Name + " :" + obj.ToolDescription
else:
obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")"
obj.Label = obj.UserLabel + " :" + obj.ToolDescription
if obj.Base:
for b in obj.Base:

View File

@ -127,7 +127,7 @@ class ObjectProfile:
def onChanged(self, obj, prop):
if prop == "UserLabel":
obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")"
obj.Label = obj.UserLabel + " :" + obj.ToolDescription
def addprofilebase(self, obj, ss, sub=""):
baselist = obj.Base
@ -171,7 +171,8 @@ class ObjectProfile:
def _buildPathOCC(self, obj, wire):
import DraftGeomUtils
output = ""
output += '(' + str(obj.Comment)+')\n'
if obj.Comment != "":
output += '(' + str(obj.Comment)+')\n'
if obj.Direction == 'CCW':
clockwise = False
@ -194,6 +195,8 @@ class ObjectProfile:
import math
import area
output = ""
if obj.Comment != "":
output += '(' + str(obj.Comment)+')\n'
if obj.StartPoint and obj.UseStartPoint:
startpoint = obj.StartPoint
@ -280,9 +283,9 @@ print "y - " + str(point.y)
obj.ToolDescription = toolLoad.Name
if obj.UserLabel == "":
obj.Label = obj.Name + " (" + obj.ToolDescription + ")"
obj.Label = obj.Name + " :" + obj.ToolDescription
else:
obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")"
obj.Label = obj.UserLabel + " :" + obj.ToolDescription
if obj.Base:

View File

@ -157,10 +157,12 @@ class ObjectRemote:
obj.proplist = pl
if prop == "UserLabel":
obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")"
obj.Label = obj.UserLabel + " :" + obj.ToolDescription
def execute(self, obj):
output = ""
if obj.Comment != "":
output += '(' + str(obj.Comment)+')\n'
toolLoad = PathUtils.getLastToolLoad(obj)
if toolLoad is None or toolLoad.ToolNumber == 0:
@ -178,13 +180,21 @@ class ObjectRemote:
obj.ToolDescription = toolLoad.Name
if obj.UserLabel == "":
obj.Label = obj.Name + " (" + obj.ToolDescription + ")"
obj.Label = obj.Name + " :" + obj.ToolDescription
else:
obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")"
obj.Label = obj.UserLabel + " :" + obj.ToolDescription
output += "(remote gcode goes here)"
path = Path.Path(output)
obj.Path = path
if obj.Active:
path = Path.Path(output)
obj.Path = path
obj.ViewObject.Visibility = True
else:
path = Path.Path("(inactive operation)")
obj.Path = path
obj.ViewObject.Visibility = False
class ViewProviderRemote:

View File

@ -121,7 +121,7 @@ class ObjectSurface:
def onChanged(self, obj, prop):
if prop == "UserLabel":
obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")"
obj.Label = obj.UserLabel + " :" + obj.ToolDescription
def _waterline(self, obj, s, bb):
import ocl
@ -258,6 +258,8 @@ class ObjectSurface:
FreeCAD.Console.PrintWarning(
translate("PathSurface", "Hold on. This might take a minute.\n"))
output = ""
if obj.Comment != "":
output += '(' + str(obj.Comment)+')\n'
toolLoad = PathUtils.getLastToolLoad(obj)
if toolLoad is None or toolLoad.ToolNumber == 0:
@ -275,9 +277,9 @@ class ObjectSurface:
obj.ToolDescription = toolLoad.Name
if obj.UserLabel == "":
obj.Label = obj.Name + " (" + obj.ToolDescription + ")"
obj.Label = obj.Name + " :" + obj.ToolDescription
else:
obj.Label = obj.UserLabel + " (" + obj.ToolDescription + ")"
obj.Label = obj.UserLabel + " :" + obj.ToolDescription
if obj.Base:
for b in obj.Base:
@ -312,9 +314,15 @@ class ObjectSurface:
elif obj.Algorithm == 'OCL Waterline':
output = self._waterline(obj, s, bb)
path = Path.Path(output)
obj.Path = path
if obj.Active:
path = Path.Path(output)
obj.Path = path
obj.ViewObject.Visibility = True
else:
path = Path.Path("(inactive operation)")
obj.Path = path
obj.ViewObject.Visibility = False
class ViewProviderSurface: