fix for direction/cutside bug

This commit is contained in:
sliptonic 2016-11-04 15:04:32 -05:00
parent cb843391a8
commit 9a3711079c
2 changed files with 45 additions and 29 deletions

View File

@ -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()

View File

@ -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(