Merge pull request #4673 from sliptonic/bug/proxyerror
[PATH] Fix proxy error bug that occurs when postprocessing
This commit is contained in:
@@ -30,7 +30,6 @@ import datetime
|
||||
import shlex
|
||||
import os.path
|
||||
from PathScripts import PostUtils
|
||||
from PathScripts import PathUtils
|
||||
|
||||
TOOLTIP = '''
|
||||
This is a postprocessor file for the Path workbench. It is used to
|
||||
@@ -154,7 +153,7 @@ def processArguments(argstring):
|
||||
if args.no_tlo:
|
||||
USE_TLO = False
|
||||
if args.no_axis_modal:
|
||||
OUTPUT_DOUBLES = true
|
||||
OUTPUT_DOUBLES = True
|
||||
|
||||
except Exception: # pylint: disable=broad-except
|
||||
return False
|
||||
@@ -171,7 +170,7 @@ def export(objectslist, filename, argstring):
|
||||
global UNIT_SPEED_FORMAT
|
||||
global HORIZRAPID
|
||||
global VERTRAPID
|
||||
|
||||
|
||||
for obj in objectslist:
|
||||
if not hasattr(obj, "Path"):
|
||||
print("the object " + obj.Name + " is not a path. Please select only path and Compounds.")
|
||||
@@ -206,34 +205,10 @@ def export(objectslist, filename, argstring):
|
||||
if not obj.Base.Active:
|
||||
continue
|
||||
|
||||
# fetch machine details
|
||||
job = PathUtils.findParentJob(obj)
|
||||
|
||||
myMachine = 'not set'
|
||||
|
||||
if hasattr(job, "MachineName"):
|
||||
myMachine = job.MachineName
|
||||
|
||||
if hasattr(job, "MachineUnits"):
|
||||
if job.MachineUnits == "Metric":
|
||||
UNITS = "G21"
|
||||
UNIT_FORMAT = 'mm'
|
||||
UNIT_SPEED_FORMAT = 'mm/min'
|
||||
else:
|
||||
UNITS = "G20"
|
||||
UNIT_FORMAT = 'in'
|
||||
UNIT_SPEED_FORMAT = 'in/min'
|
||||
|
||||
if hasattr(job, "SetupSheet"):
|
||||
if hasattr(job.SetupSheet, "HorizRapid"):
|
||||
HORIZRAPID = Units.Quantity(job.SetupSheet.HorizRapid, FreeCAD.Units.Velocity)
|
||||
if hasattr(job.SetupSheet, "VertRapid"):
|
||||
VERTRAPID = Units.Quantity(job.SetupSheet.HorizRapid, FreeCAD.Units.Velocity)
|
||||
|
||||
# do the pre_op
|
||||
if OUTPUT_COMMENTS:
|
||||
gcode += linenumber() + "(BEGIN OPERATION: %s)\n" % obj.Label.upper()
|
||||
gcode += linenumber() + "(MACHINE: %s, %s)\n" % (myMachine.upper(), UNIT_SPEED_FORMAT.upper())
|
||||
gcode += linenumber() + "(MACHINE UNITS: %s)\n" % (UNIT_SPEED_FORMAT.upper())
|
||||
for line in PRE_OPERATION.splitlines(True):
|
||||
gcode += linenumber() + line
|
||||
|
||||
@@ -459,7 +434,6 @@ def parse(pathobj):
|
||||
outstring.append(param + str(int(c.Parameters['D'])))
|
||||
elif param == 'S':
|
||||
outstring.append(param + str(int(c.Parameters['S'])))
|
||||
currentSpeed = int(c.Parameters['S'])
|
||||
else:
|
||||
if (not OUTPUT_DOUBLES) and (param in currLocation) and (currLocation[param] == c.Parameters[param]):
|
||||
continue
|
||||
@@ -482,7 +456,6 @@ def parse(pathobj):
|
||||
# Check for Tool Change:
|
||||
if command == 'M6':
|
||||
# stop the spindle
|
||||
currentSpeed = 0
|
||||
out += linenumber() + "M5\n"
|
||||
for line in TOOL_CHANGE.splitlines(True):
|
||||
out += linenumber() + line
|
||||
|
||||
@@ -20,14 +20,10 @@
|
||||
|
||||
# HEDENHAIN Post-Processor for FreeCAD
|
||||
|
||||
import FreeCAD
|
||||
from FreeCAD import Units
|
||||
import argparse
|
||||
import time
|
||||
import shlex
|
||||
import PathScripts
|
||||
from PathScripts import PostUtils
|
||||
from PathScripts import PathUtils
|
||||
import math
|
||||
|
||||
#**************************************************************************#
|
||||
@@ -261,11 +257,8 @@ def export(objectslist, filename, argstring):
|
||||
global LBLIZE_STAUS
|
||||
|
||||
Object_Kind = None
|
||||
Feed_Rapid = False
|
||||
Feed = 0
|
||||
Spindle_RPM = 0
|
||||
Spindle_Active = False
|
||||
ToolId = ""
|
||||
Compensation = "0"
|
||||
params = [
|
||||
'X', 'Y', 'Z',
|
||||
@@ -360,22 +353,14 @@ def export(objectslist, filename, argstring):
|
||||
|
||||
for c in obj.Path.Commands:
|
||||
Cmd_Count += 1
|
||||
outstring = []
|
||||
command = c.Name
|
||||
if command != 'G0':
|
||||
command = command.replace('G0','G') # normalize: G01 -> G1
|
||||
Feed_Rapid = False
|
||||
else:
|
||||
Feed_Rapid = True
|
||||
|
||||
for param in params:
|
||||
if param in c.Parameters:
|
||||
if param == 'F':
|
||||
Feed = c.Parameters['F']
|
||||
elif param == 'S':
|
||||
Spindle_RPM = c.Parameters['S'] # Could be deleted if tool it's OK
|
||||
elif param == 'T':
|
||||
ToolId = c.Parameters['T'] # Could be deleted if tool it's OK
|
||||
|
||||
if command == 'G90':
|
||||
G_FUNCTION_STORE['G90'] = True
|
||||
@@ -474,21 +459,21 @@ def export(objectslist, filename, argstring):
|
||||
|
||||
def HEIDEN_Begin(ActualJob): #use Label for program name
|
||||
global UNITS
|
||||
JobParent = PathUtils.findParentJob(ActualJob[0])
|
||||
if hasattr(JobParent, "Label"):
|
||||
program_id = JobParent.Label
|
||||
else:
|
||||
program_id = "NEW"
|
||||
return "BEGIN PGM " + str(program_id) + " " + UNITS
|
||||
# JobParent = PathUtils.findParentJob(ActualJob[0])
|
||||
# if hasattr(JobParent, "Label"):
|
||||
# program_id = JobParent.Label
|
||||
# else:
|
||||
# program_id = "NEW"
|
||||
return "BEGIN PGM {}".format(UNITS)
|
||||
|
||||
def HEIDEN_End(ActualJob): #use Label for program name
|
||||
global UNITS
|
||||
JobParent = PathUtils.findParentJob(ActualJob[0])
|
||||
if hasattr(JobParent, "Label"):
|
||||
program_id = JobParent.Label
|
||||
else:
|
||||
program_id = "NEW"
|
||||
return "END PGM " + program_id + " " + UNITS
|
||||
# JobParent = PathUtils.findParentJob(ActualJob[0])
|
||||
# if hasattr(JobParent, "Label"):
|
||||
# program_id = JobParent.Label
|
||||
# else:
|
||||
# program_id = "NEW"
|
||||
return "END PGM {}".format(UNITS)
|
||||
|
||||
#def HEIDEN_ToolDef(tool_id, tool_length, tool_radius): # old machines don't have tool table, need tooldef list
|
||||
# return "TOOL DEF " + tool_id + " R" + "{:.3f}".format(tool_length) + " L" + "{:.3f}".format(tool_radius)
|
||||
|
||||
@@ -29,7 +29,6 @@ import argparse
|
||||
import datetime
|
||||
import shlex
|
||||
from PathScripts import PostUtils
|
||||
from PathScripts import PathUtils
|
||||
|
||||
TOOLTIP = '''
|
||||
This is a postprocessor file for the Path workbench. It is used to
|
||||
@@ -193,28 +192,10 @@ def export(objectslist, filename, argstring):
|
||||
if not obj.Base.Active:
|
||||
continue
|
||||
|
||||
# fetch machine details
|
||||
job = PathUtils.findParentJob(obj)
|
||||
|
||||
myMachine = 'not set'
|
||||
|
||||
if hasattr(job, "MachineName"):
|
||||
myMachine = job.MachineName
|
||||
|
||||
if hasattr(job, "MachineUnits"):
|
||||
if job.MachineUnits == "Metric":
|
||||
UNITS = "G21"
|
||||
UNIT_FORMAT = 'mm'
|
||||
UNIT_SPEED_FORMAT = 'mm/min'
|
||||
else:
|
||||
UNITS = "G20"
|
||||
UNIT_FORMAT = 'in'
|
||||
UNIT_SPEED_FORMAT = 'in/min'
|
||||
|
||||
# do the pre_op
|
||||
if OUTPUT_COMMENTS:
|
||||
gcode += linenumber() + "(begin operation: %s)\n" % obj.Label
|
||||
gcode += linenumber() + "(machine: %s, %s)\n" % (myMachine, UNIT_SPEED_FORMAT)
|
||||
gcode += linenumber() + "(machine units: %s)\n" % (UNIT_SPEED_FORMAT)
|
||||
for line in PRE_OPERATION.splitlines(True):
|
||||
gcode += linenumber() + line
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ import argparse
|
||||
import datetime
|
||||
import shlex
|
||||
from PathScripts import PostUtils
|
||||
from PathScripts import PathUtils
|
||||
|
||||
TOOLTIP = '''
|
||||
This is a postprocessor file for the Path workbench. It is used to
|
||||
@@ -161,8 +160,6 @@ def export(objectslist, filename, argstring):
|
||||
global UNITS
|
||||
global UNIT_FORMAT
|
||||
global UNIT_SPEED_FORMAT
|
||||
global HORIZRAPID
|
||||
global VERTRAPID
|
||||
|
||||
for obj in objectslist:
|
||||
if not hasattr(obj, "Path"):
|
||||
@@ -195,34 +192,10 @@ def export(objectslist, filename, argstring):
|
||||
if not obj.Base.Active:
|
||||
continue
|
||||
|
||||
# fetch machine details
|
||||
job = PathUtils.findParentJob(obj)
|
||||
|
||||
myMachine = 'not set'
|
||||
|
||||
if hasattr(job, "MachineName"):
|
||||
myMachine = job.MachineName
|
||||
|
||||
if hasattr(job, "MachineUnits"):
|
||||
if job.MachineUnits == "Metric":
|
||||
UNITS = "G21"
|
||||
UNIT_FORMAT = 'mm'
|
||||
UNIT_SPEED_FORMAT = 'mm/min'
|
||||
else:
|
||||
UNITS = "G20"
|
||||
UNIT_FORMAT = 'in'
|
||||
UNIT_SPEED_FORMAT = 'in/min'
|
||||
|
||||
if hasattr(job, "SetupSheet"):
|
||||
if hasattr(job.SetupSheet, "HorizRapid"):
|
||||
HORIZRAPID = Units.Quantity(job.SetupSheet.HorizRapid, FreeCAD.Units.Velocity)
|
||||
if hasattr(job.SetupSheet, "VertRapid"):
|
||||
VERTRAPID = Units.Quantity(job.SetupSheet.HorizRapid, FreeCAD.Units.Velocity)
|
||||
|
||||
# do the pre_op
|
||||
if OUTPUT_COMMENTS:
|
||||
gcode += linenumber() + "(begin operation: %s)\n" % obj.Label
|
||||
gcode += linenumber() + "(machine: %s, %s)\n" % (myMachine, UNIT_SPEED_FORMAT)
|
||||
gcode += linenumber() + "(machine: %s, %s)\n" % (MACHINE_NAME, UNIT_SPEED_FORMAT)
|
||||
for line in PRE_OPERATION.splitlines(True):
|
||||
gcode += linenumber() + line
|
||||
|
||||
|
||||
@@ -20,15 +20,14 @@
|
||||
#* *
|
||||
#***************************************************************************
|
||||
|
||||
# reload in python console:
|
||||
# import generic_post
|
||||
# reload(generic_post)
|
||||
# 03-24-2021 Sliptonic: I've removed teh PathUtils import and job lookup
|
||||
# post processors shouldn't be reaching back to the job. This can cause a
|
||||
# proxy error.
|
||||
|
||||
import FreeCAD
|
||||
import argparse
|
||||
import time
|
||||
from PathScripts import PostUtils
|
||||
from PathScripts import PathUtils
|
||||
import math
|
||||
|
||||
TOOLTIP = '''Post processor for Maho M 600E mill
|
||||
@@ -232,16 +231,17 @@ def processArguments(argstring):
|
||||
SHOW_EDITOR = False
|
||||
|
||||
def mkHeader(selection):
|
||||
job = PathUtils.findParentJob(selection[0])
|
||||
# job = PathUtils.findParentJob(selection[0])
|
||||
# this is within a function, because otherwise filename and time don't change when changing the FreeCAD project
|
||||
# now = datetime.datetime.now()
|
||||
now = time.strftime("%Y-%m-%d %H:%M")
|
||||
originfile = FreeCAD.ActiveDocument.FileName
|
||||
headerNoNumber = "%PM\n" # this line gets no linenumber
|
||||
if hasattr(job, "Description"):
|
||||
description = job.Description
|
||||
else:
|
||||
description = ""
|
||||
# if hasattr(job, "Description"):
|
||||
# description = job.Description
|
||||
# else:
|
||||
# description = ""
|
||||
description = ""
|
||||
# this line gets no linenumber, it is already a specially numbered
|
||||
headerNoNumber += "N9XXX (" + description + ", " + now + ")\n"
|
||||
header = ""
|
||||
|
||||
Reference in New Issue
Block a user