lgtm cleanup

fix contradictory tooltip
This commit is contained in:
sliptonic
2020-10-07 12:44:54 -05:00
parent 074d4b7ce4
commit dcf9989f12
3 changed files with 129 additions and 49 deletions

View File

@@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TaskPanel</class>
<widget class="QWidget" name="TaskPanel">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>376</width>
<height>387</height>
</rect>
</property>
<property name="windowTitle">
<string>AxisMap Dressup</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="3" column="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>275</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lblRadius">
<property name="text">
<string>Radius</string>
</property>
</widget>
</item>
<item row="0" column="2" colspan="2">
<widget class="Gui::QuantitySpinBox" name="radius">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The radius of the wrapped axis&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lblAxisMapInput">
<property name="text">
<string>Axis Mapping</string>
</property>
</widget>
</item>
<item row="1" column="2" colspan="2">
<widget class="QComboBox" name="axisMapInput">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;The input mapping axis. Coordinates of the first axis will be mapped to the second.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<item>
<property name="text">
<string>X-&gt;A</string>
</property>
</item>
<item>
<property name="text">
<string>Y-&gt;A</string>
</property>
</item>
<item>
<property name="text">
<string>X-&gt;B</string>
</property>
</item>
<item>
<property name="text">
<string>Y-&gt;B</string>
</property>
</item>
<item>
<property name="text">
<string>X-&gt;C</string>
</property>
</item>
<item>
<property name="text">
<string>Y-&gt;C</string>
</property>
</item>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Gui::QuantitySpinBox</class>
<extends>QWidget</extends>
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -157,7 +157,7 @@ class ObjectSurface(PathOp.ObjectOp):
("App::PropertyDistance", "InternalFeaturesAdjustment", "Selected Geometry Settings",
QtCore.QT_TRANSLATE_NOOP("App::Property", "Positive values push the cutter toward, or into, the feature. Negative values retract the cutter away from the feature.")),
("App::PropertyBool", "InternalFeaturesCut", "Selected Geometry Settings",
QtCore.QT_TRANSLATE_NOOP("App::Property", "Ignore internal feature areas within a larger selected face.")),
QtCore.QT_TRANSLATE_NOOP("App::Property", "Cut internal feature areas within a larger selected face.")),
("App::PropertyEnumeration", "BoundBox", "Clearing Options",
QtCore.QT_TRANSLATE_NOOP("App::Property", "Select the overall boundary for the operation.")),
@@ -249,8 +249,8 @@ class ObjectSurface(PathOp.ObjectOp):
'AvoidLastX_Faces': 0,
'PatternCenterCustom': FreeCAD.Vector(0.0, 0.0, 0.0),
'GapThreshold': 0.005,
'AngularDeflection': 0.25, # AngularDeflection is unused
# Reasonable compromise between speed & precision
'AngularDeflection': 0.25, # AngularDeflection is unused
# Reasonable compromise between speed & precision
'LinearDeflection': 0.001,
# For debugging
'ShowTempObjects': False
@@ -341,7 +341,6 @@ class ObjectSurface(PathOp.ObjectOp):
if isinstance(val, int) or isinstance(val, float):
setVal = True
if setVal:
propVal = getattr(prop, 'Value')
setattr(prop, 'Value', val)
else:
setattr(obj, n, val)
@@ -625,7 +624,6 @@ class ObjectSurface(PathOp.ObjectOp):
self.commandlist.extend(CMDS)
else:
PathLog.error('Failed to pre-process model and/or selected face(s).')
# ###### CLOSING COMMANDS FOR OPERATION ######
@@ -973,7 +971,6 @@ class ObjectSurface(PathOp.ObjectOp):
return SCANS
def _planarDropCutScan(self, pdc, A, B):
#PNTS = list()
(x1, y1) = A
(x2, y2) = B
path = ocl.Path() # create an empty path object
@@ -988,7 +985,6 @@ class ObjectSurface(PathOp.ObjectOp):
return PNTS # pdc.getCLPoints()
def _planarCircularDropCutScan(self, pdc, Arc, cMode):
PNTS = list()
path = ocl.Path() # create an empty path object
(sp, ep, cp) = Arc
@@ -1038,7 +1034,6 @@ class ObjectSurface(PathOp.ObjectOp):
PRTS = SCANDATA[so]
lenPRTS = len(PRTS)
first = PRTS[0][0] # first point of arc/line stepover group
start = PRTS[0][0] # will change with each line/arc segment
last = None
cmds.append(Path.Command('N (Begin step {}.)'.format(so), {}))
@@ -1068,7 +1063,6 @@ class ObjectSurface(PathOp.ObjectOp):
tolrnc))
else:
cmds.append(Path.Command('N (part {}.)'.format(i + 1), {}))
start = prt[0]
last = prt[lenPrt - 1]
if so == peIdx or peIdx == -1:
cmds.extend(self._planarSinglepassProcess(obj, prt))
@@ -1129,18 +1123,15 @@ class ObjectSurface(PathOp.ObjectOp):
peIdx = lenSCANDATA - 1
# Process each layer in depthparams
prvLyrFirst = None
prvLyrLast = None
lastPrvStpLast = None
for lyr in range(0, lenDP):
odd = True # ZigZag directional switch
lyrHasCmds = False
actvSteps = 0
LYR = list()
prvStpFirst = None
if lyr > 0:
if prvStpLast is not None:
lastPrvStpLast = prvStpLast
# if lyr > 0:
# if prvStpLast is not None:
# lastPrvStpLast = prvStpLast
prvStpLast = None
lyrDep = depthparams[lyr]
PathLog.debug('Multi-pass lyrDep: {}'.format(round(lyrDep, 4)))
@@ -1244,7 +1235,6 @@ class ObjectSurface(PathOp.ObjectOp):
if prtsHasCmds is True:
stepHasCmds = True
actvSteps += 1
prvStpFirst = first
stpOvrCmds.extend(transCmds)
stpOvrCmds.append(Path.Command('N (Begin step {}.)'.format(so), {}))
stpOvrCmds.append(Path.Command('G0', {'X': first.x, 'Y': first.y, 'F': self.horizRapid}))
@@ -1253,7 +1243,6 @@ class ObjectSurface(PathOp.ObjectOp):
# Layer transition at first active step over in current layer
if actvSteps == 1:
prvLyrFirst = first
LYR.append(Path.Command('N (Layer {} begins)'.format(lyr), {}))
if lyr > 0:
LYR.append(Path.Command('N (Layer transition)', {}))
@@ -1267,7 +1256,6 @@ class ObjectSurface(PathOp.ObjectOp):
# Close layer, saving commands, if any
if lyrHasCmds is True:
prvLyrLast = last
GCODE.extend(LYR) # save line commands
GCODE.append(Path.Command('N (End of layer {})'.format(lyr), {}))
@@ -1366,13 +1354,13 @@ class ObjectSurface(PathOp.ObjectOp):
prcs = False
if onHold is False:
onHold = True
output.append( Path.Command('N (Start hold)', {}) )
output.append( Path.Command('G0', {'Z': clrScnLn, 'F': self.vertRapid}) )
output.append(Path.Command('N (Start hold)', {}))
output.append(Path.Command('G0', {'Z': clrScnLn, 'F': self.vertRapid}))
else:
if onHold is True:
onHold = False
output.append( Path.Command('N (End hold)', {}) )
output.append( Path.Command('G0', {'X': pnt.x, 'Y': pnt.y, 'F': self.horizRapid}) )
output.append(Path.Command('N (End hold)', {}))
output.append(Path.Command('G0', {'X': pnt.x, 'Y': pnt.y, 'F': self.horizRapid}))
# Process point
if prcs is True:
@@ -1541,7 +1529,6 @@ class ObjectSurface(PathOp.ObjectOp):
pdc.setSampling(SampleInterval) # set sampling size
return pdc
# Main rotational scan functions
def _processRotationalOp(self, JOB, obj, mdlIdx, compoundFaces=None):
PathLog.debug('_processRotationalOp(self, JOB, obj, mdlIdx, compoundFaces=None)')

