diff --git a/src/Mod/Mesh/Gui/Workbench.cpp b/src/Mod/Mesh/Gui/Workbench.cpp index 89eece037a..b34c4e27a7 100644 --- a/src/Mod/Mesh/Gui/Workbench.cpp +++ b/src/Mod/Mesh/Gui/Workbench.cpp @@ -30,6 +30,8 @@ #endif #include "Workbench.h" +#include +#include #include #include #include @@ -193,7 +195,12 @@ Gui::MenuItem* Workbench::setupMenuBar() const << "Mesh_Merge" << "Mesh_PolySelect" << "Mesh_PolyCut" << "Mesh_PolySplit" << "Mesh_PolySegm" << "Mesh_PolyTrim" << "Separator" << "Mesh_TrimByPlane" << "Mesh_SectionByPlane" << "Mesh_Segmentation" - << "Mesh_VertexCurvature" << "CreateFlatMesh" << "CreateFlatFace"; + << "Mesh_VertexCurvature"; + Gui::CommandManager& mgr = Gui::Application::Instance->commandManager(); + if (mgr.getCommandByName("MeshPart_CreateFlatMesh")) + *mesh << "MeshPart_CreateFlatMesh"; + if (mgr.getCommandByName("MeshPart_CreateFlatFace")) + *mesh << "MeshPart_CreateFlatFace"; return root; } diff --git a/src/Mod/MeshPart/Gui/MeshFlatteningCommand.py b/src/Mod/MeshPart/Gui/MeshFlatteningCommand.py index 7283d2edd2..a3d44fc9ae 100644 --- a/src/Mod/MeshPart/Gui/MeshFlatteningCommand.py +++ b/src/Mod/MeshPart/Gui/MeshFlatteningCommand.py @@ -3,8 +3,8 @@ import FreeCAD as App import FreeCADGui as Gui import Part import numpy as np -from pivy import graphics as g -from pivy import coin +#from pivy import graphics as g +#from pivy import coin class BaseCommand(object): def __init__(self): @@ -34,7 +34,7 @@ class CreateFlatMesh(BaseCommand): boundaries = flattener.getFlatBoundaryNodes() print('number of nodes: {}'.format(len(flattener.ze_nodes))) print('number of faces: {}'.format(len(flattener.tris))) - + wires = [] for edge in boundaries: pi = Part.makePolygon([App.Vector(*node) for node in edge]) @@ -82,5 +82,5 @@ class CreateFlatFace(BaseCommand): assert(isinstance(Gui.Selection.getSelectionEx()[0].SubObjects[0], Part.Face)) return True -Gui.addCommand('CreateFlatMesh', CreateFlatMesh()) -Gui.addCommand('CreateFlatFace', CreateFlatFace()) +Gui.addCommand('MeshPart_CreateFlatMesh', CreateFlatMesh()) +Gui.addCommand('MeshPart_CreateFlatFace', CreateFlatFace())