From 5c794688db2bce0134ecdd3b926a10d411ce1454 Mon Sep 17 00:00:00 2001 From: looooo Date: Wed, 25 Apr 2018 21:05:22 +0200 Subject: [PATCH] flatmesh: missing include + do not show flatmesh-gui if flatmesh is not available --- src/Mod/MeshPart/App/MeshFlatteningLscmRelax.cpp | 1 + src/Mod/MeshPart/Gui/MeshFlatteningCommand.py | 11 +++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Mod/MeshPart/App/MeshFlatteningLscmRelax.cpp b/src/Mod/MeshPart/App/MeshFlatteningLscmRelax.cpp index bcce25e4ba..eac6bb828c 100644 --- a/src/Mod/MeshPart/App/MeshFlatteningLscmRelax.cpp +++ b/src/Mod/MeshPart/App/MeshFlatteningLscmRelax.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #ifndef M_PI #define M_PI 3.14159265358979323846f diff --git a/src/Mod/MeshPart/Gui/MeshFlatteningCommand.py b/src/Mod/MeshPart/Gui/MeshFlatteningCommand.py index a3d44fc9ae..d18aad12ed 100644 --- a/src/Mod/MeshPart/Gui/MeshFlatteningCommand.py +++ b/src/Mod/MeshPart/Gui/MeshFlatteningCommand.py @@ -3,8 +3,6 @@ import FreeCAD as App import FreeCADGui as Gui import Part import numpy as np -#from pivy import graphics as g -#from pivy import coin class BaseCommand(object): def __init__(self): @@ -82,5 +80,10 @@ class CreateFlatFace(BaseCommand): assert(isinstance(Gui.Selection.getSelectionEx()[0].SubObjects[0], Part.Face)) return True -Gui.addCommand('MeshPart_CreateFlatMesh', CreateFlatMesh()) -Gui.addCommand('MeshPart_CreateFlatFace', CreateFlatFace()) +try: + import flatmesh + Gui.addCommand('MeshPart_CreateFlatMesh', CreateFlatMesh()) + Gui.addCommand('MeshPart_CreateFlatFace', CreateFlatFace()) +except ImportError: + App.Console.PrintLog("flatmesh-commands are not available") + App.Console.PrintLog("flatmesh needs pybind11 as build dependency")