From df53ad49cfb03e0b7e7feb81e302fe61fb92468d Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 12 Dec 2013 18:19:56 +0100 Subject: [PATCH] + For MeshGui remove dependency to MeshPartGui when loading the workbench --- src/Mod/Mesh/Gui/Command.cpp | 27 +++++++++++++++++++++++++++ src/Mod/Mesh/Gui/Workbench.cpp | 2 +- src/Mod/Mesh/InitGui.py | 4 ---- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/Mod/Mesh/Gui/Command.cpp b/src/Mod/Mesh/Gui/Command.cpp index 2a0f9075f..ba3828d95 100644 --- a/src/Mod/Mesh/Gui/Command.cpp +++ b/src/Mod/Mesh/Gui/Command.cpp @@ -448,6 +448,32 @@ bool CmdMeshFromGeometry::isActive(void) return getSelection().countObjectsOfType(App::GeoFeature::getClassTypeId()) >= 1; } +//=========================================================================== +// Mesh_FromPart +//=========================================================================== +DEF_STD_CMD_A(CmdMeshFromPartShape); + +CmdMeshFromPartShape::CmdMeshFromPartShape() + : Command("Mesh_FromPartShape") +{ + sAppModule = "Mesh"; + sGroup = QT_TR_NOOP("Mesh"); + sMenuText = QT_TR_NOOP("Create mesh from shape..."); + sToolTipText = QT_TR_NOOP("Tessellate shape"); + sWhatsThis = sToolTipText; + sStatusTip = sToolTipText; +} + +void CmdMeshFromPartShape::activated(int iMsg) +{ + doCommand(Doc,"import MeshPartGui, FreeCADGui\nFreeCADGui.runCommand('MeshPart_Mesher')\n"); +} + +bool CmdMeshFromPartShape::isActive(void) +{ + return (hasActiveDocument() && !Gui::Control().activeDialog()); +} + //-------------------------------------------------------------------------------------- DEF_STD_CMD_A(CmdMeshVertexCurvature); @@ -1542,5 +1568,6 @@ void CreateMeshCommands(void) rcCmdMgr.addCommand(new CmdMeshFillInteractiveHole()); rcCmdMgr.addCommand(new CmdMeshRemoveCompByHand()); rcCmdMgr.addCommand(new CmdMeshFromGeometry()); + rcCmdMgr.addCommand(new CmdMeshFromPartShape()); rcCmdMgr.addCommand(new CmdMeshSegmentation()); } diff --git a/src/Mod/Mesh/Gui/Workbench.cpp b/src/Mod/Mesh/Gui/Workbench.cpp index 227122213..12254a334 100644 --- a/src/Mod/Mesh/Gui/Workbench.cpp +++ b/src/Mod/Mesh/Gui/Workbench.cpp @@ -185,7 +185,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const *boolean << "Mesh_Union" << "Mesh_Intersection" << "Mesh_Difference"; mesh->setCommand("&Meshes"); - *mesh << "Mesh_Import" << "Mesh_Export" << "MeshPart_Mesher" << "Separator" + *mesh << "Mesh_Import" << "Mesh_Export" << "Mesh_FromPartShape" << "Separator" << analyze << "Mesh_HarmonizeNormals" << "Mesh_FlipNormals" << "Separator" << "Mesh_FillupHoles" << "Mesh_FillInteractiveHole" << "Mesh_RemoveComponents" << "Mesh_RemoveCompByHand" << "Mesh_AddFacet" << "Mesh_Smoothing" << "Separator" diff --git a/src/Mod/Mesh/InitGui.py b/src/Mod/Mesh/InitGui.py index e07f77730..d4620dedd 100644 --- a/src/Mod/Mesh/InitGui.py +++ b/src/Mod/Mesh/InitGui.py @@ -69,10 +69,6 @@ class MeshWorkbench ( Workbench ): def Initialize(self): # load the module import MeshGui - try: - import MeshPartGui - except: - pass def GetClassName(self): return "MeshGui::Workbench"