Merge pull request #3069 from Schildkroet/master
[PATH]: Added option to select direction (CW, CCW) in Deburr Op
This commit is contained in:
@@ -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():
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user