Skip to content

Commit

Permalink
Merge pull request #3069 from Schildkroet/master
Browse files Browse the repository at this point in the history
[PATH]: Added option to select direction (CW, CCW) in Deburr Op
  • Loading branch information
sliptonic committed Feb 18, 2020
2 parents 01e8e7f + d0f0ad2 commit 4a2623e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/Mod/Path/PathScripts/PathDeburr.py
Expand Up @@ -69,6 +69,8 @@ def initOperation(self, obj):
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
Expand Down Expand Up @@ -104,6 +106,10 @@ def opExecute(self, obj):
if wire:
wires.append(wire)

forward = True
if obj.Direction == 'CCW':
forward = False

zValues = []
z = 0
if obj.StepDown.Value != 0:
Expand All @@ -114,7 +120,7 @@ def opExecute(self, obj):
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:
Expand All @@ -131,6 +137,7 @@ def opSetDefaultValues(self, obj, job):
obj.Join = 'Round'
obj.setExpression('StepDown', '0 mm')
obj.StepDown = '0 mm'
obj.Direction = 'CW'


def SetupProperties():
Expand Down
4 changes: 2 additions & 2 deletions src/Mod/Path/PathScripts/PathEngraveBase.py
Expand Up @@ -59,7 +59,7 @@ def getZValues(self, obj):
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)

Expand All @@ -70,7 +70,7 @@ def buildpathocc(self, obj, wires, zValues, relZ=False):
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:
Expand Down

0 comments on commit 4a2623e

Please sign in to comment.