Path: Fix header uniformity and remove trailing whitespace

This PR fixes header uniformity across all Path files. It also removes all trailing whitespace.
This commit is contained in:
luz paz
2020-11-05 19:57:21 +01:00
committed by wwmayer
parent 48365ecdbb
commit b75cd3dd52
231 changed files with 545 additions and 743 deletions
+8 -6
View File
@@ -1,5 +1,7 @@
# /**************************************************************************
# * Copyright (c) Kresimir Tusek ([email protected]) 2018 *
# -*- coding: utf-8 -*-
# ***************************************************************************
# * Copyright (c) 2018 Kresimir Tusek <[email protected]> *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * *
# * This library is free software; you can redistribute it and/or *
@@ -22,7 +24,7 @@
# * Additional modifications and contributions beginning 2019 *
# * by Schildkroet. (https://github.com/Schildkroet) *
# * *
# **************************************************************************/
# ***************************************************************************
import PathScripts.PathOp as PathOp
@@ -136,7 +138,7 @@ def GenerateGCode(op,obj,adaptiveResults, helixDiameter):
# ml: this is dangerous because it'll hide all unused variables hence forward
# however, I don't know wht lx and ly signify so I leave them for now
# however, I don't know what lx and ly signify so I'll leave them for now
# pylint: disable=unused-variable
lx = adaptiveResults[0]["HelixCenterPoint"][0]
ly = adaptiveResults[0]["HelixCenterPoint"][1]
@@ -248,7 +250,7 @@ def GenerateGCode(op,obj,adaptiveResults, helixDiameter):
for pth in region["AdaptivePaths"]:
motionType = pth[0] #[0] contains motion type
for pt in pth[1]: #[1] contains list of points
for pt in pth[1]: #[1] contains list of points
x = pt[0]
y = pt[1]
@@ -468,7 +470,7 @@ class PathAdaptive(PathOp.ObjectOp):
'''opFeatures(obj) ... returns the OR'ed list of features used and supported by the operation.
The default implementation returns "FeatureTool | FeatureDepths | FeatureHeights | FeatureStartPoint"
Should be overwritten by subclasses.'''
return PathOp.FeatureTool | PathOp.FeatureBaseEdges | PathOp.FeatureDepths | PathOp.FeatureFinishDepth | PathOp.FeatureStepDown | PathOp.FeatureHeights | PathOp.FeatureBaseGeometry | PathOp.FeatureCoolant
return PathOp.FeatureTool | PathOp.FeatureBaseEdges | PathOp.FeatureDepths | PathOp.FeatureFinishDepth | PathOp.FeatureStepDown | PathOp.FeatureHeights | PathOp.FeatureBaseGeometry | PathOp.FeatureCoolant
def initOperation(self, obj):
'''initOperation(obj) ... implement to create additional properties.
+5 -3
View File
@@ -1,5 +1,7 @@
# /**************************************************************************
# * Copyright (c) Kresimir Tusek ([email protected]) 2018 *
# -*- coding: utf-8 -*-
# ***************************************************************************
# * Copyright (c) 2018 Kresimir Tusek <[email protected]> *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * *
# * This library is free software; you can redistribute it and/or *
@@ -17,7 +19,7 @@
# * write to the Free Software Foundation, Inc., 59 Temple Place, *
# * Suite 330, Boston, MA 02111-1307, USA *
# * *
# ***************************************************************************/
# ***************************************************************************
import PathScripts.PathOpGui as PathOpGui
from PySide import QtCore, QtGui
+1 -3
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -41,7 +39,7 @@ if FreeCAD.GuiUp:
__title__ = "Base class for PathArea based operations."
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Base class and properties for Path.Area based operations."
LOGLEVEL = PathLog.Level.INFO
-2
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2015 Yorik van Havre <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -31,7 +29,7 @@ from PySide import QtCore, QtGui
__title__ = "Base for Circular Hole based operations' UI"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Implementation of circular hole specific base geometry page controller."
LOGLEVEL = False
+1 -3
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -39,7 +37,7 @@ def translate(context, text, disambig=None):
__title__ = "Path Collision Utility"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
"""Path Collision object and FreeCAD command"""
+2 -3
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2015 Dan Falck <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -21,7 +19,8 @@
# * USA *
# * *
# ***************************************************************************
''' Used for CNC machine comments for Path module. Create a comment and place it in the Document tree.'''
'''Used for CNC machine comments for Path module. Create a comment and place it in the Document tree.'''
import FreeCAD
import FreeCADGui
-2
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2014 Yorik van Havre <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
-1
View File
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2014 Yorik van Havre <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
-2
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2018 sliptonic <[email protected]> *
# * Copyright (c) 2020 Schildkroet *
# * *
+1 -3
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2018 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -33,7 +31,7 @@ from PySide import QtCore, QtGui
__title__ = "Path Deburr Operation UI"
__author__ = "sliptonic (Brad Collette), Schildkroet"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Deburr operation page controller and command implementation."
LOGLEVEL = False
-2
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2018 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2018 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -21,6 +19,7 @@
# * USA *
# * *
# ***************************************************************************
import FreeCAD
import Path
import math
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2014 Yorik van Havre <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -21,6 +19,7 @@
# * USA *
# * *
# ***************************************************************************
from __future__ import print_function
import FreeCAD
import math
@@ -422,7 +421,7 @@ class ObjectDressup:
def onDocumentRestored(self, obj):
obj.setEditorMode('BoneBlacklist', 2) # hide this one
def __getstate__(self):
return None
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2014 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -21,6 +19,7 @@
# * USA *
# * *
# ***************************************************************************
import FreeCAD
import Path
import PathScripts.PathDressup as PathDressup
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 LTS <[email protected]> under LGPL *
# * Copyright (c) 2020 Schildkroet *
# * *
@@ -74,7 +72,7 @@ class ObjectDressup:
obj.addProperty("App::PropertyDistance", "ExtendLeadOut", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property", "Extends LeadOut distance"))
obj.addProperty("App::PropertyBool", "RapidPlunge", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property", "Perform plunges with G0"))
obj.addProperty("App::PropertyBool", "IncludeLayers", "Path", QtCore.QT_TRANSLATE_NOOP("App::Property", "Apply LeadInOut to layers within an operation"))
self.wire = None
self.rapids = None
@@ -123,12 +121,12 @@ class ObjectDressup:
if hasattr(op, 'Direction') and op.Direction == 'CW':
return 'right'
return 'left'
def getSideOfPath(self, obj):
op = PathDressup.baseOp(obj.Base)
if hasattr(op, 'Side'):
return op.Side
return ''
def normalize(self, Vector):
@@ -139,19 +137,19 @@ class ObjectDressup:
vx = round(x / length, 3)
vy = round(y / length, 3)
return FreeCAD.Vector(vx, vy, 0)
def invert(self, Vector):
x = Vector.x * -1
y = Vector.y * -1
z = Vector.z * -1
return FreeCAD.Vector(x, y, z)
def multiply(self, Vector, len):
x = Vector.x * len
y = Vector.y * len
z = Vector.z * len
return FreeCAD.Vector(x, y, z)
def rotate(self, Vector, angle):
s = math.sin(math.radians(angle))
c = math.cos(math.radians(angle))
@@ -186,7 +184,7 @@ class ObjectDressup:
p1 = queue[1].Placement.Base
v = self.normalize(p1.sub(p0))
# PathLog.debug(" CURRENT_IN ARC : P0 X:{} Y:{} P1 X:{} Y:{} ".format(p0.x,p0.y,p1.x,p1.y))
# Calculate offset vector (will be overwritten for arcs)
if self.getDirectionOfPath(obj) == 'right':
off_v = FreeCAD.Vector(v.y*R, -v.x*R, 0.0)
@@ -207,36 +205,36 @@ class ObjectDressup:
pij = copy.deepcopy(p0)
pij.x += queue[1].Parameters['I']
pij.y += queue[1].Parameters['J']
# Check if lead in and operation go in same direction (usually for inner circles)
if arcdir == queue[1].Name:
arcs_identical = True
# Calculate vector circle start -> circle middle
vec_circ = pij.sub(p0)
# Rotate vector to get direction for lead in
if arcdir == "G2":
vec_rot = self.rotate(vec_circ, 90)
else:
vec_rot = self.rotate(vec_circ, -90)
# Normalize and invert vector
vec_n = self.normalize(vec_rot)
v = self.invert(vec_n)
# Calculate offset of lead in
if arcdir == "G3":
off_v = FreeCAD.Vector(-v.y*R, v.x*R, 0.0)
else:
off_v = FreeCAD.Vector(v.y*R, -v.x*R, 0.0)
# Multiply offset by LeadIn length
vec_off = self.multiply(vec_n, obj.ExtendLeadIn)
offsetvector = FreeCAD.Vector(v.x*R-vec_off.x, v.y*R-vec_off.y, 0) # IJ
if obj.RadiusCenter == 'Radius':
leadstart = (p0.add(off_v)).sub(offsetvector) # Rmode
if arcs_identical:
@@ -254,27 +252,27 @@ class ObjectDressup:
results.append(extendcommand)
extendcommand = Path.Command('G0', {"Z": op.SafeHeight.Value})
results.append(extendcommand)
if action == 'layer':
if not obj.KeepToolDown:
extendcommand = Path.Command('G0', {"Z": op.SafeHeight.Value})
results.append(extendcommand)
extendcommand = Path.Command('G0', {"X": leadstart.x, "Y": leadstart.y})
results.append(extendcommand)
if not obj.RapidPlunge:
extendcommand = Path.Command('G1', {"X": leadstart.x, "Y": leadstart.y, "Z": p1.z, "F": vertFeed})
else:
extendcommand = Path.Command('G0', {"X": leadstart.x, "Y": leadstart.y, "Z": p1.z,})
results.append(extendcommand)
if obj.UseMachineCRC:
if self.getDirectionOfPath(obj) == 'right':
results.append(Path.Command('G42', {'D': toolnummer}))
else:
results.append(Path.Command('G41', {'D': toolnummer}))
if obj.StyleOn == 'Arc':
arcmove = Path.Command(arcdir, {"X": p0.x+vec_off.x, "Y": p0.y+vec_off.y, "I": offsetvector.x+vec_off.x, "J": offsetvector.y+vec_off.y, "F": horizFeed}) # add G2/G3 move
results.append(arcmove)
@@ -286,10 +284,10 @@ class ObjectDressup:
results.append(extendcommand)
else:
PathLog.debug(" CURRENT_IN Perp")
currLocation.update(results[-1].Parameters)
currLocation['Z'] = p1.z
return results
def getLeadEnd(self, obj, queue, action):
@@ -299,13 +297,13 @@ class ObjectDressup:
horizFeed = PathDressup.toolController(obj.Base).HorizFeed.Value
R = obj.Length.Value # Radius of roll or length
arcs_identical = False
# Set the correct twist command
if self.getDirectionOfPath(obj) == 'right':
arcdir = "G2"
else:
arcdir = "G3"
if queue[1].Name == "G1": # line
p0 = queue[0].Placement.Base
p1 = queue[1].Placement.Base
@@ -314,12 +312,12 @@ class ObjectDressup:
p0 = queue[0].Placement.Base
p1 = queue[1].Placement.Base
v = self.normalize(p1.sub(p0))
if self.getDirectionOfPath(obj) == 'right':
off_v = FreeCAD.Vector(v.y*R, -v.x*R, 0.0)
else:
off_v = FreeCAD.Vector(-v.y*R, v.x*R, 0.0)
# Check if we leave at line or arc command
if queue[1].Name in movecommands and queue[1].Name not in arccommands:
# We have a line move
@@ -334,27 +332,27 @@ class ObjectDressup:
pij.x += queue[1].Parameters['I']
pij.y += queue[1].Parameters['J']
ve = pij.sub(p1)
if arcdir == queue[1].Name:
arcs_identical = True
if arcdir == "G2":
vec_rot = self.rotate(ve, -90)
else:
vec_rot = self.rotate(ve, 90)
vec_n = self.normalize(vec_rot)
v = vec_n
if arcdir == "G3":
off_v = FreeCAD.Vector(-v.y*R, v.x*R, 0.0)
else:
off_v = FreeCAD.Vector(v.y*R, -v.x*R, 0.0)
vec_inv = self.invert(vec_rot)
vec_off = self.multiply(vec_inv, obj.ExtendLeadOut)
offsetvector = FreeCAD.Vector(v.x*R-vec_off.x, v.y*R-vec_off.y, 0.0)
if obj.RadiusCenter == 'Radius':
leadend = (p1.add(off_v)).add(offsetvector) # Rmode
@@ -365,7 +363,7 @@ class ObjectDressup:
off_v = self.multiply(off_v, -1)
else:
leadend = p1.add(off_v) # Dmode
IJ = off_v # .negative()
#results.append(queue[1])
if obj.StyleOff == 'Arc':
@@ -379,10 +377,10 @@ class ObjectDressup:
results.append(extendcommand)
else:
PathLog.debug(" CURRENT_IN Perp")
if obj.UseMachineCRC: # crc off
results.append(Path.Command('G40', {}))
return results
def generateLeadInOutCurve(self, obj):
@@ -395,7 +393,7 @@ class ObjectDressup:
action = 'start'
prevCmd = ''
layers = []
# Read in all commands
for curCommand in obj.Base.Path.Commands:
#PathLog.debug("CurCMD: {}".format(curCommand))
@@ -403,13 +401,13 @@ class ObjectDressup:
# Don't worry about non-move commands, just add to output
newpath.append(curCommand)
continue
if curCommand.Name in rapidcommands:
# We don't care about rapid moves
prevCmd = curCommand
currLocation.update(curCommand.Parameters)
continue
if curCommand.Name in movecommands:
if prevCmd.Name in rapidcommands and curCommand.Name in movecommands and len(queue) > 0:
# Layer changed: Save current layer cmds and prepare next layer
@@ -420,48 +418,48 @@ class ObjectDressup:
#PathLog.debug("Layer change in move: {}->{}".format(currLocation['Z'], curCommand.z))
layers.append(queue)
queue = []
# Save all move commands
queue.append(curCommand)
currLocation.update(curCommand.Parameters)
prevCmd = curCommand
# Add last layer
if len(queue) > 0:
layers.append(queue)
queue = []
# Go through each layer and add leadIn/Out
idx = 0
for layer in layers:
#PathLog.debug("Layer {}".format(idx))
if obj.LeadIn:
temp = self.getLeadStart(obj, layer, action)
newpath.extend(temp)
for cmd in layer:
#PathLog.debug("CurLoc: {}, NewCmd: {}".format(currLocation, cmd))
#if currLocation['X'] == cmd.x and currLocation['Y'] == cmd.y and currLocation['Z'] == cmd.z and cmd.Name in ['G1', 'G01']:
#continue
newpath.append(cmd)
if obj.LeadOut:
tmp = []
tmp.append(layer[-2])
tmp.append(layer[-1])
temp = self.getLeadEnd(obj, tmp, action)
newpath.extend(temp)
if not obj.KeepToolDown or idx == len(layers)-1:
extendcommand = Path.Command('G0', {"Z": op.ClearanceHeight.Value})
newpath.append(extendcommand)
else:
action = 'layer'
idx += 1
commands = newpath
return Path.Path(commands)
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2019 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -89,7 +87,7 @@ class DressupPathBoundary(object):
if begin.z < self.clearanceHeight:
cmds.append(self.strG0ZclearanceHeight)
if end:
cmds.append(Path.Command('G0', {'X': end.x, 'Y': end.y}))
cmds.append(Path.Command('G0', {'X': end.x, 'Y': end.y}))
if end.z < self.clearanceHeight:
cmds.append(Path.Command('G0', {'Z': max(self.safeHeight, end.z)}))
if end.z < self.safeHeight:
@@ -109,8 +107,8 @@ class DressupPathBoundary(object):
self.strG0ZclearanceHeight = Path.Command('G0', {'Z': self.clearanceHeight})
boundary = obj.Stock.Shape
cmd = obj.Base.Path.Commands[0]
pos = cmd.Placement.Base # bogus m/c position to create first edge
cmd = obj.Base.Path.Commands[0]
pos = cmd.Placement.Base # bogus m/c position to create first edge
bogusX = True
bogusY = True
commands = [cmd]
@@ -136,7 +134,7 @@ class DressupPathBoundary(object):
# cmd fully included by boundary
if lastExit:
if not ( bogusX or bogusY ) : # don't insert false paths based on bogus m/c position
commands.extend(self.boundaryCommands(obj, lastExit, pos, tc.VertFeed.Value))
commands.extend(self.boundaryCommands(obj, lastExit, pos, tc.VertFeed.Value))
lastExit = None
commands.append(cmd)
pos = PathGeom.commandEndPoint(cmd, pos)
@@ -164,7 +162,7 @@ class DressupPathBoundary(object):
lastExit = None
PathLog.track(e, flip)
if not ( bogusX or bogusY ) : # don't insert false paths based on bogus m/c position
commands.extend(PathGeom.cmdsForEdge(e, flip, False, 50, tc.HorizFeed.Value, tc.VertFeed.Value))
commands.extend(PathGeom.cmdsForEdge(e, flip, False, 50, tc.HorizFeed.Value, tc.VertFeed.Value))
inside.remove(e)
pos = newPos
lastExit = newPos
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2019 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -21,6 +19,7 @@
# * USA *
# * *
# ***************************************************************************
import FreeCAD
import FreeCADGui
import PathScripts.PathDressupPathBoundary as PathDressupPathBoundary
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 Pekka Roivainen <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -21,6 +19,7 @@
# * USA *
# * *
# ***************************************************************************
import FreeCAD
import Path
import PathScripts.PathDressup as PathDressup
+1 -2
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -21,6 +19,7 @@
# * USA *
# * *
# ***************************************************************************
import FreeCAD
import PathScripts.PathDressup as PathDressup
import PathScripts.PathGeom as PathGeom
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -21,6 +19,7 @@
# * USA *
# * *
# ***************************************************************************
import FreeCAD
import FreeCADGui
import PathScripts.PathGeom as PathGeom
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*
# ***************************************************************************
# * *
# * Copyright (c) 2018 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
+3 -5
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2014 Yorik van Havre <[email protected]> *
# * Copyright (c) 2020 russ4262 (Russell Johnson) *
# * Copyright (c) 2020 Schildkroet *
@@ -43,7 +41,7 @@ from PySide import QtCore
__title__ = "Path Drilling Operation"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Path Drilling operation."
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
@@ -227,9 +225,9 @@ def Create(name, obj=None):
'''Create(name) ... Creates and returns a Drilling operation.'''
if obj is None:
obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name)
obj.Proxy = ObjectDrilling(obj, name)
if obj.Proxy:
obj.Proxy.findAllHoles(obj)
return obj
+8 -10
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -34,7 +32,7 @@ from PySide import QtCore
__title__ = "Path Drilling Operation UI."
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "UI and Command for Path Drilling Operation."
__contributors__ = "IMBack!"
@@ -49,24 +47,24 @@ else:
class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage):
'''Controller for the drilling operation's page'''
def initPage(self, obj):
# pylint: disable=attribute-defined-outside-init
self.peckDepthSpinBox = PathGui.QuantitySpinBox(self.form.peckDepth, obj, 'PeckDepth')
self.peckRetractSpinBox = PathGui.QuantitySpinBox(self.form.peckRetractHeight, obj, 'RetractHeight')
self.dwellTimeSpinBox = PathGui.QuantitySpinBox(self.form.dwellTime, obj, 'DwellTime')
def registerSignalHandlers(self, obj):
self.form.peckEnabled.toggled.connect(self.form.peckDepth.setEnabled)
self.form.peckEnabled.toggled.connect(self.form.dwellEnabled.setDisabled)
self.form.dwellEnabled.toggled.connect(self.form.dwellTime.setEnabled)
self.form.dwellEnabled.toggled.connect(self.form.dwellTimelabel.setEnabled)
self.form.dwellEnabled.toggled.connect(self.form.peckEnabled.setDisabled)
self.form.peckRetractHeight.setEnabled(True)
self.form.retractLabel.setEnabled(True)
if self.form.peckEnabled.isChecked():
self.form.dwellEnabled.setEnabled(False)
self.form.peckDepth.setEnabled(True)
@@ -79,7 +77,7 @@ class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage):
def getForm(self):
'''getForm() ... return UI'''
return FreeCADGui.PySideUic.loadUi(":/panels/PageOpDrillingEdit.ui")
def updateQuantitySpinBoxes(self, index = None):
# pylint: disable=unused-argument
self.peckDepthSpinBox.updateSpinBox()
@@ -142,7 +140,7 @@ class TaskPanelOpPage(PathCircularHoleBaseGui.TaskPanelOpPage):
signals.append(self.form.enableRotation.currentIndexChanged)
return signals
def updateData(self, obj, prop):
if prop in ['PeckDepth', 'RetractHeight'] and not prop in ['Base', 'Disabled']:
self.updateQuantitySpinBoxes()
+1 -3
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2014 Yorik van Havre <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -56,7 +54,7 @@ class ObjectEngrave(PathEngraveBase.ObjectOp):
def opFeatures(self, obj):
'''opFeatures(obj) ... return all standard features and edges based geomtries'''
return PathOp.FeatureTool | PathOp.FeatureDepths | PathOp.FeatureHeights | PathOp.FeatureStepDown | PathOp.FeatureBaseEdges | PathOp.FeatureCoolant
return PathOp.FeatureTool | PathOp.FeatureDepths | PathOp.FeatureHeights | PathOp.FeatureStepDown | PathOp.FeatureBaseEdges | PathOp.FeatureCoolant
def setupAdditionalProperties(self, obj):
if not hasattr(obj, 'BaseShapes'):
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2018 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
+1 -3
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -33,7 +31,7 @@ from PySide import QtCore, QtGui
__title__ = "Path Engrave Operation UI"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Engrave operation page controller and command implementation."
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
+1 -1
View File
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2015 Dan Falck <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -20,6 +19,7 @@
# * USA *
# * *
# ***************************************************************************
''' Used to create CNC machine fixture offsets such as G54,G55, etc...'''
import FreeCAD
+1 -3
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2016 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -36,7 +34,7 @@ Part = LazyLoader('Part', globals(), 'Part')
__title__ = "PathGeom - geometry utilities for Path"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Functions to extract and convert between Path.Command and Part.Edge and utility functions to reason about them."
Tolerance = 0.000001
+1 -3
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -35,7 +33,7 @@ from pivy import coin
__title__ = "Path GetPoint UI"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Helper class to use FreeCADGUi.Snapper to let the user enter arbitrary points while the task panel is active."
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
+1 -3
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -31,7 +29,7 @@ import PySide
__title__ = "Path UI helper and utility functions"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "A collection of helper and utility functions for the Path GUI."
def translate(context, text, disambig=None):
-2
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2018 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
+1 -3
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2016 Lorenz Hüdepohl <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -36,7 +34,7 @@ from PySide import QtCore
__title__ = "Path Helix Drill Operation"
__author__ = "Lorenz Hüdepohl"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Class and implementation of Helix Drill operation"
__contributors__ = "russ4262 (Russell Johnson)"
__created__ = "2016"
-2
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
-2
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2014 Yorik van Havre <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -28,7 +26,7 @@ import importlib
__title__ = "Path Icon ViewProvider"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "ViewProvider who's main and only task is to assign an icon."
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
+7 -6
View File
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * (c) Yorik van Havre ([email protected]) 2015 *
# * Copyright (c) 2015 Yorik van Havre <[email protected]> *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * *
@@ -19,7 +20,7 @@
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
# * USA *
# * *
# ***************************************************************************/
# ***************************************************************************
from PySide import QtCore, QtGui
@@ -191,19 +192,19 @@ class GCodeEditorDialog(QtGui.QDialog):
def show(obj):
"show(obj): shows the G-code data of the given Path object in a dialog"
prefs = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Path")
# default Max Highlighter Size = 512 Ko
defaultMHS = 512 * 1024
defaultMHS = 512 * 1024
mhs = prefs.GetUnsigned('inspecteditorMaxHighlighterSize', defaultMHS)
if hasattr(obj, "Path"):
if obj.Path:
dia = GCodeEditorDialog(obj.Path)
dia.editor.setText(obj.Path.toGCode())
gcodeSize = len(dia.editor.toPlainText())
if (gcodeSize <= mhs):
# because of poor performance, syntax highlighting is
# because of poor performance, syntax highlighting is
# limited to mhs octets (default 512 KB).
# It seems than the response time curve has an inflexion near 500 KB
# beyond 500 KB, the response time increases exponentially.
-2
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2014 Yorik van Havre <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
+1 -4
View File
@@ -1,7 +1,4 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -129,7 +126,7 @@ class CommandJobTemplateExport:
"Path - Job Template",
PathPreferences.filePath(),
"job_*.json")[0]
if foo:
if foo:
if not os.path.basename(foo).startswith('job_'):
foo = os.path.join(os.path.dirname(foo), 'job_' + os.path.basename(foo))
if not foo.endswith('.json'):
-2
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2018 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
-2
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
-2
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2016 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
+1 -3
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2016 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -38,7 +36,7 @@ Part = LazyLoader('Part', globals(), 'Part')
__title__ = "Path Mill Face Operation"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Class and implementation of Mill Facing operation."
__contributors__ = "russ4262 (Russell Johnson)"
+1 -3
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -31,7 +29,7 @@ from PySide import QtCore
__title__ = "Path Face Mill Operation UI"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Face Mill operation page controller and command implementation."
class TaskPanelOpPage(PathPocketBaseGui.TaskPanelOpPage):
+1 -3
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -39,7 +37,7 @@ Part = LazyLoader('Part', globals(), 'Part')
__title__ = "Base class for all operations."
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Base class and properties implementation for all Path operations."
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
+3 -5
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -40,7 +38,7 @@ from PySide import QtCore, QtGui
__title__ = "Path Operation UI base classes"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Base classes and framework for Path operation's UI"
LOGLEVEL = False
@@ -1019,13 +1017,13 @@ class TaskPanel(object):
self.featurePages.append(opPage.taskPanelHeightsPage(obj, features))
else:
self.featurePages.append(TaskPanelHeightsPage(obj, features))
if PathOp.FeatureDiameters & features:
if hasattr(opPage, 'taskPanelDiametersPage'):
self.featurePages.append(opPage.taskPanelDiametersPage(obj, features))
else:
self.featurePages.append(TaskPanelDiametersPage(obj, features))
self.featurePages.append(opPage)
for page in self.featurePages:
+2 -4
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2018 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -35,7 +33,7 @@ Part = LazyLoader('Part', globals(), 'Part')
__title__ = "PathOpTools - Tools for Path operations."
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Collection of functions used by various Path operations. The functions are specific to Path and the algorithms employed by Path's operations."
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
@@ -157,7 +155,7 @@ def offsetWire(wire, base, offset, forward):#, Side = None):
curve = edge.Curve
if Part.Circle == type(curve) and wire.isClosed():
# it's a full circle and there are some problems with that, see
# http://www.freecadweb.org/wiki/Part%20Offset2D
# https://www.freecadweb.org/wiki/Part%20Offset2D
# it's easy to construct them manually though
z = -1 if forward else 1
edge = Part.makeCircle(curve.Radius + offset, curve.Center, FreeCAD.Vector(0, 0, z))
+1 -2
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2015 Dan Falck <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -21,6 +19,7 @@
# * USA *
# * *
# ***************************************************************************
''' Used for CNC machine plane selection G17,G18,G19 '''
import FreeCAD
+1 -3
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2014 Yorik van Havre <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -36,7 +34,7 @@ Part = LazyLoader('Part', globals(), 'Part')
__title__ = "Path 3D Pocket Operation"
__author__ = "Yorik van Havre <[email protected]>"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Class and implementation of the 3D Pocket operation."
__contributors__ = "russ4262 (Russell Johnson)"
__created__ = "2014"
+1 -3
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * Copyright (c) 2020 russ4262 (Russell Johnson) *
# * *
@@ -31,7 +29,7 @@ from PySide import QtCore
__title__ = "Base Path Pocket Operation"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Base class and implementation for Path pocket operations."
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -31,7 +29,7 @@ from PySide import QtCore #, QtGui
__title__ = "Path Pocket Base Operation UI"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Base page controller and command implementation for path pocket operations."
def translate(context, text, disambig=None):
+1 -3
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -31,7 +29,7 @@ from PySide import QtCore
__title__ = "Path Pocket Operation UI"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Pocket operation page controller and command implementation."
class TaskPanelOpPage(PathPocketBaseGui.TaskPanelOpPage):
+3 -5
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * Copyright (c) 2020 Schildkroet *
# * *
@@ -41,7 +39,7 @@ from PySide import QtCore
__title__ = "Path Pocket Shape Operation"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Class and implementation of shape based Pocket operation."
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
@@ -674,7 +672,7 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
else:
face.translate(FreeCAD.Vector(0.0, 0.0, -1 * clrnc))
PathLog.debug('self.horizontal post-shpZMin: {}'.format(shpZMin))
if obj.LimitDepthToFace is True and obj.EnableRotation != 'Off':
if shpZMinVal > obj.FinalDepth.Value:
PathLog.debug('shpZMin > obj.FinalDepth.Value')
@@ -693,7 +691,7 @@ class ObjectPocket(PathPocketBase.ObjectPocket):
round(start_dep - zDestination, 6)):
shpZMin = -1 * shpZMin
face.translate(FreeCAD.Vector(0, 0, translation))
extent = FreeCAD.Vector(0, 0, abs(start_dep - shpZMin) + clrnc) # adj_final_dep + clrnc)
extShp = face.removeSplitter().extrude(extent)
self.removalshapes.append((extShp, False, 'pathPocketShape', useAngle, axis, start_dep, adj_final_dep))
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -40,7 +38,7 @@ Part = LazyLoader('Part', globals(), 'Part')
__title__ = "Path Pocket Shape Operation UI"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Pocket Shape operation page controller and command implementation."
def translate(context, text, disambig=None):
+1 -2
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2015 Dan Falck <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -21,6 +19,7 @@
# * USA *
# * *
# ***************************************************************************
''' Post Process command that will make use of the Output File and Post Processor entries in PathJob '''
from __future__ import print_function
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2014 Yorik van Havre <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
+5 -7
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2014 Yorik van Havre <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -210,7 +208,7 @@ def defaultOutputPolicy():
def defaultStockTemplate():
return preferences().GetString(DefaultStockTemplate, "")
def setDefaultStockTemplate(template):
preferences().SetString(DefaultStockTemplate, template)
@@ -225,24 +223,24 @@ def experimentalFeaturesEnabled():
def lastPathToolBit():
return preferences().GetString(LastPathToolBit, pathDefaultToolsPath('Bit'))
def setLastPathToolBit(path):
return preferences().SetString(LastPathToolBit, path)
def lastPathToolLibrary():
return preferences().GetString(LastPathToolLibrary, pathDefaultToolsPath('Library'))
def setLastPathToolLibrary(path):
return preferences().SetString(LastPathToolLibrary, path)
def lastPathToolShape():
return preferences().GetString(LastPathToolShape, pathDefaultToolsPath('Shape'))
def setLastPathToolShape(path):
return preferences().SetString(LastPathToolShape, path)
def lastPathToolTable():
return preferences().GetString(LastPathToolTable, "")
def setLastPathToolTable(table):
return preferences().SetString(LastPathToolTable, table)
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2016 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2014 Yorik van Havre <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -218,7 +216,7 @@ class JobPreferencesPage:
rotZ = attrs.get('rotZ')
rotW = attrs.get('rotW')
if posX is not None and posY is not None and posZ is not None and rotX is not None and rotY is not None and rotZ is not None and rotW is not None:
pos = FreeCAD.Vector(float(posX), float(posY), float(posZ))
pos = FreeCAD.Vector(float(posX), float(posY), float(posZ))
rot = FreeCAD.Rotation(float(rotX), float(rotY), float(rotZ), float(rotW))
placement = FreeCAD.Placement(pos, rot)
self.form.stockPlacementGroup.setChecked(True)
-2
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2018 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
-2
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
+1 -3
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2014 Yorik van Havre <[email protected]> *
# * Copyright (c) 2016 sliptonic <[email protected]> *
# * Copyright (c) 2020 Schildkroet *
@@ -570,7 +568,7 @@ class ObjectProfile(PathAreaOp.ObjectOp):
angle -= 180.0
if rtn is True:
PathLog.debug(translate("Path", "Face appears misaligned after initial rotation."))
PathLog.debug(translate("Path", "Face appears misaligned after initial rotation."))
if obj.AttemptInverseAngle is True:
PathLog.debug(translate("Path", "Applying inverse angle automatically."))
(clnBase, clnStock, angle) = self.applyInverseAngle(obj, clnBase, clnStock, axis, angle)
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2016 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -29,7 +27,7 @@ import PathScripts.PathProfile as PathProfile
__title__ = "Path Contour Operation (depreciated)"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Implementation of the Contour operation (depreciated)."
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -32,12 +30,12 @@ from PySide import QtCore
__title__ = "Path Contour Operation UI (depreciated)"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Contour operation page controller and command implementation (depreciated)."
class TaskPanelOpPage(PathProfileGui.TaskPanelOpPage):
'''Psuedo page controller class for Profile operation,
'''Psuedo page controller class for Profile operation,
allowing for backward compatibility with pre-existing "Contour" operations.'''
pass
# Eclass
+1 -3
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2016 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -29,7 +27,7 @@ import PathScripts.PathProfile as PathProfile
__title__ = "Path Profile Edges Operation (depreciated)"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Path Profile operation based on edges (depreciated)."
__contributors__ = "russ4262 (Russell Johnson)"
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -32,12 +30,12 @@ from PySide import QtCore
__title__ = "Path Profile Edges Operation UI (depreciated)"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Profile Edges operation page controller and command implementation (depreciated)."
class TaskPanelOpPage(PathProfileGui.TaskPanelOpPage):
'''Psuedo page controller class for Profile operation,
'''Psuedo page controller class for Profile operation,
allowing for backward compatibility with pre-existing "Profile Edges" operations.'''
pass
# Eclass
+1 -3
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2014 Yorik van Havre <[email protected]> *
# * Copyright (c) 2020 Schildkroet *
# * *
@@ -30,7 +28,7 @@ import PathScripts.PathProfile as PathProfile
__title__ = "Path Profile Faces Operation (depreciated)"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Path Profile operation based on faces (depreciated)."
__contributors__ = "Schildkroet"
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -32,12 +30,12 @@ from PySide import QtCore
__title__ = "Path Profile Faces Operation UI (depreciated)"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Profile Faces operation page controller and command implementation (depreciated)."
class TaskPanelOpPage(PathProfileGui.TaskPanelOpPage):
'''Psuedo page controller class for Profile operation,
'''Psuedo page controller class for Profile operation,
allowing for backward compatibility with pre-existing "Profile Faces" operations.'''
pass
# Eclass
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
+1 -1
View File
@@ -1,5 +1,5 @@
# ***************************************************************************
# * (c) Sliptonic ([email protected]) 2016 *
# * Copyright (c) 2016 sliptonic <[email protected]> *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * *
+1 -2
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2015 Dan Falck <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -21,6 +19,7 @@
# * USA *
# * *
# ***************************************************************************
'''Selection gates and observers to control selectability while building Path operations '''
import FreeCAD
+5 -7
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -31,7 +29,7 @@ import PySide
__title__ = "Setup Sheet for a Job."
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "A container for all default values and job specific configuration values."
_RegisteredOps = {}
@@ -82,7 +80,7 @@ class SetupSheet:
TemplateReference = '${SetupSheet}'
DefaultSafeHeightOffset = '3 mm'
DefaultClearanceHeightOffset = '5 mm'
DefaultClearanceHeightOffset = '5 mm'
DefaultSafeHeightExpression = "OpStockZMax+${SetupSheet}.SafeHeightOffset"
DefaultClearanceHeightExpression = "OpStockZMax+${SetupSheet}.ClearanceHeightOffset"
@@ -90,8 +88,8 @@ class SetupSheet:
DefaultFinalDepthExpression = 'OpFinalDepth'
DefaultStepDownExpression = 'OpToolDiameter'
DefaultCoolantModes = ['None', 'Flood', 'Mist']
DefaultCoolantModes = ['None', 'Flood', 'Mist']
def __init__(self, obj):
self.obj = obj
obj.addProperty('App::PropertySpeed', 'VertRapid', 'ToolController', translate('PathSetupSheet', 'Default speed for horizontal rapid moves.'))
@@ -273,7 +271,7 @@ class SetupSheet:
if not hasattr(obj, 'CoolantModes'):
obj.addProperty('App::PropertyStringList', 'CoolantModes', 'CoolantMode', translate('PathSetupSheet', 'Coolant Modes'))
obj.CoolantModes = self.DefaultCoolantModes
if not hasattr(obj, 'CoolantMode'):
obj.addProperty('App::PropertyEnumeration', 'CoolantMode', 'CoolantMode', translate('PathSetupSheet', 'Default coolant mode.'))
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2018 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -36,7 +34,7 @@ from PySide import QtCore, QtGui
__title__ = "Setup Sheet Editor"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Task panel editor for a SetupSheet"
# Qt translation handling
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2018 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -26,7 +24,7 @@ import PathScripts.PathLog as PathLog
__title__ = "Setup Sheet for a Job."
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Prototype objects to allow extraction of setup sheet values and editing."
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2018 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -30,7 +28,7 @@ from PySide import QtCore, QtGui
__title__ = "Setup Sheet Editor"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Task panel editor for a SetupSheet"
# Qt translation handling
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2015 Yorik van Havre <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -1,3 +1,25 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * Copyright (c) 2017 Shai Seger <shaise at gmail> *
# * *
# * This program is free software; you can redistribute it and/or modify *
# * it under the terms of the GNU Lesser General Public License (LGPL) *
# * as published by the Free Software Foundation; either version 2 of *
# * the License, or (at your option) any later version. *
# * for detail see the LICENCE text file. *
# * *
# * This program is distributed in the hope that it will be useful, *
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
# * GNU Library General Public License for more details. *
# * *
# * You should have received a copy of the GNU Library General Public *
# * License along with this program; if not, write to the Free Software *
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
# * USA *
# * *
# ***************************************************************************
import FreeCAD
import Path
import PathScripts.PathDressup as PathDressup
-2
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2020 Russell Johnson (russ4262) <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
-2
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2020 Russell Johnson (russ4262) <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
+3 -3
View File
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2015 Dan Falck <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -20,7 +19,8 @@
# * USA *
# * *
# ***************************************************************************
'''used to create material stock around a machined part- for visualization '''
'''Used to create material stock around a machined part - for visualization'''
import FreeCAD
import PathScripts.PathIconViewProvider as PathIconViewProvider
@@ -367,7 +367,7 @@ def CreateFromTemplate(job, template):
rotZ = template.get('rotZ')
rotW = template.get('rotW')
if posX is not None and posY is not None and posZ is not None and rotX is not None and rotY is not None and rotZ is not None and rotW is not None:
pos = FreeCAD.Vector(float(posX), float(posY), float(posZ))
pos = FreeCAD.Vector(float(posX), float(posY), float(posZ))
rot = FreeCAD.Rotation(float(rotX), float(rotY), float(rotZ), float(rotW))
placement = FreeCAD.Placement(pos, rot)
elif posX is not None or posY is not None or posZ is not None or rotX is not None or rotY is not None or rotZ is not None or rotW is not None:
+2 -2
View File
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2015 Dan Falck <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -20,7 +19,8 @@
# * USA *
# * *
# ***************************************************************************
''' Used for CNC machine Stops for Path module. Create an Optional or Mandatory Stop.'''
'''Used for CNC machine Stops for Path module. Create an Optional or Mandatory Stop.'''
import FreeCAD
import FreeCADGui
+1 -3
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2016 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -27,7 +25,7 @@ from __future__ import print_function
__title__ = "Path Surface Operation"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Class and implementation of 3D Surface operation."
__contributors__ = "russ4262 (Russell Johnson)"
+1 -3
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -32,7 +30,7 @@ from PySide import QtCore
__title__ = "Path Surface Operation UI"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Surface operation page controller and command implementation."
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2020 russ4262 <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
+1 -3
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2019 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -41,7 +39,7 @@ Part = LazyLoader('Part', globals(), 'Part')
__title__ = "Tool bits."
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Class to deal with and represent a tool bit."
# PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2019 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2019 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
+1 -3
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2019 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -35,7 +33,7 @@ from PySide import QtCore, QtGui
__title__ = "Tool Bit UI"
__author__ = "sliptonic (Brad Collette)"
__url__ = "http://www.freecadweb.org"
__url__ = "https://www.freecadweb.org"
__doc__ = "Task panel editor for a ToolBit"
# Qt translation handling
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2019 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2019 sliptonic <[email protected]> *
# * Copyright (c) 2020 Schildkroet *
# * *
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2015 Dan Falck <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -21,7 +19,8 @@
# * USA *
# * *
# ***************************************************************************
''' Tool Controller defines tool, spindle speed and feed rates for Path Operations '''
'''Tool Controller defines tool, spindle speed and feed rates for Path Operations'''
import FreeCAD
import Path
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2019 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
-2
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2018 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2014 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -49,7 +47,7 @@ class EditorPanel():
self.form = FreeCADGui.PySideUic.loadUi(":/panels/ToolLibraryEditor.ui")
self.TLM = ToolLibraryManager.ToolLibraryManager()
listname = self.TLM.getCurrentTableName()
if listname:
self.loadToolTables()
@@ -159,7 +157,7 @@ class EditorPanel():
if item:
number = int(item)
listname = self.TLM.getCurrentTableName()
success, newNum = self.TLM.movedown(number, listname)
success, newNum = self.TLM.movedown(number, listname)
if success:
self.loadTable(listname)
self.updateSelection(newNum)
@@ -204,7 +202,7 @@ class EditorPanel():
''' updates the ui when tools are selected'''
if index:
self.form.ToolsList.selectRow(index.row())
self.form.btnCopyTools.setEnabled(False)
self.form.ButtonDelete.setEnabled(False)
self.form.ButtonUp.setEnabled(False)
@@ -224,8 +222,8 @@ class EditorPanel():
# only allow moving or deleting a single tool at a time.
if checkCount == 1:
#make sure the row is highlighted when the check box gets ticked
self.form.ToolsList.selectRow(checkList[0])
#make sure the row is highlighted when the check box gets ticked
self.form.ToolsList.selectRow(checkList[0])
self.form.ButtonDelete.setEnabled(True)
self.form.ButtonUp.setEnabled(True)
self.form.ButtonDown.setEnabled(True)
@@ -296,7 +294,7 @@ class EditorPanel():
if tooldata:
self.form.ToolsList.setModel(tooldata)
self.form.ToolsList.resizeColumnsToContents()
self.form.ToolsList.horizontalHeader().setResizeMode(self.form.ToolsList.model().columnCount() - 1, QtGui.QHeaderView.Stretch)
self.form.ToolsList.horizontalHeader().setResizeMode(self.form.ToolsList.model().columnCount() - 1, QtGui.QHeaderView.Stretch)
self.setCurrentToolTableByName(name)
def addNewToolTable(self):
@@ -304,7 +302,7 @@ class EditorPanel():
name = self.TLM.addNewToolTable()
self.loadToolTables()
self.loadTable(name)
def loadToolTables(self):
''' Load list of available tool tables '''
self.form.TableList.clear()
@@ -328,7 +326,7 @@ class EditorPanel():
''' reloads the current tooltable'''
name = self.TLM.getCurrentTableName()
self.loadTable(name)
def setCurrentToolTableByName(self, name):
''' get the current tool table '''
item = self.getToolTableByName(name)
@@ -347,7 +345,7 @@ class EditorPanel():
''' delete the selected tool table '''
self.TLM.deleteToolTable()
self.loadToolTables()
def renameTable(self):
''' provides dialog for new tablename and renames the selected tool table'''
name = self.TLM.getCurrentTableName()
@@ -373,10 +371,10 @@ class EditorPanel():
self.form.ButtonEdit.clicked.connect(self.editTool)
self.form.ButtonDuplicate.clicked.connect(self.duplicate)
self.form.btnCopyTools.clicked.connect(self.copyTools)
self.form.ToolsList.doubleClicked.connect(self.editTool)
self.form.ToolsList.clicked.connect(self.toolSelectionChanged)
self.form.TableList.clicked.connect(self.tableSelected)
self.form.TableList.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
self.form.TableList.itemChanged.connect(self.renameTable)
@@ -391,13 +389,13 @@ class EditorPanel():
self.setFields()
class ToolTableListWidgetItem(QtGui.QWidget):
toolMoved = QtCore.Signal()
def __init__(self, TLM):
super(ToolTableListWidgetItem, self).__init__()
self.tlm = TLM
self.tlm = TLM
self.setAcceptDrops(True)
self.mainLayout = QtGui.QHBoxLayout()
@@ -420,17 +418,17 @@ class ToolTableListWidgetItem(QtGui.QWidget):
def dragEnterEvent(self, e):
currentToolTable = self.tlm.getCurrentTableName()
thisToolTable = self.getTableName()
if not currentToolTable == thisToolTable:
e.accept()
else:
e.ignore()
e.ignore()
def dropEvent(self, e):
selectedTools = e.source().selectedIndexes()
if selectedTools:
toolData = selectedTools[1].data()
if toolData:
self.tlm.moveToTable(int(toolData), self.getTableName())
self.toolMoved.emit()
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2014 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *
@@ -168,7 +166,7 @@ class ToolLibraryManager():
def getCurrentTable(self):
''' returns an object of the current tool table '''
return self.getTableFromName(self.currentTableName)
def getTableFromName(self, name):
''' get the tool table object from the name '''
for table in self.toolTables:
@@ -178,15 +176,15 @@ class ToolLibraryManager():
def getNextToolTableName(self, tableName='Tool Table'):
''' get a unique name for a new tool table '''
iter = 1
tempName = tableName[-2:]
tempName = tableName[-2:]
if tempName[0] == '-' and tempName[-1].isdigit():
tableName = tableName[:-2]
while any(table.Name == tableName + '-' + str(iter) for table in self.toolTables):
iter += 1
return tableName + '-' + str(iter)
iter += 1
return tableName + '-' + str(iter)
def addNewToolTable(self):
''' creates a new tool table '''
@@ -201,7 +199,7 @@ class ToolLibraryManager():
def deleteToolTable(self):
''' deletes the selected tool table '''
if len(self.toolTables):
index = next((index for (index, d) in enumerate(self.toolTables) if d.Name == self.currentTableName), None)
index = next((index for (index, d) in enumerate(self.toolTables) if d.Name == self.currentTableName), None)
self.toolTables.pop(index)
self.saveMainLibrary()
@@ -219,7 +217,7 @@ class ToolLibraryManager():
tt.Name = newName
self.saveMainLibrary()
return True
def templateAttrs(self):
''' gets the tool table arributes '''
@@ -235,12 +233,12 @@ class ToolLibraryManager():
tableData['Tools'] = toolData
toolTables.append(tableData)
return toolTables
def tooltableFromAttrs(self, stringattrs):
if stringattrs.get('Version') and 1 == int(stringattrs['Version']):
tt = Path.Tooltable()
tt.Version = 1
tt.Name = self.getNextToolTableName()
@@ -252,9 +250,9 @@ class ToolLibraryManager():
tt.Name = stringattrs.get('TableName')
if any(table.Name == tt.Name for table in self.toolTables):
tt.Name = self.getNextToolTableName(tt.Name)
for key, attrs in PathUtil.keyValueIter(stringattrs['Tools']):
tool = Path.Tool()
tool = Path.Tool()
tool.Name = str(attrs["name"])
tool.ToolType = str(attrs["tooltype"])
tool.Material = str(attrs["material"])
@@ -316,7 +314,7 @@ class ToolLibraryManager():
if hasattr(o, "Proxy"):
if isinstance(o.Proxy, PathScripts.PathJob.ObjectJob):
tablelist.append(o.Label)
return tablelist
def getTool(self, listname, toolnum):
@@ -394,14 +392,14 @@ class ToolLibraryManager():
if isinstance(tableData, list):
for table in tableData:
ht = self.tooltableFromAttrs(table)
ht = self.tooltableFromAttrs(table)
if ht:
importedTables.append(ht)
if importedTables:
for tt in importedTables:
self.toolTables.append(tt)
self.saveMainLibrary()
return True
else:
-2
View File
@@ -1,7 +1,5 @@
# -*- coding: utf-8 -*-
# ***************************************************************************
# * *
# * Copyright (c) 2017 sliptonic <[email protected]> *
# * *
# * This program is free software; you can redistribute it and/or modify *

Some files were not shown because too many files have changed in this diff Show More