From ddb2001dcbbf234a6b0b03f57994cc7e04291c06 Mon Sep 17 00:00:00 2001 From: sliptonic Date: Sat, 8 Jul 2017 15:50:51 -0500 Subject: [PATCH] Path: Change Profile 'side' enumeration to inside/outside left/right was too ambiguous correct profile direction set --- .../Gui/Resources/panels/ProfileEdgesEdit.ui | 4 +-- .../Path/Gui/Resources/panels/ProfileEdit.ui | 21 ++++++--------- src/Mod/Path/PathScripts/PathHelix.py | 26 +++++++++---------- src/Mod/Path/PathScripts/PathProfile.py | 14 +++++----- src/Mod/Path/PathScripts/PathProfileEdges.py | 6 ++--- 5 files changed, 33 insertions(+), 38 deletions(-) diff --git a/src/Mod/Path/Gui/Resources/panels/ProfileEdgesEdit.ui b/src/Mod/Path/Gui/Resources/panels/ProfileEdgesEdit.ui index 3750b31484..2ef02373ff 100644 --- a/src/Mod/Path/Gui/Resources/panels/ProfileEdgesEdit.ui +++ b/src/Mod/Path/Gui/Resources/panels/ProfileEdgesEdit.ui @@ -294,12 +294,12 @@ - Left + Outside - Right + Inside diff --git a/src/Mod/Path/Gui/Resources/panels/ProfileEdit.ui b/src/Mod/Path/Gui/Resources/panels/ProfileEdit.ui index 16f83d3531..918599d38a 100644 --- a/src/Mod/Path/Gui/Resources/panels/ProfileEdit.ui +++ b/src/Mod/Path/Gui/Resources/panels/ProfileEdit.ui @@ -33,8 +33,8 @@ 0 0 - 381 - 381 + 285 + 277 @@ -111,8 +111,8 @@ 0 0 - 381 - 381 + 120 + 96 @@ -178,8 +178,8 @@ 0 0 - 381 - 381 + 154 + 68 @@ -288,17 +288,12 @@ - Left + Outside - Right - - - - - On + Inside diff --git a/src/Mod/Path/PathScripts/PathHelix.py b/src/Mod/Path/PathScripts/PathHelix.py index 3716521e7e..197b274387 100644 --- a/src/Mod/Path/PathScripts/PathHelix.py +++ b/src/Mod/Path/PathScripts/PathHelix.py @@ -24,13 +24,13 @@ from . import PathUtils from .PathUtils import fmt - +import Part import FreeCAD import Path if FreeCAD.GuiUp: import FreeCADGui from PySide import QtCore, QtGui - from DraftTools import translate + #from DraftTools import translate """Helix Drill object and FreeCAD command""" @@ -86,7 +86,7 @@ def helix_cut(center, r_out, r_in, dr, zmax, zmin, dz, safe_z, tool_diameter, vf tool_diameter: float Width of tool """ - from numpy import ceil, allclose, linspace + from numpy import ceil, linspace if (zmax <= zmin): return @@ -134,7 +134,7 @@ def helix_cut(center, r_out, r_in, dr, zmax, zmin, dz, safe_z, tool_diameter, vf out += rapid(x=x0+r, y=y0) out += rapid(z=zmax + tool_diameter) out += feed(z=zmax, f=vfeed) - z = zmin + # z = zmin for i in range(1, nz+1): out += arc(x0-r, y0, i=-r, j=0.0, z=zi[2*i-1], f=hfeed) out += arc(x0+r, y0, i= r, j=0.0, z=zi[2*i], f=hfeed) @@ -286,9 +286,9 @@ class ObjectPathHelix(object): return None def execute(self, obj): - from Part import Circle, Cylinder, Plane - from PathScripts import PathUtils - from math import sqrt + # from Part import Circle, Cylinder, Plane + # from PathScripts import PathUtils + # from math import sqrt output = '(helix cut operation' if obj.Comment: @@ -332,7 +332,7 @@ class ObjectPathHelix(object): # Find other edge of current cylinder other_edge = None for edge in cylinder.Edges: - if isinstance(edge.Curve, Circle) and edge.Curve.Center.z != cur_z: + if isinstance(edge.Curve, Part.Circle) and edge.Curve.Center.z != cur_z: other_edge = edge break @@ -408,8 +408,8 @@ class ObjectPathHelix(object): output += '\n' obj.Path = Path.Path(output) - if obj.ViewObject: - obj.ViewObject.Visibility = True + # if obj.ViewObject: + # obj.ViewObject.Visibility = True class ViewProviderPathHelix(object): @@ -451,7 +451,7 @@ class CommandPathHelix(object): def Activated(self): import FreeCADGui - import Path + # import Path from PathScripts import PathUtils FreeCAD.ActiveDocument.openTransaction(translate("PathHelix", "Create a helix cut")) @@ -526,7 +526,7 @@ def print_all_exceptions(cls): class TaskPanel(object): def __init__(self, obj): - from Units import Quantity + #from Units import Quantity from PathScripts import PathUtils self.obj = obj @@ -867,5 +867,5 @@ class TaskPanel(object): FreeCADGui.Control.closeDialog() if FreeCAD.GuiUp: - import FreeCADGui + # import FreeCADGui FreeCADGui.addCommand('Path_Helix', CommandPathHelix()) diff --git a/src/Mod/Path/PathScripts/PathProfile.py b/src/Mod/Path/PathScripts/PathProfile.py index bab6bf6481..5f3537b182 100644 --- a/src/Mod/Path/PathScripts/PathProfile.py +++ b/src/Mod/Path/PathScripts/PathProfile.py @@ -77,7 +77,7 @@ class ObjectProfile: # Profile Properties obj.addProperty("App::PropertyEnumeration", "Side", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property", "Side of edge that tool should cut")) - obj.Side = ['Left', 'Right'] # side of profile that cutter is on in relation to direction of profile + obj.Side = ['Inside', 'Outside'] # side of profile that cutter is on in relation to direction of profile obj.addProperty("App::PropertyEnumeration", "Direction", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property", "The direction that the toolpath should go around the part ClockWise CW or CounterClockWise CCW")) obj.Direction = ['CW', 'CCW'] # this is the direction that the profile runs obj.addProperty("App::PropertyBool", "UseComp", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property", "make True, if using Cutter Radius Compensation")) @@ -148,9 +148,9 @@ class ObjectProfile: obj.SafeHeight = 8.0 if bb.XLength == fbb.XLength and bb.YLength == fbb.YLength: - obj.Side = "Left" + obj.Side = "Outside" else: - obj.Side = "Right" + obj.Side = "Inside" item = (ss, sub) if item in baselist: @@ -176,7 +176,7 @@ class ObjectProfile: if obj.UseComp: offsetval = self.radius+obj.OffsetExtra.Value - if obj.Side == 'Right': + if obj.Side == 'Inside': offsetval = 0 - offsetval if isHole: @@ -215,9 +215,9 @@ class ObjectProfile: direction = obj.Direction if direction == 'CCW': - params['orientation'] = 1 - else: params['orientation'] = 0 + else: + params['orientation'] = 1 if obj.UseStartPoint is True and obj.StartPoint is not None: params['start'] = obj.StartPoint @@ -444,7 +444,7 @@ class CommandPathProfile: FreeCADGui.doCommand('obj.FinalDepth=' + str(zbottom)) FreeCADGui.doCommand('obj.SafeHeight = ' + str(ztop + 2.0)) - FreeCADGui.doCommand('obj.Side = "Left"') + FreeCADGui.doCommand('obj.Side = "Outside"') FreeCADGui.doCommand('obj.OffsetExtra = 0.0') FreeCADGui.doCommand('obj.Direction = "CW"') FreeCADGui.doCommand('obj.UseComp = True') diff --git a/src/Mod/Path/PathScripts/PathProfileEdges.py b/src/Mod/Path/PathScripts/PathProfileEdges.py index c1bc5706f7..5b92499aa2 100644 --- a/src/Mod/Path/PathScripts/PathProfileEdges.py +++ b/src/Mod/Path/PathScripts/PathProfileEdges.py @@ -82,7 +82,7 @@ class ObjectProfile: # Profile Properties obj.addProperty("App::PropertyEnumeration", "Side", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property", "Side of edge that tool should cut")) - obj.Side = ['Left', 'Right'] # side of profile that cutter is on in relation to direction of profile + obj.Side = ['Outside', 'Inside'] # side of profile that cutter is on in relation to direction of profile obj.addProperty("App::PropertyEnumeration", "Direction", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property", "The direction that the toolpath should go around the part ClockWise CW or CounterClockWise CCW")) obj.Direction = ['CW', 'CCW'] # this is the direction that the profile runs obj.addProperty("App::PropertyBool", "UseComp", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property", "make True, if using Cutter Radius Compensation")) @@ -163,7 +163,7 @@ class ObjectProfile: 'SectionCount': -1} if obj.UseComp: - if obj.Side == 'Right': + if obj.Side == 'Inside': profileparams['Offset'] = 0 - self.radius+obj.OffsetExtra.Value else: profileparams['Offset'] = self.radius+obj.OffsetExtra.Value @@ -392,7 +392,7 @@ class CommandPathProfileEdges: FreeCADGui.doCommand('obj.FinalDepth=' + str(zbottom)) FreeCADGui.doCommand('obj.SafeHeight = ' + str(ztop + 2.0)) - FreeCADGui.doCommand('obj.Side = "Right"') + FreeCADGui.doCommand('obj.Side = "Inside"') FreeCADGui.doCommand('obj.OffsetExtra = 0.0') FreeCADGui.doCommand('obj.Direction = "CW"') FreeCADGui.doCommand('obj.UseComp = True')