Path: New feature - import base geometry from existing operations in Job
This feature allows the user to import base geometry from an existing operation in the same Job. The imported geometry is still passed through the shape type filter as if it were manually selected in the viewport. Path: Post-test updates
This commit is contained in:
@@ -16,27 +16,7 @@
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="clearBase">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Clears list of base geometries.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clear</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="deleteBase">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Remove the selected list items from the list of base geometries. The operation will not be applied to them.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QPushButton" name="addBase">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Add selected features to the list of base geometries for this operation.</p></body></html></string>
|
||||
@@ -46,20 +26,78 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="3">
|
||||
<item row="2" column="2">
|
||||
<widget class="QPushButton" name="clearBase">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Clears list of base geometries.</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Clear</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>All objects will be processed using the same operation properties</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QListWidget" name="baseList">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Select one or more features in the 3d view and press 'Add' to add them as the base items for this operation.</p><p><br/></p><p>Selected features can be deleted entirely.</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>All objects will be processed using the same operation properties</string>
|
||||
<item row="2" column="1">
|
||||
<widget class="QPushButton" name="deleteBase">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Remove the selected list items from the list of base geometries. The operation will not be applied to them.</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
<property name="text">
|
||||
<string>Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QPushButton" name="geometryImportButton">
|
||||
<property name="text">
|
||||
<string>Import</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QComboBox" name="geometryImportList">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>List of operations with Base Geometry in current Job.</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -197,6 +197,7 @@ class TaskPanelPage(object):
|
||||
'''__init__(obj, features) ... framework initialisation.
|
||||
Do not overwrite, implement initPage(obj) instead.'''
|
||||
self.obj = obj
|
||||
self.job = PathUtils.findParentJob(obj)
|
||||
self.form = self.getForm() # pylint: disable=assignment-from-no-return
|
||||
self.signalDirtyChanged = None
|
||||
self.setClean()
|
||||
@@ -416,7 +417,30 @@ class TaskPanelBaseGeometryPage(TaskPanelPage):
|
||||
self.panelTitle = 'Base Geometry'
|
||||
|
||||
def getForm(self):
|
||||
return FreeCADGui.PySideUic.loadUi(":/panels/PageBaseGeometryEdit.ui")
|
||||
panel = FreeCADGui.PySideUic.loadUi(":/panels/PageBaseGeometryEdit.ui")
|
||||
self.modifyPanel(panel)
|
||||
return panel
|
||||
|
||||
def modifyPanel(self, panel):
|
||||
# Determine if possible operations are available
|
||||
availableOps = list()
|
||||
ops = self.job.Operations.Group
|
||||
for op in ops:
|
||||
if hasattr(op, 'Base') and op.Base.__len__() > 0:
|
||||
availableOps.append(op.Label)
|
||||
|
||||
if availableOps.__len__() > 0:
|
||||
# Populate the operations list
|
||||
addInputs = True
|
||||
panel.geometryImportList.blockSignals(True)
|
||||
panel.geometryImportList.clear()
|
||||
availableOps.sort()
|
||||
for opLbl in availableOps:
|
||||
panel.geometryImportList.addItem(opLbl)
|
||||
panel.geometryImportList.blockSignals(False)
|
||||
else:
|
||||
panel.geometryImportList.hide()
|
||||
panel.geometryImportButton.hide()
|
||||
|
||||
def getTitle(self, obj):
|
||||
return translate("PathOp", "Base Geometry")
|
||||
@@ -542,11 +566,23 @@ class TaskPanelBaseGeometryPage(TaskPanelPage):
|
||||
self.setDirty()
|
||||
self.updatePanelVisibility('Operation', self.obj)
|
||||
|
||||
def importBaseGeometry(self):
|
||||
opLabel = str(self.form.geometryImportList.currentText())
|
||||
ops = FreeCAD.ActiveDocument.getObjectsByLabel(opLabel)
|
||||
if ops.__len__() > 1:
|
||||
msg = translate('PathOpGui', 'Mulitiple operations are labeled as')
|
||||
msg += " {}\n".format(opLabel)
|
||||
FreeCAD.Console.PrintWarning(msg)
|
||||
for (base, subList) in ops[0].Base:
|
||||
FreeCADGui.Selection.addSelection(base, subList)
|
||||
self.addBase()
|
||||
|
||||
def registerSignalHandlers(self, obj):
|
||||
self.form.baseList.itemSelectionChanged.connect(self.itemActivated)
|
||||
self.form.addBase.clicked.connect(self.addBase)
|
||||
self.form.deleteBase.clicked.connect(self.deleteBase)
|
||||
self.form.clearBase.clicked.connect(self.clearBase)
|
||||
self.form.geometryImportButton.clicked.connect(self.importBaseGeometry)
|
||||
|
||||
def pageUpdateData(self, obj, prop):
|
||||
if prop in ['Base']:
|
||||
|
||||
Reference in New Issue
Block a user