Merge pull request #4976 from Russ4262/cleanup/general_lgtm
[Path] LGTM cleanup
This commit is contained in:
@@ -396,8 +396,6 @@ def GenerateGCode(op, obj, adaptiveResults, helixDiameter):
|
||||
if z != lz:
|
||||
op.commandlist.append(Path.Command("G0", {"Z": z}))
|
||||
|
||||
lz = z
|
||||
|
||||
|
||||
def Execute(op, obj):
|
||||
# pylint: disable=global-statement
|
||||
@@ -455,7 +453,7 @@ def Execute(op, obj):
|
||||
|
||||
stockPath2d = convertTo2d(stockPaths)
|
||||
|
||||
opType = area.AdaptiveOperationType.ClearingInside
|
||||
# opType = area.AdaptiveOperationType.ClearingInside # Commented out per LGTM suggestion
|
||||
if obj.OperationType == "Clearing":
|
||||
if obj.Side == "Outside":
|
||||
opType = area.AdaptiveOperationType.ClearingOutside
|
||||
@@ -725,16 +723,7 @@ class PathAdaptive(PathOp.ObjectOp):
|
||||
obj.setEditorMode('removalshape', 2) # hide
|
||||
|
||||
FeatureExtensions.initialize_properties(obj)
|
||||
|
||||
|
||||
def SetupProperties():
|
||||
setup = ["Side", "OperationType", "Tolerance", "StepOver",
|
||||
"LiftDistance", "KeepToolDownRatio", "StockToLeave",
|
||||
"ForceInsideOut", "FinishingProfile", "Stopped",
|
||||
"StopProcessing", "UseHelixArcs", "AdaptiveInputState",
|
||||
"AdaptiveOutputState", "HelixAngle", "HelixConeAngle",
|
||||
"HelixDiameterLimit", "UseOutline"]
|
||||
return setup
|
||||
# Eclass
|
||||
|
||||
|
||||
def SetupProperties():
|
||||
|
||||
@@ -33,11 +33,9 @@ __author__ = "sliptonic (Brad Collette)"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
__doc__ = "Path Custom object and FreeCAD command"
|
||||
|
||||
if False:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
# PathLog.trackModule(PathLog.thisModule())
|
||||
|
||||
|
||||
# Qt translation handling
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import PathGui as PGui # ensure Path/Gui/Resources are loaded
|
||||
import PathScripts.PathCustom as PathCustom
|
||||
import PathScripts.PathOpGui as PathOpGui
|
||||
|
||||
|
||||
@@ -22,12 +22,10 @@
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import PathGui as PGui # ensure Path/Gui/Resources are loaded
|
||||
import PathScripts.PathDeburr as PathDeburr
|
||||
import PathScripts.PathGui as PathGui
|
||||
import PathScripts.PathLog as PathLog
|
||||
import PathScripts.PathOpGui as PathOpGui
|
||||
import Part
|
||||
from PySide import QtCore, QtGui
|
||||
|
||||
__title__ = "Path Deburr Operation UI"
|
||||
@@ -35,13 +33,9 @@ __author__ = "sliptonic (Brad Collette), Schildkroet"
|
||||
__url__ = "https://www.freecadweb.org"
|
||||
__doc__ = "Deburr operation page controller and command implementation."
|
||||
|
||||
LOGLEVEL = False
|
||||
|
||||
if LOGLEVEL:
|
||||
PathLog.setLevel(PathLog.Level.DEBUG, PathLog.thisModule())
|
||||
PathLog.trackModule(PathLog.thisModule())
|
||||
else:
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
|
||||
# PathLog.trackModule(PathLog.thisModule())
|
||||
|
||||
|
||||
def translate(context, text, disambig=None):
|
||||
|
||||
@@ -692,10 +692,12 @@ class ObjectDressup(object):
|
||||
self.bones.append((bone.boneId, bone.locationZ(), enabled, inaccessible))
|
||||
|
||||
self.boneId = bone.boneId
|
||||
if False and PathLog.getLevel(LOG_MODULE) == PathLog.Level.DEBUG and bone.boneId > 2:
|
||||
commands = self.boneCommands(bone, False)
|
||||
else:
|
||||
commands = self.boneCommands(bone, enabled)
|
||||
# Specific debugging `if` statement
|
||||
# if PathLog.getLevel(LOG_MODULE) == PathLog.Level.DEBUG and bone.boneId > 2:
|
||||
# commands = self.boneCommands(bone, False)
|
||||
# else:
|
||||
# commands = self.boneCommands(bone, enabled)
|
||||
commands = self.boneCommands(bone, enabled)
|
||||
bone.commands = commands
|
||||
|
||||
self.shapes[bone.boneId] = self.boneShapes
|
||||
|
||||
@@ -488,7 +488,7 @@ class MapWireToTag:
|
||||
commands.extend(PathGeom.cmdsForEdge(e, False, False, self.segm, hSpeed = self.hSpeed, vSpeed = self.vSpeed))
|
||||
if rapid:
|
||||
commands.append(Path.Command('G0', {'X': rapid.x, 'Y': rapid.y, 'Z': rapid.z}))
|
||||
rapid = None
|
||||
# rapid = None # commented out per LGTM suggestion
|
||||
return commands
|
||||
except Exception as e: # pylint: disable=broad-except
|
||||
PathLog.error("Exception during processing tag @(%.2f, %.2f) (%s) - disabling the tag" % (self.tag.x, self.tag.y, e.args[0]))
|
||||
@@ -665,7 +665,7 @@ class PathData:
|
||||
|
||||
return tags
|
||||
|
||||
def copyTags(self, obj, fromObj, width, height, angle, radius):
|
||||
def copyTags(self, obj, fromObj, width, height, angle, radius, production=True):
|
||||
print("copyTags(%s, %s, %.2f, %.2f, %.2f, %.2f" % (obj.Label, fromObj.Label, width, height, angle, radius))
|
||||
W = width if width else self.defaultTagWidth()
|
||||
H = height if height else self.defaultTagHeight()
|
||||
@@ -678,7 +678,9 @@ class PathData:
|
||||
print("tag[%d]" % i)
|
||||
if not i in fromObj.Disabled:
|
||||
dist = self.baseWire.distToShape(Part.Vertex(FreeCAD.Vector(pos.x, pos.y, self.minZ)))
|
||||
if True or dist[0] < W:
|
||||
if production or dist[0] < W:
|
||||
# russ4262:: `production` variable was a `True` declaration, forcing True branch to be processed always
|
||||
# The application of the `production` argument/variable is to appease LGTM
|
||||
print("tag[%d/%d]: (%.2f, %.2f, %.2f)" % (i, j, pos.x, pos.y, self.minZ))
|
||||
at = dist[1][0][0]
|
||||
tags.append(Tag(j, at.x, at.y, W, H, A, R, True))
|
||||
|
||||
@@ -434,7 +434,6 @@ class ObjectDressup:
|
||||
# Add last layer
|
||||
if len(queue) > 0:
|
||||
layers.append(queue)
|
||||
queue = []
|
||||
|
||||
# Go through each layer and add leadIn/Out
|
||||
idx = 0
|
||||
|
||||
Reference in New Issue
Block a user