Make PathPost emit tool controllers even if tool number is same.
This commit is contained in:
sliptonic
2022-02-22 08:58:10 -06:00
parent 44a989f3b9
commit 27efdf9caf
6 changed files with 540 additions and 145 deletions

View File

@@ -75,3 +75,33 @@ def generate(
PathLog.track(commands)
return commands
def generateSubstitute(newTC, oldTC=None):
"""
The specific commands to emit, depend on the state of the machine.
For example, the toolnumber may not change, only the spindle speed.
This routine will generate a list of commands to substitute for a TC
object to be handed to the postprocessor.
It will contain only the commands needed
"""
if oldTC is None:
return newTC.Path.Commands
if newTC.ToolNumber != oldTC.ToolNumber: # Full toolchange
return newTC.Path.Commands
if (newTC.SpindleSpeed != oldTC.SpindleSpeed) or (
newTC.SpindleDir != oldTC.SpindleDir
):
if newTC.SpindleDir == "Forward":
sd = SpindleDirection.CW
elif newTC.SpindleDir == "Reverse":
sd = SpindleDirection.CCW
else:
sd = SpindleDirection.OFF
return [Path.Command(sd.value, {"S": newTC.SpindleSpeed})]
return []