Added join to chamfer properties and UI.

This commit is contained in:
Markus Lampert
2018-06-17 23:58:15 -07:00
parent f4fbbfda07
commit 3b96eedd03
8 changed files with 541 additions and 29 deletions

View File

@@ -51,6 +51,8 @@ class ObjectChamfer(PathEngraveBase.ObjectOp):
def initOperation(self, obj):
obj.addProperty("App::PropertyDistance", "Width", "Chamfer", QtCore.QT_TRANSLATE_NOOP("PathChamfer", "The desired width of the chamfer"))
obj.addProperty("App::PropertyDistance", "ExtraDepth", "Chamfer", QtCore.QT_TRANSLATE_NOOP("PathChamfer", "The additional depth of the tool path"))
obj.addProperty("App::PropertyEnumeration", "Join", "Chamfer", QtCore.QT_TRANSLATE_NOOP("PathChamfer", "How to join chamfer segments"))
obj.Join = ['Round', 'Miter']
def opExecute(self, obj):
angle = self.tool.CuttingEdgeAngle
@@ -110,6 +112,7 @@ class ObjectChamfer(PathEngraveBase.ObjectOp):
def opSetDefaultValues(self, obj):
obj.Width = '1 mm'
obj.ExtraDepth = '0.1 mm'
obj.Join = 'Round'
def Create(name):
'''Create(name) ... Creates and returns a Chamfer operation.'''

View File

@@ -57,10 +57,20 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
self.opImagePath = "{}Mod/Path/Images/Ops/{}".format(FreeCAD.getHomePath(), 'chamfer.svg')
self.opImage = QtGui.QPixmap(self.opImagePath)
self.form.opImage.setPixmap(self.opImage)
iconMiter = QtGui.QIcon(':/icons/edge-join-miter-not.svg')
iconMiter.addFile(':/icons/edge-join-miter.svg', state=QtGui.QIcon.On)
iconRound = QtGui.QIcon(':/icons/edge-join-round-not.svg')
iconRound.addFile(':/icons/edge-join-round.svg', state=QtGui.QIcon.On)
self.form.joinMiter.setIcon(iconMiter)
self.form.joinRound.setIcon(iconRound)
def getFields(self, obj):
PathGui.updateInputField(obj, 'Width', self.form.value_W)
PathGui.updateInputField(obj, 'ExtraDepth', self.form.value_h)
if self.form.joinRound.isChecked():
obj.Join = 'Round'
elif self.form.joinMiter.isChecked():
obj.Join = 'Miter'
self.updateToolController(obj, self.form.toolController)
@@ -68,6 +78,8 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
self.form.value_W.setText(FreeCAD.Units.Quantity(obj.Width.Value, FreeCAD.Units.Length).UserString)
self.form.value_h.setText(FreeCAD.Units.Quantity(obj.ExtraDepth.Value, FreeCAD.Units.Length).UserString)
self.setupToolController(obj, self.form.toolController)
self.form.joinRound.setChecked('Round' == obj.Join)
self.form.joinMiter.setChecked('Miter' == obj.Join)
def updateWidth(self):
PathGui.updateInputField(self.obj, 'Width', self.form.value_W)
@@ -75,6 +87,12 @@ class TaskPanelOpPage(PathOpGui.TaskPanelPage):
def updateExtraDepth(self):
PathGui.updateInputField(self.obj, 'ExtraDepth', self.form.value_h)
def getSignalsForUpdate(self, obj):
signals = []
signals.append(self.form.joinMiter.clicked)
signals.append(self.form.joinRound.clicked)
return signals
def registerSignalHandlers(self, obj):
self.form.value_W.editingFinished.connect(self.updateWidth)
self.form.value_h.editingFinished.connect(self.updateExtraDepth)