Consolidated path tool editor and added customized support for endmill, drill and v-bit.

This commit is contained in:
Markus Lampert
2018-06-04 23:00:18 -07:00
parent c9c9913c06
commit c0cfbc2911
14 changed files with 2186 additions and 771 deletions

View File

@@ -28,6 +28,7 @@ import Part
import Path
import PathScripts
import PathScripts.PathLog as PathLog
import PathScripts.PathToolEdit as PathToolEdit
import PathScripts.PathUtil as PathUtil
from FreeCAD import Units
@@ -280,37 +281,7 @@ class ToolControllerEditor:
self.vertRapid = PathGui.QuantitySpinBox(self.form.vertRapid, obj, 'VertRapid')
self.horizRapid = PathGui.QuantitySpinBox(self.form.horizRapid, obj, 'HorizRapid')
self.toolDiameter = PathGui.QuantitySpinBox(self.form.toolDiameter, obj, 'Tool.Diameter')
self.toolLengthOffset = PathGui.QuantitySpinBox(self.form.toolLengthOffset, obj, 'Tool.LengthOffset')
self.toolFlatRadius = PathGui.QuantitySpinBox(self.form.toolFlatRadius, obj, 'Tool.FlatRadius')
self.toolCornerRadius = PathGui.QuantitySpinBox(self.form.toolCornerRadius, obj, 'Tool.CornerRadius')
self.toolCuttingEdgeAngle = PathGui.QuantitySpinBox(self.form.toolCuttingEdgeAngle, obj, 'Tool.CuttingEdgeAngle')
self.toolCuttingEdgeHeight = PathGui.QuantitySpinBox(self.form.toolCuttingEdgeHeight, obj, 'Tool.CuttingEdgeHeight')
def getType(self, tooltype):
"gets a combobox index number for a given type or viceversa"
toolslist = ["Drill", "CenterDrill", "CounterSink", "CounterBore",
"Reamer", "Tap", "EndMill", "SlotCutter", "BallEndMill",
"ChamferMill", "CornerRound", "Engraver"]
if isinstance(tooltype, str):
if tooltype in toolslist:
return toolslist.index(tooltype)
else:
return 0
else:
return toolslist[tooltype]
def getMaterial(self, material):
"gets a combobox index number for a given material or viceversa"
matslist = ["HighSpeedSteel", "HighCarbonToolSteel", "CastAlloy",
"Carbide", "Ceramics", "Diamond", "Sialon"]
if isinstance(material, str):
if material in matslist:
return matslist.index(material)
else:
return 0
else:
return matslist[material]
self.editor = PathToolEdit.ToolEditor(obj.Tool, self.form.toolEditor)
def updateUi(self):
tc = self.obj
@@ -325,15 +296,7 @@ class ToolControllerEditor:
if index >= 0:
self.form.spindleDirection.setCurrentIndex(index)
self.form.toolName.setText(tc.Tool.Name)
self.form.toolType.setCurrentIndex(self.getType(tc.Tool.ToolType))
self.form.toolMaterial.setCurrentIndex(self.getMaterial(tc.Tool.Material))
self.toolDiameter.updateSpinBox()
self.toolLengthOffset.updateSpinBox()
self.toolFlatRadius.updateSpinBox()
self.toolCornerRadius.updateSpinBox()
self.toolCuttingEdgeAngle.updateSpinBox()
self.toolCuttingEdgeHeight.updateSpinBox()
self.editor.updateUI()
def updateToolController(self):
tc = self.obj
@@ -347,15 +310,9 @@ class ToolControllerEditor:
tc.SpindleSpeed = self.form.spindleSpeed.value()
tc.SpindleDir = self.form.spindleDirection.currentText()
tc.Tool.Name = str(self.form.toolName.text())
tc.Tool.ToolType = self.getType(self.form.toolType.currentIndex())
tc.Tool.Material = self.getMaterial(self.form.toolMaterial.currentIndex())
self.toolDiameter.updateProperty()
self.toolLengthOffset.updateProperty()
self.toolFlatRadius.updateProperty()
self.toolCornerRadius.updateProperty()
self.toolCuttingEdgeAngle.updateProperty()
self.toolCuttingEdgeHeight.updateProperty()
self.editor.updateTool()
tc.Tool = self.editor.tool
except Exception as e:
PathLog.error(translate("PathToolController", "Error updating TC: %s") % e)
@@ -367,19 +324,14 @@ class ToolControllerEditor:
self.form.blockSignals(False)
def setupUi(self):
self.editor.setupUI()
self.form.tcName.editingFinished.connect(self.refresh)
self.form.horizFeed.editingFinished.connect(self.refresh)
self.form.vertFeed.editingFinished.connect(self.refresh)
self.form.horizRapid.editingFinished.connect(self.refresh)
self.form.vertRapid.editingFinished.connect(self.refresh)
self.form.toolName.editingFinished.connect(self.refresh)
self.form.toolDiameter.editingFinished.connect(self.refresh)
self.form.toolLengthOffset.editingFinished.connect(self.refresh)
self.form.toolFlatRadius.editingFinished.connect(self.refresh)
self.form.toolCornerRadius.editingFinished.connect(self.refresh)
self.form.toolCuttingEdgeAngle.editingFinished.connect(self.refresh)
self.form.toolCuttingEdgeHeight.editingFinished.connect(self.refresh)
class TaskPanel: