From e4939d358f242b780d2fe13044752c0a0984b00b Mon Sep 17 00:00:00 2001 From: Markus Hovorka Date: Fri, 1 Dec 2017 19:43:26 +0100 Subject: [PATCH] FEM: general python contraint, add module --- src/Mod/Fem/App/CMakeLists.txt | 1 + src/Mod/Fem/CMakeLists.txt | 1 + src/Mod/Fem/FemConstraint.py | 61 ++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 src/Mod/Fem/FemConstraint.py diff --git a/src/Mod/Fem/App/CMakeLists.txt b/src/Mod/Fem/App/CMakeLists.txt index 835b4e2a55..019e21223a 100644 --- a/src/Mod/Fem/App/CMakeLists.txt +++ b/src/Mod/Fem/App/CMakeLists.txt @@ -92,6 +92,7 @@ SET(FemScripts_SRCS FemToolsCcx.py ObjectsFem.py FemUtils.py + FemConstraint.py TestFem.py ) #SOURCE_GROUP("Scripts" FILES ${FemScripts_SRCS}) diff --git a/src/Mod/Fem/CMakeLists.txt b/src/Mod/Fem/CMakeLists.txt index e7e2e27aa1..8a533b5d70 100755 --- a/src/Mod/Fem/CMakeLists.txt +++ b/src/Mod/Fem/CMakeLists.txt @@ -40,6 +40,7 @@ INSTALL( FemToolsCcx.py ObjectsFem.py FemUtils.py + FemConstraint.py TestFem.py DESTINATION Mod/Fem diff --git a/src/Mod/Fem/FemConstraint.py b/src/Mod/Fem/FemConstraint.py new file mode 100644 index 0000000000..38b981b9a5 --- /dev/null +++ b/src/Mod/Fem/FemConstraint.py @@ -0,0 +1,61 @@ +# *************************************************************************** +# * * +# * Copyright (c) 2017 - Markus Hovorka * +# * * +# * This program is free software; you can redistribute it and/or modify * +# * it under the terms of the GNU Lesser General Public License (LGPL) * +# * as published by the Free Software Foundation; either version 2 of * +# * the License, or (at your option) any later version. * +# * for detail see the LICENCE text file. * +# * * +# * This program is distributed in the hope that it will be useful, * +# * but WITHOUT ANY WARRANTY; without even the implied warranty of * +# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +# * GNU Library General Public License for more details. * +# * * +# * You should have received a copy of the GNU Library General Public * +# * License along with this program; if not, write to the Free Software * +# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * +# * USA * +# * * +# *************************************************************************** + + +__title__ = "_Base" +__author__ = "Markus Hovorka" +__url__ = "http://www.freecadweb.org" + + +import FreeCAD +if FreeCAD.GuiUp: + from pivy import coin + + +class Proxy(object): + + BaseType = "Fem::ConstraintPython" + + def __init__(self, obj): + obj.Proxy = self + + +class ViewProxy(object): + """Proxy for FemSolverElmers View Provider.""" + + def __init__(self, vobj): + vobj.Proxy = self + + def attach(self, vobj): + default = coin.SoGroup() + vobj.addDisplayMode(default, "Default") + + def getDisplayModes(self, obj): + "Return a list of display modes." + modes = ["Default"] + return modes + + def getDefaultDisplayMode(self): + return "Default" + + def setDisplayMode(self, mode): + return mode