Path: more bug fixes

This commit is contained in:
sliptonic
2017-03-16 12:30:43 -05:00
committed by Yorik van Havre
parent b0745c96ef
commit d3fb9fbfe2
6 changed files with 123 additions and 119 deletions

View File

@@ -172,8 +172,7 @@ class ObjectPocket:
"""Build the pocket path using libarea algorithm"""
import PathScripts.PathAreaUtils as PathAreaUtils
from PathScripts.PathUtils import depth_params
FreeCAD.Console.PrintMessage(translate("PathPocket", "Generating toolpath with libarea offsets.\n"))
PathLog.debug("Generating toolpath with libarea offsets.\n")
depthparams = depth_params(
obj.ClearanceHeight.Value,
@@ -222,7 +221,7 @@ class ObjectPocket:
import DraftGeomUtils
from PathScripts.PathUtils import fmt, helicalPlunge, rampPlunge, depth_params
FreeCAD.Console.PrintMessage(translate("PathPocket", "Generating toolpath with OCC native offsets.\n"))
PathLog.debug("Generating toolpath with OCC native offsets.\n")
extraoffset = obj.MaterialAllowance.Value
# Build up the offset loops

View File

@@ -203,12 +203,6 @@ print "y - " + str(point.y)
lead_in_line_len = 0.0
lead_out_line_len = 0.0
'''
Right here, I need to know the Holding Tags group from the tree that refers to this profile operation and build up the tags for PathKurve Utils.
I need to access the location vector, length, angle in radians and height.
'''
depthparams = depth_params(
obj.ClearanceHeight.Value,
obj.SafeHeight.Value, obj.StartDepth.Value, obj.StepDown.Value, 0.0,
@@ -244,7 +238,7 @@ print "y - " + str(point.y)
self.radius = tool.Diameter/2
output += "(" + obj.Label + ")"
if obj.Side != "On":
if obj.UseComp:
output += "(Compensated Tool Path. Diameter: " + str(self.radius * 2) + ")"
else:
output += "(Uncompensated Tool Path)"
@@ -386,12 +380,13 @@ class CommandPathProfile:
FreeCADGui.doCommand('obj.SafeHeight = ' + str(ztop + 2.0))
FreeCADGui.doCommand('obj.Side = "Left"')
FreeCADGui.doCommand('obj.OffsetExtra = 0.0')
FreeCADGui.doCommand('obj.Direction = "CCW"')
FreeCADGui.doCommand('obj.UseComp = False')
FreeCADGui.doCommand('obj.Direction = "CW"')
FreeCADGui.doCommand('obj.UseComp = True')
FreeCADGui.doCommand('obj.processHoles = False')
FreeCADGui.doCommand('obj.processPerimeter = True')
FreeCADGui.doCommand('PathScripts.PathProfile._ViewProviderProfile(obj.ViewObject)')
FreeCADGui.doCommand('PathScripts.PathUtils.addToJob(obj)')
FreeCADGui.doCommand('obj.ToolController = PathScripts.PathUtils.findToolController(obj)')
FreeCAD.ActiveDocument.commitTransaction()
FreeCAD.ActiveDocument.recompute()

View File

@@ -188,12 +188,6 @@ print("y - " + str(point.y))
lead_in_line_len = 0.0
lead_out_line_len = 0.0
'''
Right here, I need to know the Holding Tags group from the tree that refers to this profile operation and build up the tags for PathKurve Utils.
I need to access the location vector, length, angle in radians and height.
'''
depthparams = depth_params(
obj.ClearanceHeight.Value,
obj.SafeHeight.Value, obj.StartDepth.Value, obj.StepDown.Value, 0.0,
@@ -228,7 +222,7 @@ print("y - " + str(point.y))
self.radius = tool.Diameter/2
output += "(" + obj.Label + ")"
if obj.Side != "On":
if obj.UseComp:
output += "(Compensated Tool Path. Diameter: " + str(self.radius * 2) + ")"
else:
output += "(Uncompensated Tool Path)"
@@ -358,8 +352,10 @@ class CommandPathProfileEdges:
FreeCADGui.doCommand('obj.Side = "On"')
FreeCADGui.doCommand('obj.OffsetExtra = 0.0')
FreeCADGui.doCommand('obj.Direction = "CW"')
FreeCADGui.doCommand('obj.UseComp = False')
FreeCADGui.doCommand('obj.UseComp = True')
FreeCADGui.doCommand('PathScripts.PathUtils.addToJob(obj)')
FreeCADGui.doCommand('obj.ToolController = PathScripts.PathUtils.findToolController(obj)')
FreeCAD.ActiveDocument.commitTransaction()
FreeCAD.ActiveDocument.recompute()
@@ -451,7 +447,9 @@ class TaskPanel:
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)

View File

@@ -233,12 +233,16 @@ 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.
c = None
#First check if a user has selected a tool controller in the tree. Return the first one and remove all from selection
for sel in FreeCADGui.Selection.getSelectionEx():
if hasattr(sel.Object, 'Proxy'):
if isinstance(sel.Object.Proxy, PathScripts.PathLoadTool.LoadTool):
return sel.Object
if c is None:
c = sel.Object
FreeCADGui.Selection.removeSelection(sel.Object)
if c is not None:
return c
controllers = getToolControllers(obj)