Path: bug fixes
This commit is contained in:
committed by
Yorik van Havre
parent
4327a08612
commit
c57ca9f351
@@ -108,7 +108,7 @@ class ObjectDrilling:
|
||||
toolLoad = obj.ToolController
|
||||
if toolLoad is None or toolLoad.ToolNumber == 0:
|
||||
FreeCAD.Console.PrintError("No Tool Controller is selected. We need a tool to build a Path.")
|
||||
#return
|
||||
return
|
||||
else:
|
||||
self.vertFeed = toolLoad.VertFeed.Value
|
||||
self.horizFeed = toolLoad.HorizFeed.Value
|
||||
@@ -317,6 +317,7 @@ class CommandPathDrilling:
|
||||
FreeCADGui.doCommand('obj.RetractHeight= ' + str(ztop))
|
||||
FreeCADGui.doCommand('obj.FinalDepth=' + str(zbottom))
|
||||
FreeCADGui.doCommand('PathScripts.PathUtils.addToJob(obj)')
|
||||
FreeCADGui.doCommand('obj.ToolController = PathScripts.PathUtils.findToolController(obj)')
|
||||
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
@@ -380,6 +381,7 @@ class TaskPanel:
|
||||
self.form.uiToolController.blockSignals(True)
|
||||
self.form.uiToolController.addItems(labels)
|
||||
self.form.uiToolController.blockSignals(False)
|
||||
|
||||
if self.obj.ToolController is not None:
|
||||
index = self.form.uiToolController.findText(
|
||||
self.obj.ToolController.Label, QtCore.Qt.MatchFixedString)
|
||||
@@ -388,9 +390,6 @@ class TaskPanel:
|
||||
self.form.uiToolController.blockSignals(True)
|
||||
self.form.uiToolController.setCurrentIndex(index)
|
||||
self.form.uiToolController.blockSignals(False)
|
||||
else:
|
||||
self.obj.ToolController = PathUtils.findToolController(self.obj)
|
||||
|
||||
|
||||
def open(self):
|
||||
self.s = SelObserver()
|
||||
|
||||
@@ -82,8 +82,7 @@ class ObjectPathEngrave:
|
||||
return None
|
||||
|
||||
def onChanged(self, obj, prop):
|
||||
if prop == "UserLabel":
|
||||
obj.Label = obj.UserLabel + " :" + obj.ToolDescription
|
||||
pass
|
||||
|
||||
def execute(self, obj):
|
||||
PathLog.track()
|
||||
@@ -118,45 +117,51 @@ class ObjectPathEngrave:
|
||||
if baseobject is None:
|
||||
return
|
||||
|
||||
if isinstance(baseobject.Proxy, Draft._ShapeString):
|
||||
output += "G0 Z" + PathUtils.fmt(obj.ClearanceHeight.Value) + "F " + PathUtils.fmt(self.vertRapid) + "\n"
|
||||
try:
|
||||
if isinstance(baseobject.Proxy, Draft._ShapeString):
|
||||
output += "G0 Z" + PathUtils.fmt(obj.ClearanceHeight.Value) + "F " + PathUtils.fmt(self.vertRapid) + "\n"
|
||||
|
||||
# we only consider the outer wire if this is a Face
|
||||
for w in baseobject.Shape.Wires:
|
||||
tempedges = PathUtils.cleanedges(w.Edges, 0.5)
|
||||
wires.append(Part.Wire(tempedges))
|
||||
# we only consider the outer wire if this is a Face
|
||||
for w in baseobject.Shape.Wires:
|
||||
tempedges = PathUtils.cleanedges(w.Edges, 0.5)
|
||||
wires.append(Part.Wire(tempedges))
|
||||
|
||||
if obj.Algorithm == "OCC Native":
|
||||
output += self.buildpathocc(obj, wires)
|
||||
if obj.Algorithm == "OCC Native":
|
||||
output += self.buildpathocc(obj, wires)
|
||||
|
||||
elif isinstance(baseobject.Proxy, ArchPanel.PanelSheet): # process the sheet
|
||||
baseobject.Proxy.execute(baseobject)
|
||||
ss = baseobject.Proxy.sheettag
|
||||
ss.Placement = baseobject.Placement.multiply(ss.Placement)
|
||||
elif isinstance(baseobject.Proxy, ArchPanel.PanelSheet): # process the sheet
|
||||
baseobject.Proxy.execute(baseobject)
|
||||
ss = baseobject.Proxy.sheettag
|
||||
ss.Placement = baseobject.Placement.multiply(ss.Placement)
|
||||
|
||||
output += "G0 Z" + PathUtils.fmt(obj.ClearanceHeight.Value) + "F " + PathUtils.fmt(self.vertRapid) + "\n"
|
||||
for w in ss.Wires:
|
||||
tempedges = PathUtils.cleanedges(w.Edges, 0.5)
|
||||
wires.append(Part.Wire(tempedges))
|
||||
if obj.Algorithm == "OCC Native":
|
||||
output += self.buildpathocc(obj, wires)
|
||||
|
||||
for subobj in baseobject.Group: # process the group of panels
|
||||
if isinstance(subobj.Proxy, ArchPanel.PanelCut):
|
||||
subobj.Proxy.execute(subobj)
|
||||
|
||||
if hasattr(subobj.Proxy, "tag"):
|
||||
ss = subobj.Proxy.tag
|
||||
ss.Placement = subobj.Placement.multiply(ss.Placement)
|
||||
|
||||
output += "G0 Z" + PathUtils.fmt(obj.ClearanceHeight.Value) + "F " + PathUtils.fmt(self.vertRapid) + "\n"
|
||||
for w in ss.Wires:
|
||||
tempedges = PathUtils.cleanedges(w.Edges, 0.5)
|
||||
wires.append(Part.Wire(tempedges))
|
||||
if obj.Algorithm == "OCC Native":
|
||||
output += self.buildpathocc(obj, wires)
|
||||
else:
|
||||
raise ValueError('Unknown baseobject type for engraving')
|
||||
|
||||
output += "G0 Z" + PathUtils.fmt(obj.ClearanceHeight.Value) + "F " + PathUtils.fmt(self.vertRapid) + "\n"
|
||||
for w in ss.Wires:
|
||||
tempedges = PathUtils.cleanedges(w.Edges, 0.5)
|
||||
wires.append(Part.Wire(tempedges))
|
||||
if obj.Algorithm == "OCC Native":
|
||||
output += self.buildpathocc(obj, wires)
|
||||
|
||||
for subobj in baseobject.Group: # process the group of panels
|
||||
if isinstance(subobj.Proxy, ArchPanel.PanelCut):
|
||||
subobj.Proxy.execute(subobj)
|
||||
|
||||
if hasattr(subobj.Proxy, "tag"):
|
||||
ss = subobj.Proxy.tag
|
||||
ss.Placement = subobj.Placement.multiply(ss.Placement)
|
||||
|
||||
output += "G0 Z" + PathUtils.fmt(obj.ClearanceHeight.Value) + "F " + PathUtils.fmt(self.vertRapid) + "\n"
|
||||
for w in ss.Wires:
|
||||
tempedges = PathUtils.cleanedges(w.Edges, 0.5)
|
||||
wires.append(Part.Wire(tempedges))
|
||||
if obj.Algorithm == "OCC Native":
|
||||
output += self.buildpathocc(obj, wires)
|
||||
|
||||
output += "G0 Z" + PathUtils.fmt(obj.ClearanceHeight.Value) + "F " + PathUtils.fmt(self.vertRapid) + "\n"
|
||||
except:
|
||||
FreeCAD.Console.PrintError("The Job Base Object has no engraveable element. Engraving operation will produce no output.")
|
||||
|
||||
# print output
|
||||
if output == "":
|
||||
@@ -248,8 +253,8 @@ class _ViewProviderEngrave:
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
|
||||
def onDelete(self):
|
||||
return None
|
||||
# def onDelete(self):
|
||||
# return None
|
||||
|
||||
|
||||
class CommandPathEngrave:
|
||||
|
||||
@@ -34,8 +34,8 @@ from PySide import QtCore, QtGui
|
||||
import PathScripts.PathLog as PathLog
|
||||
|
||||
LOG_MODULE = 'PathLoadTool'
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, LOG_MODULE)
|
||||
PathLog.trackModule('PathLoadTool')
|
||||
PathLog.setLevel(PathLog.Level.INFO, LOG_MODULE)
|
||||
#PathLog.trackModule('PathLoadTool')
|
||||
|
||||
# Qt tanslation handling
|
||||
try:
|
||||
|
||||
@@ -503,6 +503,7 @@ class CommandPathPocket:
|
||||
FreeCADGui.doCommand('obj.RampSize = 0.75')
|
||||
FreeCADGui.doCommand('obj.HelixSize = 0.75')
|
||||
FreeCADGui.doCommand('PathScripts.PathUtils.addToJob(obj)')
|
||||
FreeCADGui.doCommand('obj.ToolController = PathScripts.PathUtils.findToolController(obj)')
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
@@ -556,7 +557,6 @@ class TaskPanel:
|
||||
self.obj.ZigZagAngle = FreeCAD.Units.Quantity(self.form.zigZagAngle.text()).Value
|
||||
if hasattr(self.obj, "StepOver"):
|
||||
self.obj.StepOver = self.form.stepOverPercent.value()
|
||||
|
||||
if hasattr(self.obj, "ToolController"):
|
||||
PathLog.debug("name: {}".format(self.form.uiToolController.currentText()))
|
||||
tc = PathUtils.findToolController(self.obj, self.form.uiToolController.currentText())
|
||||
|
||||
@@ -556,7 +556,8 @@ class EditorPanel():
|
||||
newtool = tool.copy()
|
||||
obj.Tooltable.setTool(int(toolnum), newtool)
|
||||
obj.ToolNumber = int(toolnum)
|
||||
obj.recompute()
|
||||
#obj.recompute()
|
||||
FreeCAD.ActiveDocument.recompute()
|
||||
|
||||
def getStandardButtons(self):
|
||||
return int(QtGui.QDialogButtonBox.Ok)
|
||||
|
||||
@@ -233,14 +233,25 @@ def findToolController(obj, name=None):
|
||||
if no controller is found, returns None'''
|
||||
|
||||
PathLog.track('name: {}'.format(name))
|
||||
|
||||
#First check if a user has selected a tool controller in the tree.
|
||||
for sel in FreeCADGui.Selection.getSelectionEx():
|
||||
if hasattr(sel.Object, 'Proxy'):
|
||||
if isinstance(sel.Object.Proxy, PathScripts.PathLoadTool.LoadTool):
|
||||
return sel.Object
|
||||
|
||||
controllers = getToolControllers(obj)
|
||||
|
||||
if len(controllers) == 0:
|
||||
return None
|
||||
|
||||
#If there's only one in the job, use it.
|
||||
if len(controllers) == 1:
|
||||
if name is None or name == controllers[0].Label:
|
||||
tc = controllers[0]
|
||||
else:
|
||||
tc = None
|
||||
elif name is not None:
|
||||
elif name is not None: #More than one, make the user choose.
|
||||
tc = [i for i in controllers if i.Label == name][0]
|
||||
else:
|
||||
#form = FreeCADGui.PySideUic.loadUi(FreeCAD.getHomePath() + "Mod/Path/DlgTCChooser.ui")
|
||||
@@ -254,14 +265,6 @@ def findToolController(obj, name=None):
|
||||
tc = [i for i in controllers if i.Label == form.uiToolController.currentText()][0]
|
||||
return tc
|
||||
|
||||
# for c in controllers:
|
||||
# if c.Label == name:
|
||||
# return c
|
||||
# if len(controllers) > 0:
|
||||
# return controllers[0]
|
||||
# else:
|
||||
# return None
|
||||
|
||||
def findParentJob(obj):
|
||||
'''retrieves a parent job object for an operation or other Path object'''
|
||||
PathLog.track()
|
||||
|
||||
Reference in New Issue
Block a user