Cleaned up Machine removal.

This commit is contained in:
ml
2016-10-23 02:03:23 -07:00
committed by wmayer
parent 62dd69cd69
commit 1aa7348b8a
6 changed files with 48 additions and 64 deletions

View File

@@ -54,7 +54,7 @@ Fix tool change
Limit comments length and characters to Uppercase, alpha numeric and spaces add / prior to coments
import linuxcnc_post
linuxcnc_post.export(object,"/path/to/file.ncc")
linuxcnc_post.export(object,"/path/to/file.ncc","")
'''
import datetime
@@ -110,7 +110,7 @@ if open.__module__ == '__builtin__':
pythonopen = open
def export(objectslist,filename):
def export(objectslist,filename,argstring):
global UNITS
for obj in objectslist:
if not hasattr(obj,"Path"):
@@ -123,19 +123,16 @@ def export(objectslist,filename):
#Find the machine.
#The user my have overriden post processor defaults in the GUI. Make sure we're using the current values in the Machine Def.
myMachine = None
for pathobj in objectslist:
if hasattr(pathobj,"Group"): #We have a compound or project.
for p in pathobj.Group:
if p.Name == "Machine":
myMachine = p
for pathobj in selection:
if hasattr(pathobj,"MachineName"):
myMachine = pathobj.MachineName
if hasattr(pathobj, "MachineUnits"):
if pathobj.MachineUnits == "Metric":
UNITS = "G21"
else:
UNITS = "G20"
if myMachine is None:
print "No machine found in this project"
else:
if myMachine.MachineUnits == "Metric":
UNITS = "G21"
else:
UNITS = "G20"
print "No machine found in this selection"
# write header
if OUTPUT_HEADER: