| | |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | """Provides GUI tools to create Facebinder objects. |
| | |
| | A facebinder is a surface or shell created from the face of a solid object. |
| | This tool allows extracting such faces to be used for other purposes |
| | including extruding solids from faces. |
| | """ |
| | |
| | |
| | |
| |
|
| | |
| | |
| | from PySide.QtCore import QT_TRANSLATE_NOOP |
| |
|
| | import FreeCAD as App |
| | import FreeCADGui as Gui |
| | import Draft_rc |
| | import draftguitools.gui_base_original as gui_base_original |
| | import draftguitools.gui_tool_utils as gui_tool_utils |
| |
|
| | from draftutils.messages import _msg |
| | from draftutils.translate import translate |
| |
|
| | |
| | True if Draft_rc.__name__ else False |
| |
|
| |
|
| | class Facebinder(gui_base_original.Creator): |
| | """Gui Command for the Facebinder tool.""" |
| |
|
| | def GetResources(self): |
| | """Set icon, menu and tooltip.""" |
| |
|
| | return { |
| | "Pixmap": "Draft_Facebinder", |
| | "Accel": "F,F", |
| | "MenuText": QT_TRANSLATE_NOOP("Draft_Facebinder", "Facebinder"), |
| | "ToolTip": QT_TRANSLATE_NOOP( |
| | "Draft_Facebinder", "Creates a facebinder from the selected faces" |
| | ), |
| | } |
| |
|
| | def Activated(self): |
| | """Execute when the command is called.""" |
| | super().Activated(name="Facebinder") |
| | if not self.ui: |
| | return |
| | if not Gui.Selection.getSelection(): |
| | self.ui.selectUi(on_close_call=self.finish) |
| | _msg(translate("draft", "Select faces from existing objects")) |
| | self.call = self.view.addEventCallback("SoEvent", gui_tool_utils.selectObject) |
| | else: |
| | self.proceed() |
| |
|
| | def proceed(self): |
| | """Proceed when a valid selection has been made.""" |
| | if self.call is not None: |
| | self.end_callbacks(self.call) |
| | if Gui.Selection.getSelection(): |
| | App.ActiveDocument.openTransaction("Create Facebinder") |
| | Gui.addModule("Draft") |
| | Gui.doCommand("sels = FreeCADGui.Selection.getSelectionEx('', 0)") |
| | Gui.doCommand("facebinder = Draft.make_facebinder(sels)") |
| | Gui.doCommand("Draft.autogroup(facebinder)") |
| | Gui.doCommand("FreeCAD.ActiveDocument.recompute()") |
| | App.ActiveDocument.commitTransaction() |
| | App.ActiveDocument.recompute() |
| | self.finish() |
| |
|
| |
|
| | Draft_Facebinder = Facebinder |
| | Gui.addCommand("Draft_Facebinder", Facebinder()) |
| |
|
| | |
| |
|