Added EntryPoint option to path deburr

This commit is contained in:
Patrick Felixberger
2020-03-05 22:55:24 +01:00
parent 1927147dd7
commit 78dd7a61aa
2 changed files with 12 additions and 3 deletions

View File

@@ -78,6 +78,7 @@ class ObjectDeburr(PathEngraveBase.ObjectOp):
obj.Direction = ['CW', 'CCW']
obj.addProperty('App::PropertyEnumeration', 'Side', 'Deburr', QtCore.QT_TRANSLATE_NOOP('PathDeburr', 'Side of Operation'))
obj.Side = ['Outside', 'Inside']
obj.addProperty('App::PropertyInteger', 'EntryPoint', 'Deburr', QtCore.QT_TRANSLATE_NOOP('PathDeburr', 'Select the segment, there the operations starts'))
def opOnDocumentRestored(self, obj):
obj.setEditorMode('Join', 2) # hide for now
@@ -129,9 +130,12 @@ class ObjectDeburr(PathEngraveBase.ObjectOp):
zValues.append(z)
zValues.append(depth)
PathLog.track(obj.Label, depth, zValues)
if obj.EntryPoint < 0:
obj.EntryPoint = 0;
self.wires = wires # pylint: disable=attribute-defined-outside-init
self.buildpathocc(obj, wires, zValues, True, forward)
self.buildpathocc(obj, wires, zValues, True, forward, obj.EntryPoint)
# the last command is a move to clearance, which is automatically added by PathOp
if self.commandlist:
@@ -150,6 +154,7 @@ class ObjectDeburr(PathEngraveBase.ObjectOp):
obj.StepDown = '0 mm'
obj.Direction = 'CW'
obj.Side = "Outside"
obj.EntryPoint = 0;
def SetupProperties():

View File

@@ -59,7 +59,7 @@ class ObjectOp(PathOp.ObjectOp):
zValues.append(obj.FinalDepth.Value)
return zValues
def buildpathocc(self, obj, wires, zValues, relZ=False, forward=True):
def buildpathocc(self, obj, wires, zValues, relZ=False, forward=True, start_idx=0):
'''buildpathocc(obj, wires, zValues, relZ=False) ... internal helper function to generate engraving commands.'''
PathLog.track(obj.Label, len(wires), zValues)
@@ -78,6 +78,10 @@ class ObjectOp(PathOp.ObjectOp):
self.appendCommand(Path.Command('G1', {'X': last.x, 'Y': last.y, 'Z': last.z}), z, relZ, self.vertFeed)
first = True
if start_idx > len(edges)-1:
start_idx = len(edges)-1
edges = edges[start_idx:] + edges[:start_idx]
for edge in edges:
if first and (not last or not wire.isClosed()):
# we set the first move to our first point