FEM: mesh result object, implement new object
This commit is contained in:
@@ -109,6 +109,7 @@ SET(FemObjectsScripts_SRCS
|
||||
PyObjects/_FemMeshBoundaryLayer.py
|
||||
PyObjects/_FemMeshGmsh.py
|
||||
PyObjects/_FemMeshGroup.py
|
||||
PyObjects/_FemMeshResult.py
|
||||
PyObjects/_FemMeshRegion.py
|
||||
PyObjects/_FemResultMechanical.py
|
||||
PyObjects/_FemSolverCalculix.py
|
||||
@@ -161,6 +162,7 @@ SET(FemGuiScripts_SRCS
|
||||
PyGui/_ViewProviderFemMeshGmsh.py
|
||||
PyGui/_ViewProviderFemMeshGroup.py
|
||||
PyGui/_ViewProviderFemMeshRegion.py
|
||||
PyGui/_ViewProviderFemMeshResult.py
|
||||
PyGui/_ViewProviderFemResultMechanical.py
|
||||
PyGui/_ViewProviderFemSolverCalculix.py
|
||||
PyGui/_ViewProviderFemSolverZ88.py
|
||||
|
||||
@@ -60,6 +60,7 @@ INSTALL(
|
||||
PyObjects/_FemMeshGmsh.py
|
||||
PyObjects/_FemMeshGroup.py
|
||||
PyObjects/_FemMeshRegion.py
|
||||
PyObjects/_FemMeshResult.py
|
||||
PyObjects/_FemResultMechanical.py
|
||||
PyObjects/_FemSolverCalculix.py
|
||||
PyObjects/_FemSolverZ88.py
|
||||
@@ -114,6 +115,7 @@ INSTALL(
|
||||
PyGui/_ViewProviderFemMeshGmsh.py
|
||||
PyGui/_ViewProviderFemMeshGroup.py
|
||||
PyGui/_ViewProviderFemMeshRegion.py
|
||||
PyGui/_ViewProviderFemMeshResult.py
|
||||
PyGui/_ViewProviderFemResultMechanical.py
|
||||
PyGui/_ViewProviderFemSolverCalculix.py
|
||||
PyGui/_ViewProviderFemSolverZ88.py
|
||||
|
||||
@@ -287,6 +287,17 @@ def makeMeshRegion(base_mesh, element_length=0.0, name="FEMMeshRegion"):
|
||||
return obj
|
||||
|
||||
|
||||
def makeMeshResult(name="FEMMeshResult"):
|
||||
'''(name): makes a Fem MeshResult object'''
|
||||
obj = FreeCAD.ActiveDocument.addObject("Fem::FemMeshObjectPython", name)
|
||||
import PyObjects._FemMeshResult
|
||||
PyObjects._FemMeshResult._FemMeshResult(obj)
|
||||
if FreeCAD.GuiUp:
|
||||
import PyGui._ViewProviderFemMeshResult
|
||||
PyGui._ViewProviderFemMeshResult._ViewProviderFemMeshResult(obj.ViewObject)
|
||||
return obj
|
||||
|
||||
|
||||
########## result objects ##########
|
||||
def makeResultMechanical(name="MechanicalResult"):
|
||||
'''makeResultMechanical(name): creates an mechanical result object to hold FEM results'''
|
||||
|
||||
53
src/Mod/Fem/PyGui/_ViewProviderFemMeshResult.py
Normal file
53
src/Mod/Fem/PyGui/_ViewProviderFemMeshResult.py
Normal file
@@ -0,0 +1,53 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2017 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * 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__ = "_ViewProviderFemMeshResult"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package ViewProviderFemMeshResult
|
||||
# \ingroup FEM
|
||||
|
||||
|
||||
class _ViewProviderFemMeshResult:
|
||||
"A View Provider for the FemMeshResult object"
|
||||
def __init__(self, vobj):
|
||||
vobj.Proxy = self
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/fem-femmesh-from-shape.svg"
|
||||
|
||||
def attach(self, vobj):
|
||||
self.ViewObject = vobj
|
||||
self.Object = vobj.Object
|
||||
|
||||
def updateData(self, obj, prop):
|
||||
return
|
||||
|
||||
def onChanged(self, vobj, prop):
|
||||
return
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
||||
48
src/Mod/Fem/PyObjects/_FemMeshResult.py
Normal file
48
src/Mod/Fem/PyObjects/_FemMeshResult.py
Normal file
@@ -0,0 +1,48 @@
|
||||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2017 - Bernd Hahnebach <bernd@bimstatik.org> *
|
||||
# * *
|
||||
# * 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__ = "_FemMeshResult"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## @package FemMeshResult
|
||||
# \ingroup FEM
|
||||
|
||||
|
||||
class _FemMeshResult():
|
||||
"""The Fem::FemMeshObject's Proxy python type, add Result specific object type
|
||||
"""
|
||||
|
||||
def __init__(self, obj):
|
||||
self.Type = "FemMeshResult"
|
||||
self.Object = obj # keep a ref to the DocObj for nonGui usage
|
||||
obj.Proxy = self # link between App::DocumentObject to this object
|
||||
|
||||
def execute(self, obj):
|
||||
return
|
||||
|
||||
def __getstate__(self):
|
||||
return self.Type
|
||||
|
||||
def __setstate__(self, state):
|
||||
if state:
|
||||
self.Type = state
|
||||
Reference in New Issue
Block a user