From 9a3711079c7f252f52d6837d3ea499314f3fec18 Mon Sep 17 00:00:00 2001 From: sliptonic Date: Fri, 4 Nov 2016 15:04:32 -0500 Subject: [PATCH] fix for direction/cutside bug --- src/Mod/Path/PathScripts/PathPocket.py | 12 ++++- src/Mod/Path/PathScripts/PathProfile.py | 62 ++++++++++++++----------- 2 files changed, 45 insertions(+), 29 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathPocket.py b/src/Mod/Path/PathScripts/PathPocket.py index fedf8905f..fdffa2859 100644 --- a/src/Mod/Path/PathScripts/PathPocket.py +++ b/src/Mod/Path/PathScripts/PathPocket.py @@ -588,14 +588,24 @@ class TaskPanel: index = self.form.algorithmSelect.findText(self.obj.Algorithm, QtCore.Qt.MatchFixedString) if index >= 0: + self.form.algorithmSelect.blockSignals(True) self.form.algorithmSelect.setCurrentIndex(index) + self.form.algorithmSelect.blockSignals(False) + + index = self.form.cutMode.findText( + self.obj.CutMode, QtCore.Qt.MatchFixedString) + if index >= 0: + self.form.cutMode.blockSignals(True) + self.form.cutMode.setCurrentIndex(index) + self.form.cutMode.blockSignals(False) # for i in self.obj.Base: # self.form.baseList.addItem(i[0].Name + "." + i[1][0]) - + self.form.baseList.blockSignals(True) for i in self.obj.Base: for sub in i[1]: self.form.baseList.addItem(i[0].Name + "." + sub) + self.form.baseList.blockSignals(False) def open(self): self.s = SelObserver() diff --git a/src/Mod/Path/PathScripts/PathProfile.py b/src/Mod/Path/PathScripts/PathProfile.py index 95123bbcd..12d14f6fa 100644 --- a/src/Mod/Path/PathScripts/PathProfile.py +++ b/src/Mod/Path/PathScripts/PathProfile.py @@ -211,12 +211,12 @@ class ObjectProfile: PathKurveUtils.output('mem') PathKurveUtils.feedrate_hv(self.horizFeed, self.vertFeed) - # Reverse the direction for holes - if isHole: - direction = "CW" if obj.Direction == "CCW" else "CCW" - else: - direction = obj.Direction - + # Reverse the direction for holes + if isHole: + direction = "CW" if obj.Direction == "CCW" else "CCW" + else: + direction = obj.Direction + output = "" output += "G0 Z" + str(obj.ClearanceHeight.Value) + "F " + PathUtils.fmt(self.vertRapid) + "\n" curve = PathKurveUtils.makeAreaCurve(edgelist, direction, startpoint, endpoint) @@ -312,7 +312,7 @@ print "y - " + str(point.y) hfaces = [] vfaces = [] wires = [] - holes = [] + holes = [] for b in obj.Base: for sub in b[1]: @@ -327,11 +327,11 @@ print "y - " + str(point.y) else: FreeCAD.Console.PrintError(translate("Path", "Face doesn't appear to be parallel or perpendicular to the XY plane. No path will be generated for: \n")) FreeCAD.Console.PrintError(b[0].Name + "." + sub + "\n") - - if obj.processHoles: - for h in hfaces: - holes += h.Wires[1:] - + + if obj.processHoles: + for h in hfaces: + holes += h.Wires[1:] + for h in hfaces: wires.append(h.OuterWire) @@ -340,18 +340,18 @@ print "y - " + str(point.y) wires = wires + slices - for wire in holes: - if obj.Algorithm == "OCC Native": - output += self._buildPathOCC(obj, wire) - else: - try: - import area - except: + for wire in holes: + if obj.Algorithm == "OCC Native": + output += self._buildPathOCC(obj, wire) + else: + try: + import area + except: FreeCAD.Console.PrintError(translate("Path", "libarea needs to be installed for this command to work.\n")) - return - edgelist = wire.Edges - edgelist = Part.__sortEdges__(edgelist) - output += self._buildPathLibarea(obj, edgelist, True) + return + edgelist = wire.Edges + edgelist = Part.__sortEdges__(edgelist) + output += self._buildPathLibarea(obj, edgelist, True) for wire in wires: if obj.Algorithm == "OCC Native": @@ -364,7 +364,7 @@ print "y - " + str(point.y) return edgelist = wire.Edges edgelist = Part.__sortEdges__(edgelist) - output += self._buildPathLibarea(obj, edgelist, False) + output += self._buildPathLibarea(obj, edgelist, False) if obj.Active: path = Path.Path(output) @@ -576,8 +576,8 @@ class TaskPanel: self.obj.Side = str(self.form.cutSide.currentText()) if hasattr(self.obj, "Direction"): self.obj.Direction = str(self.form.direction.currentText()) - if hasattr(self.obj, "processHoles"): - self.obj.processHoles = self.form.processHoles.isChecked() + if hasattr(self.obj, "processHoles"): + self.obj.processHoles = self.form.processHoles.isChecked() self.obj.Proxy.execute(self.obj) def setFields(self): @@ -593,22 +593,28 @@ class TaskPanel: self.form.useCompensation.setChecked(self.obj.UseComp) self.form.useStartPoint.setChecked(self.obj.UseStartPoint) self.form.useEndPoint.setChecked(self.obj.UseEndPoint) - self.form.processHoles.setChecked(self.obj.processHoles) + self.form.processHoles.setChecked(self.obj.processHoles) index = self.form.algorithmSelect.findText( self.obj.Algorithm, QtCore.Qt.MatchFixedString) if index >= 0: + self.form.algorithmSelect.blockSignals(True) self.form.algorithmSelect.setCurrentIndex(index) + self.form.algorithmSelect.blockSignals(False) index = self.form.cutSide.findText( self.obj.Side, QtCore.Qt.MatchFixedString) if index >= 0: + self.form.cutSide.blockSignals(True) self.form.cutSide.setCurrentIndex(index) + self.form.cutSide.blockSignals(False) index = self.form.direction.findText( self.obj.Direction, QtCore.Qt.MatchFixedString) if index >= 0: + self.form.direction.blockSignals(True) self.form.direction.setCurrentIndex(index) + self.form.direction.blockSignals(False) for i in self.obj.Base: for sub in i[1]: @@ -810,7 +816,7 @@ class TaskPanel: self.form.extraOffset.editingFinished.connect(self.getFields) self.form.segLen.editingFinished.connect(self.getFields) self.form.rollRadius.editingFinished.connect(self.getFields) - self.form.processHoles.clicked.connect(self.getFields) + self.form.processHoles.clicked.connect(self.getFields) # Tag Form QtCore.QObject.connect(