| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | __title__ = "FreeCAD FEM postprocessing view for summarizing extractor links" |
| | __author__ = "Stefan Tröger" |
| | __url__ = "https://www.freecad.org" |
| |
|
| | |
| | |
| | |
| |
|
| | from PySide import QtGui, QtCore |
| |
|
| | import femobjects.base_fempostextractors as extr |
| | import femobjects.base_fempostvisualizations as vis |
| |
|
| | import FreeCAD |
| | import FreeCADGui |
| |
|
| | from . import post_visualization as pv |
| |
|
| | translate = FreeCAD.Qt.translate |
| |
|
| | |
| | |
| |
|
| |
|
| | def build_new_visualization_tree_model(): |
| | |
| |
|
| | model = QtGui.QStandardItemModel() |
| |
|
| | visualizations = pv.get_registered_visualizations() |
| | for vis_name in visualizations: |
| | vis_icon = FreeCADGui.getIcon(visualizations[vis_name].icon) |
| | vis_item = QtGui.QStandardItem(vis_icon, translate("FEM", "New {}").format(vis_name)) |
| | vis_item.setFlags(QtGui.Qt.ItemIsEnabled) |
| | vis_item.setData(visualizations[vis_name]) |
| |
|
| | for ext in visualizations[vis_name].extractions: |
| | icon = FreeCADGui.getIcon(ext.icon) |
| | name = ext.name.removeprefix(vis_name) |
| | ext_item = QtGui.QStandardItem(icon, translate("FEM", "with {}").format(name)) |
| | ext_item.setFlags(QtGui.Qt.ItemIsEnabled) |
| | ext_item.setData(ext) |
| | vis_item.appendRow(ext_item) |
| | model.appendRow(vis_item) |
| |
|
| | return model |
| |
|
| |
|
| | def build_add_to_visualization_tree_model(): |
| | |
| |
|
| | visualizations = pv.get_registered_visualizations() |
| | model = QtGui.QStandardItemModel() |
| |
|
| | for obj in FreeCAD.ActiveDocument.Objects: |
| | if obj.isDerivedFrom("Fem::FemAnalysis"): |
| | ana_item = QtGui.QStandardItem(obj.ViewObject.Icon, obj.Label) |
| | ana_item.setFlags(QtGui.Qt.ItemIsEnabled) |
| |
|
| | |
| | for child in obj.Group: |
| | if vis.is_visualization_object(child): |
| |
|
| | vis_item = QtGui.QStandardItem(child.ViewObject.Icon, child.Label) |
| | vis_type = vis.get_visualization_type(child) |
| | vis_item.setFlags(QtGui.Qt.ItemIsEnabled) |
| | vis_item.setData(child) |
| | ana_item.appendRow(vis_item) |
| |
|
| | |
| | for ext in visualizations[vis_type].extractions: |
| | icon = FreeCADGui.getIcon(ext.icon) |
| | name = ext.name.removeprefix(vis_type) |
| | ext_item = QtGui.QStandardItem( |
| | icon, translate("FEM", "Add {}").format(name) |
| | ) |
| | ext_item.setFlags(QtGui.Qt.ItemIsEnabled) |
| | ext_item.setData(ext) |
| | vis_item.appendRow(ext_item) |
| |
|
| | if ana_item.rowCount(): |
| | model.appendRow(ana_item) |
| |
|
| | return model |
| |
|
| |
|
| | def build_post_object_item(post_object, extractions, vis_type): |
| |
|
| | |
| | post_item = QtGui.QStandardItem( |
| | post_object.ViewObject.Icon, translate("FEM", "From {}").format(post_object.Label) |
| | ) |
| | post_item.setFlags(QtGui.Qt.ItemIsEnabled) |
| | post_item.setData(post_object) |
| |
|
| | |
| | for ext in extractions: |
| | icon = FreeCADGui.getIcon(ext.icon) |
| | name = ext.name.removeprefix(vis_type) |
| | ext_item = QtGui.QStandardItem(icon, translate("FEM", "add {}").format(name)) |
| | ext_item.setFlags(QtGui.Qt.ItemIsEnabled) |
| | ext_item.setData(ext) |
| | post_item.appendRow(ext_item) |
| |
|
| | |
| | if post_object.hasExtension("Fem::FemPostGroupExtension"): |
| |
|
| | for child in post_object.Group: |
| | if child.isDerivedFrom("Fem::FemPostObject"): |
| | item = build_post_object_item(child, extractions, vis_type) |
| | post_item.appendRow(item) |
| |
|
| | return post_item |
| |
|
| |
|
| | def build_add_from_data_tree_model(vis_type): |
| | |
| | extractions = pv.get_registered_visualizations()[vis_type].extractions |
| |
|
| | model = QtGui.QStandardItemModel() |
| | for obj in FreeCAD.ActiveDocument.Objects: |
| | if obj.isDerivedFrom("Fem::FemAnalysis"): |
| | ana_item = QtGui.QStandardItem(obj.ViewObject.Icon, obj.Label) |
| | ana_item.setFlags(QtGui.Qt.ItemIsEnabled) |
| |
|
| | |
| | for child in obj.Group: |
| | if child.isDerivedFrom("Fem::FemPostObject"): |
| | item = build_post_object_item(child, extractions, vis_type) |
| | ana_item.appendRow(item) |
| |
|
| | if ana_item.rowCount(): |
| | model.appendRow(ana_item) |
| |
|
| | return model |
| |
|
| |
|
| | |
| | |
| |
|
| |
|
| | class _ElideToolButton(QtGui.QToolButton): |
| | |
| |
|
| | def __init__(self, icon, text, parent): |
| | super().__init__(parent) |
| |
|
| | self._text = text |
| | self._icon = icon |
| |
|
| | def setCustomText(self, text): |
| | self._text = text |
| | self.repaint() |
| |
|
| | def setCustomIcon(self, icon): |
| | self._icon = icon |
| | self.repaint() |
| |
|
| | def sizeHint(self): |
| | button_size = super().sizeHint() |
| | icn_size = self.iconSize() |
| | min_margin = max((button_size - icn_size).height(), 6) |
| | return QtCore.QSize(self.iconSize().width() + 10, icn_size.height() + min_margin) |
| |
|
| | def paintEvent(self, event): |
| |
|
| | |
| | super().paintEvent(event) |
| |
|
| | |
| | painter = QtGui.QPainter() |
| | painter.begin(self) |
| | painter.setRenderHint(QtGui.QPainter.Antialiasing, True) |
| | painter.setRenderHint(QtGui.QPainter.SmoothPixmapTransform, True) |
| |
|
| | margin = (self.height() - self.iconSize().height()) / 2 |
| | icn_width = self.iconSize().width() |
| | if self._icon.isNull(): |
| | icn_width = 0 |
| |
|
| | fm = self.fontMetrics() |
| | txt_size = self.width() - icn_width - 2 * margin |
| | if not self._icon.isNull(): |
| | |
| | txt_size -= margin |
| |
|
| | txt_min = fm.boundingRect("…").width() |
| |
|
| | |
| | xpos = margin |
| | if not self._icon.isNull() and txt_size < txt_min: |
| | |
| | xpos = self.width() / 2 - self.iconSize().width() / 2 |
| |
|
| | if not self._icon.isNull(): |
| | match type(self._icon): |
| | case QtGui.QPixmap: |
| | painter.drawPixmap(xpos, margin, self._icon.scaled(self.iconSize())) |
| | xpos += self.iconSize().width() |
| | case QtGui.QIcon: |
| | self._icon.paint( |
| | painter, QtCore.QRect(QtCore.QPoint(margin, margin), self.iconSize()) |
| | ) |
| | xpos += self.iconSize().width() |
| |
|
| | xpos += margin |
| |
|
| | if txt_size >= txt_min: |
| | text = fm.elidedText(self._text, QtGui.Qt.ElideMiddle, txt_size) |
| | painter.drawText(xpos, margin + fm.ascent(), text) |
| |
|
| | painter.end() |
| |
|
| |
|
| | class _TreeChoiceButton(QtGui.QToolButton): |
| |
|
| | selection = QtCore.Signal(object, object) |
| |
|
| | def __init__(self, model): |
| | super().__init__() |
| |
|
| | self.model = model |
| | self.setEnabled(bool(model.rowCount())) |
| |
|
| | self.__skip_next_hide = False |
| |
|
| | self.tree_view = QtGui.QTreeView(self) |
| | self.tree_view.setModel(model) |
| |
|
| | self.tree_view.setFrameShape(QtGui.QFrame.NoFrame) |
| | self.tree_view.setHeaderHidden(True) |
| | self.tree_view.setSelectionBehavior(QtGui.QTreeView.SelectionBehavior.SelectRows) |
| | self.tree_view.expandAll() |
| | self.tree_view.clicked.connect(self.selectIndex) |
| |
|
| | style = self.style() |
| | if not style.styleHint(QtGui.QStyle.SH_ItemView_ActivateItemOnSingleClick): |
| | self.tree_view.activated.connect(self.selectIndex) |
| |
|
| | |
| | self.popup = QtGui.QWidgetAction(self) |
| | self.popup.setDefaultWidget(self.tree_view) |
| | self.setPopupMode(QtGui.QToolButton.InstantPopup) |
| | self.addAction(self.popup) |
| |
|
| | QtCore.Slot(QtCore.QModelIndex) |
| |
|
| | def selectIndex(self, index): |
| | item = self.model.itemFromIndex(index) |
| |
|
| | if item and not item.hasChildren(): |
| | extraction = item.data() |
| | parent = item.parent().data() |
| | self.selection.emit(parent, extraction) |
| | self.popup.trigger() |
| |
|
| | def setModel(self, model): |
| | self.model = model |
| | self.tree_view.setModel(model) |
| | self.tree_view.expandAll() |
| |
|
| | |
| | self.setEnabled(bool(model.rowCount())) |
| |
|
| |
|
| | class _SettingsPopup(QtGui.QMenu): |
| |
|
| | close = QtCore.Signal() |
| |
|
| | def __init__(self, setting, parent): |
| | super().__init__(parent) |
| |
|
| | self._setting = setting |
| | self.setWindowFlags(QtGui.Qt.Popup) |
| | self.setFocusPolicy(QtGui.Qt.ClickFocus) |
| |
|
| | vbox = QtGui.QVBoxLayout() |
| | vbox.addWidget(setting) |
| |
|
| | buttonBox = QtGui.QDialogButtonBox() |
| | buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok) |
| | buttonBox.accepted.connect(self.hide) |
| | vbox.addWidget(buttonBox) |
| |
|
| | widget = QtGui.QFrame() |
| | widget.setLayout(vbox) |
| |
|
| | vbox2 = QtGui.QVBoxLayout() |
| | vbox2.setContentsMargins(0, 0, 0, 0) |
| | vbox2.addWidget(widget) |
| | self.setLayout(vbox2) |
| |
|
| | def size(self): |
| | return self._setting.sizeHint() |
| |
|
| | def showEvent(self, event): |
| | |
| | self.setFocus() |
| |
|
| | def hideEvent(self, event): |
| | |
| | |
| | self.close.emit() |
| |
|
| | def keyPressEvent(self, event): |
| | |
| | if event.key() == QtGui.Qt.Key_Enter or event.key() == QtGui.Qt.Key_Return: |
| | self.hide() |
| |
|
| |
|
| | class _SummaryWidget(QtGui.QWidget): |
| |
|
| | delete = QtCore.Signal(object, object) |
| |
|
| | def __init__(self, st_object, extractor, post_dialog): |
| | super().__init__() |
| |
|
| | self._st_object = st_object |
| | self._extractor = extractor |
| | self._post_dialog = post_dialog |
| |
|
| | extr_label = extractor.Proxy.get_representive_fieldname(extractor) |
| | extr_repr = extractor.ViewObject.Proxy.get_preview() |
| |
|
| | |
| | hbox = QtGui.QHBoxLayout() |
| | hbox.setContentsMargins(6, 0, 6, 0) |
| | hbox.setSpacing(2) |
| |
|
| | self.extrButton = self._button(extractor.ViewObject.Icon, extr_label) |
| | self.viewButton = self._button(extr_repr[0], extr_repr[1], 1) |
| |
|
| | size = self.viewButton.iconSize() |
| | size.setWidth(size.width() * 2) |
| | self.viewButton.setIconSize(size) |
| |
|
| | if st_object: |
| | self.stButton = self._button(st_object.ViewObject.Icon, st_object.Label) |
| | hbox.addWidget(self.stButton) |
| |
|
| | else: |
| | |
| | |
| | self.extrButton.hide() |
| | self.viewButton.hide() |
| |
|
| | self.warning = QtGui.QLabel(self) |
| | self.warning.full_text = translate("FEM", "{}: Data source not available").format( |
| | extractor.Label |
| | ) |
| | hbox.addWidget(self.warning) |
| |
|
| | self.rmButton = QtGui.QToolButton(self) |
| | self.rmButton.setIcon(FreeCADGui.getIcon("delete.svg")) |
| | self.rmButton.setAutoRaise(True) |
| |
|
| | hbox.addWidget(self.extrButton) |
| | hbox.addWidget(self.viewButton) |
| | hbox.addSpacing(15) |
| | hbox.addWidget(self.rmButton) |
| |
|
| | |
| | vbox = QtGui.QVBoxLayout() |
| | vbox.setContentsMargins(0, 0, 0, 0) |
| | vbox.setSpacing(5) |
| | vbox.addItem(hbox) |
| | self.frame = QtGui.QFrame(self) |
| | self.frame.setFrameShape(QtGui.QFrame.HLine) |
| | vbox.addWidget(self.frame) |
| |
|
| | policy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) |
| | self.setSizePolicy(policy) |
| | |
| | self.setLayout(vbox) |
| |
|
| | |
| | |
| | if st_object: |
| | self.stButton.clicked.connect(self.showVisualization) |
| | self.extrButton.clicked.connect(self.editApp) |
| | self.viewButton.clicked.connect(self.editView) |
| |
|
| | self.rmButton.clicked.connect(self.deleteTriggered) |
| |
|
| | |
| | |
| |
|
| | def _button(self, icon, text, stretch=2): |
| |
|
| | btn = _ElideToolButton(icon, text, self) |
| | btn.setMinimumWidth(0) |
| | btn.setAutoRaise(True) |
| | btn.setToolTip(text) |
| |
|
| | policy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) |
| | policy.setHorizontalStretch(stretch) |
| | btn.setSizePolicy(policy) |
| | return btn |
| |
|
| | @QtCore.Slot() |
| | def showVisualization(self): |
| | if vis.is_visualization_object(self._st_object): |
| | |
| | self._st_object.ViewObject.Proxy.show_visualization() |
| | else: |
| | |
| | FreeCADGui.Selection.clearSelection() |
| | FreeCADGui.Selection.addSelection(self._st_object) |
| |
|
| | def _position_dialog(self, dialog): |
| |
|
| | |
| | |
| | |
| | |
| |
|
| | summary = dialog.parent() |
| | base_widget = summary.parent() |
| | viewport = summary.parent() |
| | scroll = viewport.parent() |
| |
|
| | top_left = ( |
| | summary.geometry().topLeft() |
| | + base_widget.geometry().topLeft() |
| | + viewport.geometry().topLeft() |
| | ) |
| | delta = (summary.width() - dialog.size().width()) / 2 |
| | local_point = QtCore.QPoint(top_left.x() + delta, top_left.y() + summary.height()) |
| | global_point = scroll.mapToGlobal(local_point) |
| |
|
| | dialog.setGeometry(QtCore.QRect(global_point, dialog.sizeHint())) |
| |
|
| | @QtCore.Slot() |
| | def editApp(self): |
| | if not hasattr(self, "appDialog"): |
| | widget = self._extractor.ViewObject.Proxy.get_app_edit_widget(self._post_dialog) |
| | self.appDialog = _SettingsPopup(widget, self) |
| | self.appDialog.close.connect(self.appAccept) |
| |
|
| | if not self.appDialog.isVisible(): |
| | |
| | self._position_dialog(self.appDialog) |
| | self.appDialog.show() |
| |
|
| | @QtCore.Slot() |
| | def editView(self): |
| |
|
| | if not hasattr(self, "viewDialog"): |
| | widget = self._extractor.ViewObject.Proxy.get_view_edit_widget(self._post_dialog) |
| | self.viewDialog = _SettingsPopup(widget, self) |
| | self.viewDialog.close.connect(self.viewAccept) |
| |
|
| | if not self.viewDialog.isVisible(): |
| | |
| | self._position_dialog(self.viewDialog) |
| | self.viewDialog.show() |
| |
|
| | @QtCore.Slot() |
| | def deleteTriggered(self): |
| | self.delete.emit(self._extractor, self) |
| |
|
| | @QtCore.Slot() |
| | def viewAccept(self): |
| |
|
| | |
| | extr_repr = self._extractor.ViewObject.Proxy.get_preview() |
| | self.viewButton.setCustomIcon(extr_repr[0]) |
| | self.viewButton.setCustomText(extr_repr[1]) |
| | self.viewButton.setToolTip(extr_repr[1]) |
| |
|
| | @QtCore.Slot() |
| | def appAccept(self): |
| |
|
| | |
| | extr_label = self._extractor.Proxy.get_representive_fieldname(self._extractor) |
| | self.extrButton.setCustomText(extr_label) |
| | self.extrButton.setToolTip(extr_label) |
| |
|
| |
|
| | class ExtractLinkView(QtGui.QWidget): |
| |
|
| | def __init__(self, obj, is_source, post_dialog): |
| | |
| | |
| | |
| |
|
| | super().__init__() |
| |
|
| | self._object = obj |
| | self._is_source = is_source |
| | self._post_dialog = post_dialog |
| | self._widgets = [] |
| |
|
| | |
| | self._scroll_view = QtGui.QScrollArea(self) |
| | self._scroll_view.setHorizontalScrollBarPolicy(QtGui.Qt.ScrollBarAlwaysOff) |
| | self._scroll_view.setWidgetResizable(True) |
| | self._scroll_widget = QtGui.QWidget(self._scroll_view) |
| | vbox = QtGui.QVBoxLayout() |
| | vbox.setContentsMargins(0, 6, 0, 0) |
| | vbox.addStretch() |
| | self._scroll_widget.setLayout(vbox) |
| | self._scroll_view.setWidget(self._scroll_widget) |
| |
|
| | hbox = QtGui.QHBoxLayout() |
| | hbox.setSpacing(6) |
| | label = QtGui.QLabel(translate("FEM", "Data used in:")) |
| | if not self._is_source: |
| | label.setText(translate("FEM", "Data used from:")) |
| |
|
| | label.setAlignment(QtGui.Qt.AlignBottom) |
| | hbox.addWidget(label) |
| | hbox.addStretch() |
| |
|
| | if self._is_source: |
| |
|
| | self._add = _TreeChoiceButton(build_add_to_visualization_tree_model()) |
| | self._add.setText(translate("FEM", "Add data to")) |
| | self._add.selection.connect(self.addExtractionToVisualization) |
| | hbox.addWidget(self._add) |
| |
|
| | self._create = _TreeChoiceButton(build_new_visualization_tree_model()) |
| | self._create.setText(translate("FEM", "New")) |
| | self._create.selection.connect(self.newVisualization) |
| | hbox.addWidget(self._create) |
| |
|
| | else: |
| | vis_type = vis.get_visualization_type(self._object) |
| | self._add = _TreeChoiceButton(build_add_from_data_tree_model(vis_type)) |
| | self._add.setText(translate("FEM", "Add data from")) |
| | self._add.selection.connect(self.addExtractionToPostObject) |
| | hbox.addWidget(self._add) |
| |
|
| | vbox = QtGui.QVBoxLayout() |
| | vbox.setContentsMargins(0, 0, 0, 0) |
| | vbox.addItem(hbox) |
| | vbox.addWidget(self._scroll_view) |
| |
|
| | self.setLayout(vbox) |
| |
|
| | |
| | self.repopulate() |
| |
|
| | def _build_summary_widget(self, extractor): |
| |
|
| | if self._is_source: |
| | st_object = extractor.getParentGroup() |
| | else: |
| | st_object = extractor.Source |
| |
|
| | widget = _SummaryWidget(st_object, extractor, self._post_dialog) |
| | widget.delete.connect(self._delete_extraction) |
| |
|
| | return widget |
| |
|
| | def _delete_extraction(self, extractor, widget): |
| | |
| | doc = extractor.Document |
| | doc.removeObject(extractor.Name) |
| | doc.recompute() |
| |
|
| | |
| | self._widgets.remove(widget) |
| | widget.deleteLater() |
| |
|
| | def repopulate(self): |
| | |
| |
|
| | |
| | for widget in self._widgets: |
| | widget.hide() |
| | widget.deleteLater() |
| |
|
| | self._widgets = [] |
| |
|
| | |
| |
|
| | if self._is_source: |
| | candidates = self._object.InList |
| | else: |
| | candidates = self._object.OutList |
| |
|
| | |
| | for candidate in candidates: |
| | if extr.is_extractor_object(candidate): |
| | summary = self._build_summary_widget(candidate) |
| | self._widgets.append(summary) |
| |
|
| | |
| | vbox = self._scroll_widget.layout() |
| | for widget in reversed(self._widgets): |
| | vbox.insertWidget(0, widget) |
| |
|
| | |
| | if self._is_source: |
| | self._add.setModel(build_add_to_visualization_tree_model()) |
| |
|
| | def _find_parent_analysis(self, obj): |
| | |
| | for parent in obj.InList: |
| | if parent.isDerivedFrom("Fem::FemAnalysis"): |
| | return parent |
| |
|
| | analysis = self._find_parent_analysis(parent) |
| | if analysis: |
| | return analysis |
| |
|
| | return None |
| |
|
| | QtCore.Slot(object, object) |
| |
|
| | def newVisualization(self, vis_data, ext_data): |
| |
|
| | FreeCADGui.addModule(vis_data.module) |
| | FreeCADGui.addModule(ext_data.module) |
| | FreeCADGui.addModule("FemGui") |
| |
|
| | |
| | FreeCADGui.doCommand( |
| | f"visualization = {vis_data.module}.{vis_data.factory}(FreeCAD.ActiveDocument)" |
| | ) |
| |
|
| | analysis = self._find_parent_analysis(self._object) |
| | if analysis: |
| | FreeCADGui.doCommand(f"FreeCAD.ActiveDocument.{analysis.Name}.addObject(visualization)") |
| |
|
| | |
| | FreeCADGui.doCommand( |
| | f"extraction = {ext_data.module}.{ext_data.factory}(FreeCAD.ActiveDocument)" |
| | ) |
| | FreeCADGui.doCommand(f"extraction.Source = FreeCAD.ActiveDocument.{self._object.Name}") |
| | |
| | color_prop = FreeCADGui.ActiveDocument.ActiveObject.Proxy.get_default_color_property() |
| | if color_prop: |
| | FreeCADGui.doCommand( |
| | f"extraction.ViewObject.{color_prop} = visualization.ViewObject.Proxy.get_next_default_color()" |
| | ) |
| |
|
| | FreeCADGui.doCommand(f"visualization.addObject(extraction)") |
| |
|
| | self._post_dialog._recompute() |
| | self.repopulate() |
| |
|
| | QtCore.Slot(object, object) |
| |
|
| | def addExtractionToVisualization(self, vis_obj, ext_data): |
| |
|
| | FreeCADGui.addModule(ext_data.module) |
| | FreeCADGui.addModule("FemGui") |
| |
|
| | |
| | FreeCADGui.doCommand( |
| | f"extraction = {ext_data.module}.{ext_data.factory}(FreeCAD.ActiveDocument)" |
| | ) |
| | FreeCADGui.doCommand(f"extraction.Source = FreeCAD.ActiveDocument.{self._object.Name}") |
| |
|
| | |
| | color_prop = FreeCADGui.ActiveDocument.ActiveObject.Proxy.get_default_color_property() |
| | if color_prop: |
| | FreeCADGui.doCommand( |
| | f"extraction.ViewObject.{color_prop} = (Gui.ActiveDocument.{vis_obj.Name}.Proxy.get_next_default_color())" |
| | ) |
| |
|
| | FreeCADGui.doCommand(f"App.ActiveDocument.{vis_obj.Name}.addObject(extraction)") |
| |
|
| | self._post_dialog._recompute() |
| | self.repopulate() |
| |
|
| | QtCore.Slot(object, object) |
| |
|
| | def addExtractionToPostObject(self, post_obj, ext_data): |
| |
|
| | FreeCADGui.addModule(ext_data.module) |
| | FreeCADGui.addModule("FemGui") |
| |
|
| | |
| | FreeCADGui.doCommand( |
| | f"extraction = {ext_data.module}.{ext_data.factory}(FreeCAD.ActiveDocument)" |
| | ) |
| | FreeCADGui.doCommand(f"extraction.Source = FreeCAD.ActiveDocument.{post_obj.Name}") |
| |
|
| | |
| | color_prop = FreeCADGui.ActiveDocument.ActiveObject.Proxy.get_default_color_property() |
| | if color_prop: |
| | FreeCADGui.doCommand( |
| | f"extraction.ViewObject.{color_prop} = Gui.ActiveDocument.{self._object.Name}.Proxy.get_next_default_color()" |
| | ) |
| |
|
| | FreeCADGui.doCommand(f"App.ActiveDocument.{self._object.Name}.addObject(extraction)") |
| |
|
| | self._post_dialog._recompute() |
| | self.repopulate() |
| |
|