Skip to content

Commit

Permalink
Path: LGTM cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Russ4262 committed Nov 13, 2020
1 parent 01fa1fe commit 9f13c8c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
29 changes: 15 additions & 14 deletions src/Mod/Path/PathScripts/PathAreaOp.py
Expand Up @@ -290,7 +290,6 @@ def _buildProfileOpenEdges(self, obj, edgeList, isHole, start, getsim):
paths = []
heights = [i for i in self.depthparams]
PathLog.debug('depths: {}'.format(heights))
lstIdx = len(heights) - 1
for i in range(0, len(heights)):
for baseShape in edgeList:
hWire = Part.Wire(Part.__sortEdges__(baseShape.Edges))
Expand Down Expand Up @@ -326,7 +325,7 @@ def _buildProfileOpenEdges(self, obj, edgeList, isHole, start, getsim):
self.endVector = end_vector # pylint: disable=attribute-defined-outside-init

simobj = None
if getsim and False:
if getsim:
areaParams['ToolRadius'] = self.radius - self.radius * .005
area.setParams(**areaParams)
sec = area.makeSections(mode=0, project=False, heights=heights)[-1].getShape()
Expand Down Expand Up @@ -356,6 +355,8 @@ def opExecute(self, obj, getsim=False): # pylint: disable=arguments-differ
self.useTempJobClones('Delete') # Clear temporary group and recreate for temp job clones
self.rotStartDepth = None # pylint: disable=attribute-defined-outside-init

start_depth = obj.StartDepth.Value
final_depth = obj.FinalDepth.Value
if obj.EnableRotation != 'Off':
# Calculate operation heights based upon rotation radii
opHeights = self.opDetermineRotationRadii(obj)
Expand All @@ -364,23 +365,23 @@ def opExecute(self, obj, getsim=False): # pylint: disable=arguments-differ

# Set clearance and safe heights based upon rotation radii
if obj.EnableRotation == 'A(x)':
strDep = self.xRotRad
start_depth = self.xRotRad
elif obj.EnableRotation == 'B(y)':
strDep = self.yRotRad
start_depth = self.yRotRad
else:
strDep = max(self.xRotRad, self.yRotRad)
finDep = -1 * strDep
start_depth = max(self.xRotRad, self.yRotRad)
final_depth = -1 * start_depth

self.rotStartDepth = strDep
obj.ClearanceHeight.Value = strDep + self.clrOfset
obj.SafeHeight.Value = strDep + self.safOfst
self.rotStartDepth = start_depth
# The next two lines are improper code.
# The ClearanceHeight and SafeHeight need to be set in opSetDefaultValues() method.
# They should not be redefined here, so this entire `if...:` statement needs relocated.
obj.ClearanceHeight.Value = start_depth + self.clrOfset
obj.SafeHeight.Value = start_depth + self.safOfst

# Create visual axes when debugging.
if PathLog.getLevel(PathLog.thisModule()) == 4:
self.visualAxis()
else:
strDep = obj.StartDepth.Value
finDep = obj.FinalDepth.Value

# Set axial feed rates based upon horizontal feed rates
safeCircum = 2 * math.pi * obj.SafeHeight.Value
Expand All @@ -403,8 +404,8 @@ def opExecute(self, obj, getsim=False): # pylint: disable=arguments-differ
for shp in aOS:
if len(shp) == 2:
(fc, iH) = shp
# fc, iH, sub, angle, axis, strtDep, finDep
tup = fc, iH, 'otherOp', 0.0, 'S', obj.StartDepth.Value, obj.FinalDepth.Value
# fc, iH, sub, angle, axis, strtDep, finDep
tup = fc, iH, 'otherOp', 0.0, 'S', start_depth, final_depth
shapes.append(tup)
else:
shapes.append(shp)
Expand Down
14 changes: 7 additions & 7 deletions src/Mod/Path/PathScripts/PathPocketShape.py
Expand Up @@ -350,7 +350,7 @@ def areaOpShapes(self, obj):
subsList = o[1]
angle = o[2]
axis = o[3]
stock = o[4]
# stock = o[4]

for sub in subsList:
if 'Face' in sub:
Expand Down Expand Up @@ -539,10 +539,10 @@ def makeTempExtrusion(base, sub, fCnt):
return (False, 0, 0)
else:
tmpWire = FreeCAD.ActiveDocument.addObject('Part::Feature', wireName).Shape = wr
tmpWire = FreeCAD.ActiveDocument.getObject(wireName)
tmpExt = FreeCAD.ActiveDocument.addObject('Part::Extrusion', extName)
tmpWireObj = FreeCAD.ActiveDocument.getObject(wireName)
tmpExtObj = FreeCAD.ActiveDocument.addObject('Part::Extrusion', extName)
tmpExt = FreeCAD.ActiveDocument.getObject(extName)
tmpExt.Base = tmpWire
tmpExt.Base = tmpWireObj
tmpExt.DirMode = "Normal"
tmpExt.DirLink = None
tmpExt.LengthFwd = 10.0
Expand All @@ -555,8 +555,8 @@ def makeTempExtrusion(base, sub, fCnt):

tmpExt.recompute()
tmpExt.purgeTouched()
tmpWire.purgeTouched()
return (True, tmpWire, tmpExt)
tmpWireObj.purgeTouched()
return (True, tmpWireObj, tmpExt)

def roundValue(precision, val):
# Convert VALxe-15 numbers to zero
Expand Down Expand Up @@ -705,7 +705,7 @@ def planarFaceFromExtrusionEdges(self, face, trans):
if FreeCAD.ActiveDocument.getObject(fName):
FreeCAD.ActiveDocument.removeObject(fName)

tmpFace = FreeCAD.ActiveDocument.addObject('Part::Feature', fName).Shape = mFF
tmpFaceObj = FreeCAD.ActiveDocument.addObject('Part::Feature', fName).Shape = mFF
tmpFace = FreeCAD.ActiveDocument.getObject(fName)
tmpFace.purgeTouched()

Expand Down

0 comments on commit 9f13c8c

Please sign in to comment.