View File

@@ -139,7 +139,7 @@ class ObjectWaterline(PathOp.ObjectOp):
("App::PropertyDistance", "InternalFeaturesAdjustment", "Selected Geometry Settings",
QtCore.QT_TRANSLATE_NOOP("App::Property", "Positive values push the cutter toward, or into, the feature. Negative values retract the cutter away from the feature.")),
("App::PropertyBool", "InternalFeaturesCut", "Selected Geometry Settings",
QtCore.QT_TRANSLATE_NOOP("App::Property", "Ignore internal feature areas within a larger selected face.")),
QtCore.QT_TRANSLATE_NOOP("App::Property", "Cut internal feature areas within a larger selected face.")),
("App::PropertyEnumeration", "Algorithm", "Clearing Options",
QtCore.QT_TRANSLATE_NOOP("App::Property", "Select the algorithm to use: OCL Dropcutter*, or Experimental (Not OCL based).")),
@@ -341,7 +341,6 @@ class ObjectWaterline(PathOp.ObjectOp):
if isinstance(val, int) or isinstance(val, float):
setVal = True
if setVal:
propVal = getattr(prop, 'Value')
setattr(prop, 'Value', val)
else:
setattr(obj, n, val)
@@ -790,8 +789,6 @@ class ObjectWaterline(PathOp.ObjectOp):
if scan is False:
erFlg = True
else:
##if aTyp == 'L':
## stpOvr.append(FreeCAD.Vector(scan[0][0].x, scan[0][0].y, scan[0][0].z))
stpOvr.append(scan)
if erFlg is False:
SCANS.append(stpOvr)
@@ -819,7 +816,7 @@ class ObjectWaterline(PathOp.ObjectOp):
horizGC = 'G1'
height = first.z
elif (minSTH + (2.0 * tolrnc)) >= max(first.z, lstPnt.z):
height = False # allow end of Zig to cut to beginning of Zag
height = False # allow end of Zig to cut to beginning of Zag
# Create raise, shift, and optional lower commands
if height is not False:
@@ -881,7 +878,6 @@ class ObjectWaterline(PathOp.ObjectOp):
self.layerEndPnt = FreeCAD.Vector(0.0, 0.0, 0.0)
# Set extra offset to diameter of cutter to allow cutter to move around perimeter of model
toolDiam = self.cutter.getDiameter()
if subShp is None:
# Get correct boundbox
@@ -1012,9 +1008,9 @@ class ObjectWaterline(PathOp.ObjectOp):
for p in range(0, pntsPerLine):
pre.append(0)
post.append(0)
for l in range(0, lenSL):
self.topoMap[l].insert(0, 0)
self.topoMap[l].append(0)
for i in range(0, lenSL):
self.topoMap[i].insert(0, 0)
self.topoMap[i].append(0)
self.topoMap.insert(0, pre)
self.topoMap.append(post)
return True
@@ -1195,7 +1191,7 @@ class ObjectWaterline(PathOp.ObjectOp):
# generate the path commands
output = []
prev = FreeCAD.Vector(2135984513.165, -58351896873.17455, 13838638431.861)
# prev = FreeCAD.Vector(2135984513.165, -58351896873.17455, 13838638431.861)
nxt = FreeCAD.Vector(0.0, 0.0, 0.0)
# Create first point
@@ -1218,7 +1214,6 @@ class ObjectWaterline(PathOp.ObjectOp):
output.append(Path.Command('G1', {'X': pnt.x, 'Y': pnt.y, 'F': self.horizFeed}))
# Rotate point data
prev = pnt
pnt = nxt
# Save layer end point for use in transitioning to next layer
@@ -1233,7 +1228,6 @@ class ObjectWaterline(PathOp.ObjectOp):
PathLog.debug('_experimentalWaterlineOp()')
commands = []
t_begin = time.time()
base = JOB.Model.Group[mdlIdx]
# safeSTL = self.safeSTLs[mdlIdx]
self.endVector = None
@@ -1287,7 +1281,6 @@ class ObjectWaterline(PathOp.ObjectOp):
caCnt += 1
if area.Area > 0.0:
cont = True
caWireCnt = len(area.Wires) - 1 # first wire is boundFace wire
self.showDebugObject(area, 'CutArea_{}'.format(caCnt))
else:
data = FreeCAD.Units.Quantity(csHght, FreeCAD.Units.Length).UserString
@@ -1297,7 +1290,6 @@ class ObjectWaterline(PathOp.ObjectOp):
if cont:
area.translate(FreeCAD.Vector(0.0, 0.0, 0.0 - area.BoundBox.ZMin))
activeArea = area.cut(trimFace)
activeAreaWireCnt = len(activeArea.Wires) # first wire is boundFace wire
self.showDebugObject(activeArea, 'ActiveArea_{}'.format(caCnt))
ofstArea = PathUtils.getOffsetArea(activeArea,
ofst,
@@ -1370,9 +1362,7 @@ class ObjectWaterline(PathOp.ObjectOp):
# Get slice at depth of shape
csFaces = self._getModelCrossSection(shape, csHght) # returned at Z=0.0
if not csFaces:
data = FreeCAD.Units.Quantity(csHght, FreeCAD.Units.Length).UserString
else:
if csFaces:
if len(csFaces) > 0:
useFaces = self._getSolidAreasFromPlanarFaces(csFaces)
else:
@@ -1497,8 +1487,8 @@ class ObjectWaterline(PathOp.ObjectOp):
GCODE = [Path.Command('N (Beginning of Single-pass layer.)', {})]
tolrnc = JOB.GeometryTolerance.Value
lenstpOVRS = len(stpOVRS)
lstSO = lenstpOVRS - 1
lstStpOvr = False
# lstSO = lenstpOVRS - 1
# lstStpOvr = False
gDIR = ['G3', 'G2']
if self.CutClimb is True:
@@ -1518,8 +1508,6 @@ class ObjectWaterline(PathOp.ObjectOp):
first = PRTS[0][0] # first point of arc/line stepover group
last = None
cmds.append(Path.Command('N (Begin step {}.)'.format(so), {}))
if so == lstSO:
lstStpOvr = True
if so > 0:
if cutPattern == 'CircularZigZag':
@@ -1689,7 +1677,7 @@ class ObjectWaterline(PathOp.ObjectOp):
PathLog.track()
paths = []
pathParams = {} # pylint: disable=assignment-from-no-return
pathParams = {} # pylint: disable=assignment-from-no-return
pathParams['shapes'] = [wire]
pathParams['feedrate'] = self.horizFeed
@@ -1705,7 +1693,7 @@ class ObjectWaterline(PathOp.ObjectOp):
(pp, end_vector) = Path.fromShapes(**pathParams)
paths.extend(pp.Commands)
self.endVector = end_vector # pylint: disable=attribute-defined-outside-init
self.endVector = end_vector # pylint: disable=attribute-defined-outside-init
return (paths, end_vector)
@@ -1739,8 +1727,8 @@ class ObjectWaterline(PathOp.ObjectOp):
xyz = endPnt
cmds.append(Path.Command('G1', {'X': strtPnt.x, 'Y': strtPnt.y, 'Z': strtPnt.z, 'F': self.horizFeed}))
cmds.append(Path.Command(gCmd, {'X': xyz.x, 'Y': xyz.y, 'Z': xyz.z,
'I': ijk.x, 'J': ijk.y, 'K': ijk.z, # leave same xyz.z height
'F': self.horizFeed}))
'I': ijk.x, 'J': ijk.y, 'K': ijk.z, # leave same xyz.z height
'F': self.horizFeed}))
cmds.append(Path.Command('G1', {'X': endPnt.x, 'Y': endPnt.y, 'Z': endPnt.z, 'F': self.horizFeed}))
return cmds
@@ -1819,7 +1807,7 @@ class ObjectWaterline(PathOp.ObjectOp):
do.Shape = objShape
do.purgeTouched()
self.tempGroup.addObject(do)
# Eclass
def SetupProperties():
''' SetupProperties() ... Return list of properties required for operation.'''