diff --git a/src/Mod/Path/PathScripts/PathAreaOp.py b/src/Mod/Path/PathScripts/PathAreaOp.py index 7a1cc8e0ee2b..1144a44c8a02 100644 --- a/src/Mod/Path/PathScripts/PathAreaOp.py +++ b/src/Mod/Path/PathScripts/PathAreaOp.py @@ -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)) @@ -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() @@ -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) @@ -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 @@ -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) diff --git a/src/Mod/Path/PathScripts/PathPocketShape.py b/src/Mod/Path/PathScripts/PathPocketShape.py index 006616db1e01..afdac350daab 100644 --- a/src/Mod/Path/PathScripts/PathPocketShape.py +++ b/src/Mod/Path/PathScripts/PathPocketShape.py @@ -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: @@ -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 @@ -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 @@ -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()