Path: Consolidate Contour, ProfileFaces, and ProfileEdges
No geometry selection defaults to Contour operation. Path: Add new unified `Profile` operation modules
This commit is contained in:
1393
src/Mod/Path/PathScripts/PathProfile.py
Normal file
1393
src/Mod/Path/PathScripts/PathProfile.py
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,53 +1,53 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2017 sliptonic <shopinthewoods@gmail.com> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
import FreeCAD
|
||||
import PathScripts.PathOpGui as PathOpGui
|
||||
import PathScripts.PathProfileBaseGui as PathProfileBaseGui
|
||||
import PathScripts.PathProfileFaces as PathProfileFaces
|
||||
|
||||
from PySide import QtCore
|
||||
|
||||
__title__ = "Path Profile based on faces Operation UI"
|
||||
__author__ = "sliptonic (Brad Collette)"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
__doc__ = "Profile based on faces operation page controller and command implementation."
|
||||
|
||||
class TaskPanelOpPage(PathProfileBaseGui.TaskPanelOpPage):
|
||||
'''Page controller for profile based on faces operation.'''
|
||||
|
||||
def profileFeatures(self):
|
||||
'''profileFeatures() ... return FeatureSide | FeatureProcessing.
|
||||
See PathProfileBaseGui.py for details.'''
|
||||
return PathProfileBaseGui.FeatureSide | PathProfileBaseGui.FeatureProcessing
|
||||
|
||||
Command = PathOpGui.SetupOperation('Profile Faces',
|
||||
PathProfileFaces.Create,
|
||||
TaskPanelOpPage,
|
||||
'Path-Profile-Face',
|
||||
QtCore.QT_TRANSLATE_NOOP("PathProfile", "Face Profile"),
|
||||
QtCore.QT_TRANSLATE_NOOP("PathProfile", "Profile based on face or faces"),
|
||||
PathProfileFaces.SetupProperties)
|
||||
|
||||
FreeCAD.Console.PrintLog("Loading PathProfileFacesGui... done\n")
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2017 sliptonic <shopinthewoods@gmail.com> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
import FreeCAD
|
||||
import PathScripts.PathOpGui as PathOpGui
|
||||
import PathScripts.PathProfileBaseGui as PathProfileBaseGui
|
||||
import PathScripts.PathProfileFaces as PathProfileFaces
|
||||
|
||||
from PySide import QtCore
|
||||
|
||||
__title__ = "Path Profile based on faces Operation UI"
|
||||
__author__ = "sliptonic (Brad Collette)"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
__doc__ = "Profile based on faces operation page controller and command implementation."
|
||||
|
||||
class TaskPanelOpPage(PathProfileBaseGui.TaskPanelOpPage):
|
||||
'''Page controller for profile based on faces operation.'''
|
||||
|
||||
def profileFeatures(self):
|
||||
'''profileFeatures() ... return FeatureSide | FeatureProcessing.
|
||||
See PathProfileBaseGui.py for details.'''
|
||||
return PathProfileBaseGui.FeatureSide | PathProfileBaseGui.FeatureProcessing
|
||||
|
||||
Command = PathOpGui.SetupOperation('Profile Faces',
|
||||
PathProfileFaces.Create,
|
||||
TaskPanelOpPage,
|
||||
'Path-Profile-Face',
|
||||
QtCore.QT_TRANSLATE_NOOP("PathProfile", "Face Profile"),
|
||||
QtCore.QT_TRANSLATE_NOOP("PathProfile", "Profile based on face or faces"),
|
||||
PathProfileFaces.SetupProperties)
|
||||
|
||||
FreeCAD.Console.PrintLog("Loading PathProfileFacesGui... done\n")
|
||||
|
||||
173
src/Mod/Path/PathScripts/PathProfileGui.py
Normal file
173
src/Mod/Path/PathScripts/PathProfileGui.py
Normal file
@@ -0,0 +1,173 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2017 sliptonic <shopinthewoods@gmail.com> *
|
||||
# * *
|
||||
# * This program is free software; you can redistribute it and/or modify *
|
||||
# * it under the terms of the GNU Lesser General Public License (LGPL) *
|
||||
# * as published by the Free Software Foundation; either version 2 of *
|
||||
# * the License, or (at your option) any later version. *
|
||||
# * for detail see the LICENCE text file. *
|
||||
# * *
|
||||
# * This program is distributed in the hope that it will be useful, *
|
||||
# * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
# * GNU Library General Public License for more details. *
|
||||
# * *
|
||||
# * You should have received a copy of the GNU Library General Public *
|
||||
# * License along with this program; if not, write to the Free Software *
|
||||
# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
import PathScripts.PathGui as PathGui
|
||||
import PathScripts.PathOpGui as PathOpGui
|
||||
import PathScripts.PathProfileFaces as PathProfileFaces
|
||||
|
||||
from PySide import QtCore
|
||||
|
||||
|
||||
__title__ = "Path Profile Operation UI"
|
||||
__author__ = "sliptonic (Brad Collette)"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
__doc__ = "Profile operation page controller and command implementation."
|
||||
|
||||
|
||||
FeatureSide = 0x01
|
||||
FeatureProcessing = 0x02
|
||||
|
||||
def translate(context, text, disambig=None):
|
||||
return QtCore.QCoreApplication.translate(context, text, disambig)
|
||||
|
||||
|
||||
class TaskPanelOpPage(PathOpGui.TaskPanelPage):
|
||||
'''Base class for profile operation page controllers. Two sub features are supported:
|
||||
FeatureSide ... Is the Side property exposed in the UI
|
||||
FeatureProcessing ... Are the processing check boxes supported by the operation
|
||||
'''
|
||||
|
||||
def initPage(self, obj):
|
||||
self.updateVisibility(obj)
|
||||
|
||||
def profileFeatures(self):
|
||||
'''profileFeatures() ... return which of the optional profile features are supported.
|
||||
Currently two features are supported and returned:
|
||||
FeatureSide ... Is the Side property exposed in the UI
|
||||
FeatureProcessing ... Are the processing check boxes supported by the operation
|
||||
.'''
|
||||
return FeatureSide | FeatureProcessing
|
||||
|
||||
def getForm(self):
|
||||
'''getForm() ... returns UI customized according to profileFeatures()'''
|
||||
form = FreeCADGui.PySideUic.loadUi(":/panels/PageOpProfileFullEdit.ui")
|
||||
return form
|
||||
|
||||
def getFields(self, obj):
|
||||
'''getFields(obj) ... transfers values from UI to obj's proprties'''
|
||||
self.updateToolController(obj, self.form.toolController)
|
||||
self.updateCoolant(obj, self.form.coolantController)
|
||||
|
||||
if obj.Side != str(self.form.cutSide.currentText()):
|
||||
obj.Side = str(self.form.cutSide.currentText())
|
||||
if obj.Direction != str(self.form.direction.currentText()):
|
||||
obj.Direction = str(self.form.direction.currentText())
|
||||
PathGui.updateInputField(obj, 'OffsetExtra', self.form.extraOffset)
|
||||
if obj.EnableRotation != str(self.form.enableRotation.currentText()):
|
||||
obj.EnableRotation = str(self.form.enableRotation.currentText())
|
||||
|
||||
if obj.UseComp != self.form.useCompensation.isChecked():
|
||||
obj.UseComp = self.form.useCompensation.isChecked()
|
||||
if obj.UseStartPoint != self.form.useStartPoint.isChecked():
|
||||
obj.UseStartPoint = self.form.useStartPoint.isChecked()
|
||||
|
||||
if obj.processHoles != self.form.processHoles.isChecked():
|
||||
obj.processHoles = self.form.processHoles.isChecked()
|
||||
if obj.processPerimeter != self.form.processPerimeter.isChecked():
|
||||
obj.processPerimeter = self.form.processPerimeter.isChecked()
|
||||
if obj.processCircles != self.form.processCircles.isChecked():
|
||||
obj.processCircles = self.form.processCircles.isChecked()
|
||||
|
||||
def setFields(self, obj):
|
||||
'''setFields(obj) ... transfers obj's property values to UI'''
|
||||
self.setupToolController(obj, self.form.toolController)
|
||||
self.setupCoolant(obj, self.form.coolantController)
|
||||
|
||||
self.selectInComboBox(obj.Side, self.form.cutSide)
|
||||
self.selectInComboBox(obj.Direction, self.form.direction)
|
||||
self.form.extraOffset.setText(FreeCAD.Units.Quantity(obj.OffsetExtra.Value, FreeCAD.Units.Length).UserString)
|
||||
self.selectInComboBox(obj.EnableRotation, self.form.enableRotation)
|
||||
|
||||
self.form.useCompensation.setChecked(obj.UseComp)
|
||||
self.form.useStartPoint.setChecked(obj.UseStartPoint)
|
||||
self.form.processHoles.setChecked(obj.processHoles)
|
||||
self.form.processPerimeter.setChecked(obj.processPerimeter)
|
||||
self.form.processCircles.setChecked(obj.processCircles)
|
||||
|
||||
self.updateVisibility(obj)
|
||||
|
||||
def getSignalsForUpdate(self, obj):
|
||||
'''getSignalsForUpdate(obj) ... return list of signals for updating obj'''
|
||||
signals = []
|
||||
signals.append(self.form.toolController.currentIndexChanged)
|
||||
signals.append(self.form.coolantController.currentIndexChanged)
|
||||
signals.append(self.form.cutSide.currentIndexChanged)
|
||||
signals.append(self.form.direction.currentIndexChanged)
|
||||
signals.append(self.form.extraOffset.editingFinished)
|
||||
signals.append(self.form.enableRotation.currentIndexChanged)
|
||||
signals.append(self.form.useCompensation.stateChanged)
|
||||
signals.append(self.form.useStartPoint.stateChanged)
|
||||
signals.append(self.form.processHoles.stateChanged)
|
||||
signals.append(self.form.processPerimeter.stateChanged)
|
||||
signals.append(self.form.processCircles.stateChanged)
|
||||
|
||||
return signals
|
||||
|
||||
def updateVisibility(self, obj):
|
||||
hasFace = False
|
||||
fullModel = False
|
||||
if len(obj.Base) > 0:
|
||||
for (base, subsList) in obj.Base:
|
||||
for sub in subsList:
|
||||
if sub[:4] == 'Face':
|
||||
hasFace = True
|
||||
break
|
||||
else:
|
||||
fullModel = True
|
||||
|
||||
if hasFace:
|
||||
self.form.processCircles.show()
|
||||
self.form.processHoles.show()
|
||||
self.form.processPerimeter.show()
|
||||
else:
|
||||
self.form.processCircles.hide()
|
||||
self.form.processHoles.hide()
|
||||
self.form.processPerimeter.hide()
|
||||
|
||||
if self.form.useCompensation.isChecked() is True and not fullModel:
|
||||
self.form.cutSide.show()
|
||||
self.form.cutSideLabel.show()
|
||||
else:
|
||||
# Reset cutSide to 'Outside' for full model before hiding cutSide input
|
||||
if self.form.cutSide.currentText() == 'Inside':
|
||||
self.selectInComboBox('Outside', self.form.cutSide)
|
||||
self.form.cutSide.hide()
|
||||
self.form.cutSideLabel.hide()
|
||||
|
||||
def registerSignalHandlers(self, obj):
|
||||
self.form.useCompensation.stateChanged.connect(self.updateVisibility)
|
||||
# Eclass
|
||||
|
||||
|
||||
Command = PathOpGui.SetupOperation('Profile Faces',
|
||||
PathProfileFaces.Create,
|
||||
TaskPanelOpPage,
|
||||
'Path-Profile-Face',
|
||||
QtCore.QT_TRANSLATE_NOOP("PathProfile", "Face Profile"),
|
||||
QtCore.QT_TRANSLATE_NOOP("PathProfile", "Profile based on face or faces"),
|
||||
PathProfileFaces.SetupProperties)
|
||||
|
||||
FreeCAD.Console.PrintLog("Loading PathProfileFacesGui... done\n")
|
||||
Reference in New Issue
Block a user