Path: Remove Expand Profile feature from Profile op
This commit is contained in:
@@ -231,8 +231,6 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
area.add(baseobject)
|
||||
|
||||
areaParams = self.areaOpAreaParams(obj, isHole) # pylint: disable=assignment-from-no-return
|
||||
if hasattr(obj, 'ExpandProfile') and obj.ExpandProfile != 0:
|
||||
areaParams = self.areaOpAreaParamsExpandProfile(obj, isHole) # pylint: disable=assignment-from-no-return
|
||||
|
||||
heights = [i for i in self.depthparams]
|
||||
PathLog.debug('depths: {}'.format(heights))
|
||||
|
||||
@@ -99,10 +99,6 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
return [
|
||||
("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)")),
|
||||
("App::PropertyLength", "ExpandProfile", "Profile",
|
||||
QtCore.QT_TRANSLATE_NOOP("App::Property", "Extend the profile clearing beyond the Extra Offset.")),
|
||||
("App::PropertyPercent", "ExpandProfileStepOver", "Profile",
|
||||
QtCore.QT_TRANSLATE_NOOP("App::Property", "Set the stepover percentage, based on the tool's diameter.")),
|
||||
("App::PropertyEnumeration", "HandleMultipleFeatures", "Profile",
|
||||
QtCore.QT_TRANSLATE_NOOP("PathPocket", "Choose how to process multiple Base Geometry features.")),
|
||||
("App::PropertyEnumeration", "JoinType", "Profile",
|
||||
@@ -149,8 +145,6 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
return {
|
||||
'AttemptInverseAngle': True,
|
||||
'Direction': 'CW',
|
||||
'ExpandProfile': 0.0,
|
||||
'ExpandProfileStepOver': 100,
|
||||
'HandleMultipleFeatures': 'Individually',
|
||||
'InverseAngle': False,
|
||||
'JoinType': 'Round',
|
||||
@@ -261,29 +255,6 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
|
||||
return params
|
||||
|
||||
def areaOpAreaParamsExpandProfile(self, obj, isHole):
|
||||
'''areaOpPathParamsExpandProfile(obj, isHole) ... return dictionary with area parameters for expanded profile'''
|
||||
params = {}
|
||||
|
||||
params['Fill'] = 1
|
||||
params['Coplanar'] = 0
|
||||
params['PocketMode'] = 1
|
||||
params['SectionCount'] = -1
|
||||
# params['Angle'] = obj.ZigZagAngle
|
||||
# params['FromCenter'] = (obj.StartAt == "Center")
|
||||
params['PocketStepover'] = self.tool.Diameter * (float(obj.ExpandProfileStepOver) / 100.0)
|
||||
extraOffset = obj.OffsetExtra.Value
|
||||
if False: # self.pocketInvertExtraOffset(): # Method simply returns False
|
||||
extraOffset = 0.0 - extraOffset
|
||||
params['PocketExtraOffset'] = extraOffset
|
||||
params['ToolRadius'] = self.radius
|
||||
|
||||
# Pattern = ['ZigZag', 'Offset', 'Spiral', 'ZigZagOffset', 'Line', 'Grid', 'Triangle']
|
||||
params['PocketMode'] = 2 # Pattern.index(obj.OffsetPattern) + 1
|
||||
params['JoinType'] = 0 # jointype = ['Round', 'Square', 'Miter']
|
||||
|
||||
return params
|
||||
|
||||
def areaOpPathParams(self, obj, isHole):
|
||||
'''areaOpPathParams(obj, isHole) ... returns dictionary with path parameters.
|
||||
Do not overwrite.'''
|
||||
@@ -310,9 +281,7 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
|
||||
def areaOpUseProjection(self, obj):
|
||||
'''areaOpUseProjection(obj) ... returns True'''
|
||||
if obj.ExpandProfile.Value == 0.0:
|
||||
return True
|
||||
return False
|
||||
return True
|
||||
|
||||
def opUpdateDepths(self, obj):
|
||||
if hasattr(obj, 'Base') and obj.Base.__len__() == 0:
|
||||
@@ -331,7 +300,6 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
self.isDebug = True if PathLog.getLevel(PathLog.thisModule()) == 4 else False
|
||||
self.inaccessibleMsg = translate('PathProfile', 'The selected edge(s) are inaccessible. If multiple, re-ordering selection might work.')
|
||||
self.offsetExtra = obj.OffsetExtra.Value
|
||||
self.expandProfile = None
|
||||
|
||||
if self.isDebug:
|
||||
for grpNm in ['tmpDebugGrp', 'tmpDebugGrp001']:
|
||||
@@ -343,11 +311,6 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
tmpGrpNm = self.tmpGrp.Name
|
||||
self.JOB = PathUtils.findParentJob(obj)
|
||||
|
||||
if obj.ExpandProfile.Value != 0.0:
|
||||
import PathScripts.PathSurfaceSupport as PathSurfaceSupport
|
||||
self.PathSurfaceSupport = PathSurfaceSupport
|
||||
self.expandProfile = True
|
||||
|
||||
if obj.UseComp:
|
||||
self.useComp = True
|
||||
self.ofstRadius = self.radius + self.offsetExtra
|
||||
@@ -435,10 +398,7 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
if ot < 1:
|
||||
cont = True
|
||||
if cont:
|
||||
if self.expandProfile:
|
||||
shapeEnv = self._getExpandedProfileEnvelope(obj, f, True, obj.StartDepth.Value, finDep)
|
||||
else:
|
||||
shapeEnv = PathUtils.getEnvelope(baseShape, subshape=f, depthparams=self.depthparams)
|
||||
shapeEnv = PathUtils.getEnvelope(baseShape, subshape=f, depthparams=self.depthparams)
|
||||
|
||||
if shapeEnv:
|
||||
self._addDebugObject('HoleShapeEnvelope', shapeEnv)
|
||||
@@ -460,11 +420,7 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
custDepthparams = self._customDepthParams(obj, strDep + 0.5, finDep) # only an envelope
|
||||
|
||||
try:
|
||||
# env = PathUtils.getEnvelope(profileshape, depthparams=custDepthparams)
|
||||
if self.expandProfile:
|
||||
shapeEnv = self._getExpandedProfileEnvelope(obj, shape, False, obj.StartDepth.Value, finDep)
|
||||
else:
|
||||
shapeEnv = PathUtils.getEnvelope(profileshape, depthparams=custDepthparams)
|
||||
shapeEnv = PathUtils.getEnvelope(profileshape, depthparams=custDepthparams)
|
||||
except Exception as ee: # pylint: disable=broad-except
|
||||
# PathUtils.getEnvelope() failed to return an object.
|
||||
msg = translate('Path', 'Unable to create path for face(s).')
|
||||
@@ -481,12 +437,7 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
finalDep = obj.FinalDepth.Value
|
||||
custDepthparams = self.depthparams
|
||||
self._addDebugObject('Rotation_Indiv_Shp', shape)
|
||||
|
||||
if self.expandProfile:
|
||||
shapeEnv = self._getExpandedProfileEnvelope(obj, shape, False, obj.StartDepth.Value, finalDep)
|
||||
else:
|
||||
shapeEnv = PathUtils.getEnvelope(shape, depthparams=custDepthparams)
|
||||
|
||||
shapeEnv = PathUtils.getEnvelope(shape, depthparams=custDepthparams)
|
||||
if shapeEnv:
|
||||
self._addDebugObject('IndivCutShapeEnv', shapeEnv)
|
||||
tup = shapeEnv, False, 'pathProfile', angle, axis, strDep, finalDep
|
||||
@@ -499,11 +450,6 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
|
||||
if 1 == len(self.model) and hasattr(self.model[0], "Proxy"):
|
||||
if isinstance(self.model[0].Proxy, ArchPanel.PanelSheet): # process the sheet
|
||||
# Cancel ExpandProfile feature. Unavailable for ArchPanels.
|
||||
if obj.ExpandProfile.Value != 0.0:
|
||||
obj.ExpandProfile.Value == 0.0
|
||||
msg = translate('PathProfile', 'No ExpandProfile support for ArchPanel models.')
|
||||
FreeCAD.Console.PrintWarning(msg + '\n')
|
||||
modelProxy = self.model[0].Proxy
|
||||
# Process circles and holes if requested by user
|
||||
if obj.processCircles or obj.processHoles:
|
||||
@@ -631,77 +577,14 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
PathLog.debug('_openingType() ' + msg)
|
||||
return -2
|
||||
|
||||
# Method for expanded profile
|
||||
def _getExpandedProfileEnvelope(self, obj, faceShape, isHole, strDep, finalDep):
|
||||
shapeZ = faceShape.BoundBox.ZMin
|
||||
|
||||
def calculateOffsetValue(obj, isHole):
|
||||
offset = obj.ExpandProfile.Value + obj.OffsetExtra.Value # 0.0
|
||||
if obj.UseComp:
|
||||
offset = obj.OffsetExtra.Value + self.tool.Diameter
|
||||
offset += obj.ExpandProfile.Value
|
||||
if isHole:
|
||||
if obj.Side == 'Outside':
|
||||
offset = 0 - offset
|
||||
else:
|
||||
if obj.Side == 'Inside':
|
||||
offset = 0 - offset
|
||||
return offset
|
||||
|
||||
faceEnv = self.PathSurfaceSupport.getShapeEnvelope(faceShape)
|
||||
# newFace = self.PathSurfaceSupport.getSliceFromEnvelope(faceEnv)
|
||||
newFace = self.PathSurfaceSupport.getShapeSlice(faceEnv)
|
||||
# Compute necessary offset
|
||||
offsetVal = calculateOffsetValue(obj, isHole)
|
||||
expandedFace = self.PathSurfaceSupport.extractFaceOffset(newFace, offsetVal, newFace)
|
||||
if expandedFace:
|
||||
if shapeZ != 0.0:
|
||||
expandedFace.translate(FreeCAD.Vector(0.0, 0.0, shapeZ))
|
||||
newFace.translate(FreeCAD.Vector(0.0, 0.0, shapeZ))
|
||||
|
||||
if isHole:
|
||||
if obj.Side == 'Outside':
|
||||
newFace = newFace.cut(expandedFace)
|
||||
else:
|
||||
newFace = expandedFace.cut(newFace)
|
||||
else:
|
||||
if obj.Side == 'Inside':
|
||||
newFace = newFace.cut(expandedFace)
|
||||
else:
|
||||
newFace = expandedFace.cut(newFace)
|
||||
|
||||
if finalDep - shapeZ != 0:
|
||||
newFace.translate(FreeCAD.Vector(0.0, 0.0, finalDep - shapeZ))
|
||||
|
||||
if strDep - finalDep != 0:
|
||||
if newFace.Area > 0:
|
||||
return newFace.extrude(FreeCAD.Vector(0.0, 0.0, strDep - finalDep))
|
||||
else:
|
||||
PathLog.debug('No expanded profile face shape.\n')
|
||||
return False
|
||||
else:
|
||||
PathLog.debug(translate('PathProfile', 'Failed to extract offset(s) for expanded profile.') + '\n')
|
||||
|
||||
PathLog.debug(translate('PathProfile', 'Failed to expand profile.') + '\n')
|
||||
return False
|
||||
|
||||
# Method to handle each model as a whole, when no faces are selected
|
||||
# It includes ExpandProfile implementation
|
||||
def _processEachModel(self, obj):
|
||||
shapeTups = list()
|
||||
for base in self.model:
|
||||
if hasattr(base, 'Shape'):
|
||||
env = PathUtils.getEnvelope(partshape=base.Shape, subshape=None, depthparams=self.depthparams)
|
||||
if self.expandProfile:
|
||||
eSlice = self.PathSurfaceSupport.getCrossSection(env) # getSliceFromEnvelope(env)
|
||||
eSlice.translate(FreeCAD.Vector(0.0, 0.0, base.Shape.BoundBox.ZMin - env.BoundBox.ZMin))
|
||||
self._addDebugObject('ModelSlice', eSlice)
|
||||
shapeEnv = self._getExpandedProfileEnvelope(obj, eSlice, False, obj.StartDepth.Value, obj.FinalDepth.Value)
|
||||
else:
|
||||
shapeEnv = env
|
||||
|
||||
if shapeEnv:
|
||||
shapeTups.append((shapeEnv, False))
|
||||
if env:
|
||||
shapeTups.append((env, False))
|
||||
return shapeTups
|
||||
|
||||
# Edges pre-processing
|
||||
@@ -711,7 +594,7 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
basewires = list()
|
||||
delPairs = list()
|
||||
ezMin = None
|
||||
self.cutOut = self.tool.Diameter * (float(obj.ExpandProfileStepOver) / 100.0)
|
||||
self.cutOut = self.tool.Diameter
|
||||
|
||||
for p in range(0, len(obj.Base)):
|
||||
(base, subsList) = obj.Base[p]
|
||||
@@ -745,11 +628,7 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
(origWire, flatWire) = self._flattenWire(obj, wire, obj.FinalDepth.Value)
|
||||
f = flatWire.Wires[0]
|
||||
if f:
|
||||
if self.expandProfile:
|
||||
shapeEnv = self._getExpandedProfileEnvelope(obj, Part.Face(f), False, obj.StartDepth.Value, ezMin)
|
||||
else:
|
||||
shapeEnv = PathUtils.getEnvelope(Part.Face(f), depthparams=self.depthparams)
|
||||
|
||||
shapeEnv = PathUtils.getEnvelope(Part.Face(f), depthparams=self.depthparams)
|
||||
if shapeEnv:
|
||||
tup = shapeEnv, False, 'Profile', 0.0, 'X', obj.StartDepth.Value, obj.FinalDepth.Value
|
||||
shapes.append(tup)
|
||||
@@ -771,14 +650,6 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
|
||||
self._addDebugObject('FlatWire', flatWire)
|
||||
|
||||
if self.expandProfile:
|
||||
# Identify list of pass offset values for expanded profile paths
|
||||
regularOfst = self.ofstRadius
|
||||
targetOfst = regularOfst + obj.ExpandProfile.Value
|
||||
while regularOfst < targetOfst:
|
||||
regularOfst += self.cutOut
|
||||
passOffsets.insert(0, regularOfst)
|
||||
|
||||
for po in passOffsets:
|
||||
self.ofstRadius = po
|
||||
cutShp = self._getCutAreaCrossSection(obj, base, origWire, flatWire)
|
||||
|
||||
Reference in New Issue
Block a user