Path: Added option to select direction (CW, CCW) in Deburr Op

This commit is contained in:
Patrick Felixberger
2020-02-17 01:13:21 +01:00
parent 7aad85e9c8
commit d0f0ad2a06
2 changed files with 10 additions and 3 deletions

View File

@@ -69,6 +69,8 @@ class ObjectDeburr(PathEngraveBase.ObjectOp):
obj.addProperty('App::PropertyEnumeration', 'Join', 'Deburr', QtCore.QT_TRANSLATE_NOOP('PathDeburr', 'How to join chamfer segments'))
obj.Join = ['Round', 'Miter']
obj.setEditorMode('Join', 2) # hide for now
obj.addProperty('App::PropertyEnumeration', 'Direction', 'Deburr', QtCore.QT_TRANSLATE_NOOP('PathDeburr', 'Direction of Operation'))
obj.Direction = ['CW', 'CCW']
def opOnDocumentRestored(self, obj):
obj.setEditorMode('Join', 2) # hide for now
@@ -104,6 +106,10 @@ class ObjectDeburr(PathEngraveBase.ObjectOp):
if wire:
wires.append(wire)
forward = True
if obj.Direction == 'CCW':
forward = False
zValues = []
z = 0
if obj.StepDown.Value != 0:
@@ -114,7 +120,7 @@ class ObjectDeburr(PathEngraveBase.ObjectOp):
PathLog.track(obj.Label, depth, zValues)
self.wires = wires # pylint: disable=attribute-defined-outside-init
self.buildpathocc(obj, wires, zValues, True)
self.buildpathocc(obj, wires, zValues, True, forward)
# the last command is a move to clearance, which is automatically added by PathOp
if self.commandlist:
@@ -131,6 +137,7 @@ class ObjectDeburr(PathEngraveBase.ObjectOp):
obj.Join = 'Round'
obj.setExpression('StepDown', '0 mm')
obj.StepDown = '0 mm'
obj.Direction = 'CW'
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):
def buildpathocc(self, obj, wires, zValues, relZ=False, forward=True):
'''buildpathocc(obj, wires, zValues, relZ=False) ... internal helper function to generate engraving commands.'''
PathLog.track(obj.Label, len(wires), zValues)
@@ -70,7 +70,7 @@ class ObjectOp(PathOp.ObjectOp):
if hasattr(obj, 'StartVertex'):
offset = DraftGeomUtils.rebaseWire(offset, obj.StartVertex)
edges = copy.copy(PathOpTools.orientWire(offset).Edges)
edges = copy.copy(PathOpTools.orientWire(offset, forward).Edges)
last = None
for z in zValues: