FEM: constraint self weight: object implementation
This commit is contained in:
parent
90d181aec2
commit
84e017e4db
|
@ -74,6 +74,7 @@ SET(FemScripts_SRCS
|
|||
_CommandAnalysis.py
|
||||
_CommandBeamSection.py
|
||||
_CommandControlSolver.py
|
||||
_CommandConstraintSelfWeight.py
|
||||
_CommandMechanicalMaterial.py
|
||||
_CommandShowResult.py
|
||||
_CommandMeshFromShape.py
|
||||
|
@ -84,6 +85,7 @@ SET(FemScripts_SRCS
|
|||
_CommandSolverZ88.py
|
||||
_FemAnalysis.py
|
||||
_FemBeamSection.py
|
||||
_FemConstraintSelfWeight.py
|
||||
_FemShellThickness.py
|
||||
_FemSolverCalculix.py
|
||||
_FemSolverZ88.py
|
||||
|
@ -95,6 +97,7 @@ SET(FemScripts_SRCS
|
|||
_TaskPanelShowResult.py
|
||||
_ViewProviderFemAnalysis.py
|
||||
_ViewProviderFemBeamSection.py
|
||||
_ViewProviderFemConstraintSelfWeight.py
|
||||
_ViewProviderFemShellThickness.py
|
||||
_ViewProviderFemSolverCalculix.py
|
||||
_ViewProviderFemSolverZ88.py
|
||||
|
@ -106,8 +109,9 @@ SET(FemScripts_SRCS
|
|||
Init.py
|
||||
InitGui.py
|
||||
FemAnalysis.py
|
||||
FemCommands.py
|
||||
FemBeamSection.py
|
||||
FemCommands.py
|
||||
FemConstraintSelfWeight.py
|
||||
FemInputWriter.py
|
||||
FemInputWriterCcx.py
|
||||
FemInputWriterZ88.py
|
||||
|
|
|
@ -83,6 +83,11 @@ INSTALL(
|
|||
_ViewProviderFemSolverZ88.py
|
||||
_CommandSolverZ88.py
|
||||
|
||||
FemConstraintSelfWeight.py
|
||||
_FemConstraintSelfWeight.py
|
||||
_ViewProviderFemConstraintSelfWeight.py
|
||||
_CommandConstraintSelfWeight.py
|
||||
|
||||
DESTINATION
|
||||
Mod/Fem
|
||||
)
|
||||
|
|
40
src/Mod/Fem/FemConstraintSelfWeight.py
Normal file
40
src/Mod/Fem/FemConstraintSelfWeight.py
Normal file
|
@ -0,0 +1,40 @@
|
|||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2016 - 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__ = "FemConstraintSelfWeight"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
|
||||
import FreeCAD
|
||||
import FemGui
|
||||
import _FemConstraintSelfWeight
|
||||
|
||||
|
||||
def makeFemConstraintSelfWeight(name="FemConstraintSelfWeight"):
|
||||
'''makeFemFemConstraintSelfWeight([name]): creates an beamsection object to define a cross section'''
|
||||
obj = FemGui.getActiveAnalysis().Document.addObject("Fem::FeaturePython", name)
|
||||
_FemConstraintSelfWeight._FemConstraintSelfWeight(obj)
|
||||
if FreeCAD.GuiUp:
|
||||
import _ViewProviderFemConstraintSelfWeight
|
||||
_ViewProviderFemConstraintSelfWeight._ViewProviderFemConstraintSelfWeight(obj.ViewObject)
|
||||
return obj
|
|
@ -68,6 +68,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
|||
<< "Fem_ConstraintFixed"
|
||||
<< "Fem_ConstraintDisplacement"
|
||||
<< "Separator"
|
||||
<< "Fem_ConstraintSelfWeight"
|
||||
<< "Fem_ConstraintForce"
|
||||
<< "Fem_ConstraintPressure"
|
||||
<< "Fem_ConstraintBearing"
|
||||
|
@ -116,6 +117,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
|||
<< "Fem_ConstraintFixed"
|
||||
<< "Fem_ConstraintDisplacement"
|
||||
<< "Separator"
|
||||
<< "Fem_ConstraintSelfWeight"
|
||||
<< "Fem_ConstraintForce"
|
||||
<< "Fem_ConstraintPressure"
|
||||
<< "Fem_ConstraintBearing"
|
||||
|
|
|
@ -58,6 +58,8 @@ class FemWorkbench (Workbench):
|
|||
import _CommandMechanicalMaterial
|
||||
import _CommandSolverCalculix
|
||||
import _CommandSolverZ88
|
||||
import _CommandConstraintSelfWeight
|
||||
|
||||
|
||||
import subprocess
|
||||
from platform import system
|
||||
|
|
53
src/Mod/Fem/_CommandConstraintSelfWeight.py
Normal file
53
src/Mod/Fem/_CommandConstraintSelfWeight.py
Normal file
|
@ -0,0 +1,53 @@
|
|||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2016 - 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__ = "Command constraint self weight"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
|
||||
import FreeCAD
|
||||
from FemCommands import FemCommands
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
import FreeCADGui
|
||||
from PySide import QtCore
|
||||
|
||||
|
||||
class _CommandConstraintSelfWeight(FemCommands):
|
||||
"The Fem_ConstraintSelfWeight command definition"
|
||||
def __init__(self):
|
||||
super(_CommandConstraintSelfWeight, self).__init__()
|
||||
self.resources = {'Pixmap': 'fem-constraint-selfweight',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Fem_ConstraintSelfWeight", "Constraint self weigt"),
|
||||
'Accel': "C, W",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Fem_ConstraintSelfWeight", "Creates a FEM constraint self weigt")}
|
||||
self.is_active = 'with_analysis'
|
||||
|
||||
def Activated(self):
|
||||
FreeCAD.ActiveDocument.openTransaction("Create FemConstraintSelfWeight")
|
||||
FreeCADGui.addModule("FemConstraintSelfWeight")
|
||||
FreeCADGui.doCommand("FemGui.getActiveAnalysis().Member = FemGui.getActiveAnalysis().Member + [FemConstraintSelfWeight.makeFemConstraintSelfWeight()]")
|
||||
|
||||
|
||||
if FreeCAD.GuiUp:
|
||||
FreeCADGui.addCommand('Fem_ConstraintSelfWeight', _CommandConstraintSelfWeight())
|
35
src/Mod/Fem/_FemConstraintSelfWeight.py
Normal file
35
src/Mod/Fem/_FemConstraintSelfWeight.py
Normal file
|
@ -0,0 +1,35 @@
|
|||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2015 - 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__ = "the constraint self weight object"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
|
||||
class _FemConstraintSelfWeight:
|
||||
"The FemConstraintSelfWeight object"
|
||||
def __init__(self, obj):
|
||||
obj.Proxy = self
|
||||
self.Type = "FemConstraintSelfWeight"
|
||||
|
||||
def execute(self, obj):
|
||||
return
|
63
src/Mod/Fem/_ViewProviderFemConstraintSelfWeight.py
Normal file
63
src/Mod/Fem/_ViewProviderFemConstraintSelfWeight.py
Normal file
|
@ -0,0 +1,63 @@
|
|||
# ***************************************************************************
|
||||
# * *
|
||||
# * Copyright (c) 2016 - 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__ = "_ViewProviderFemConstraintSelfWeight"
|
||||
__author__ = "Bernd Hahnebach"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
|
||||
import FreeCAD
|
||||
import FreeCADGui
|
||||
from pivy import coin
|
||||
|
||||
|
||||
class _ViewProviderFemConstraintSelfWeight:
|
||||
"A View Provider for the FemConstraintSelfWeight object"
|
||||
def __init__(self, vobj):
|
||||
vobj.Proxy = self
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/fem-constraint-selfweight.svg"
|
||||
|
||||
def attach(self, vobj):
|
||||
self.ViewObject = vobj
|
||||
self.Object = vobj.Object
|
||||
self.standard = coin.SoGroup()
|
||||
vobj.addDisplayMode(self.standard, "Standard")
|
||||
|
||||
def getDisplayModes(self, obj):
|
||||
return ["Standard"]
|
||||
|
||||
def getDefaultDisplayMode(self):
|
||||
return "Standard"
|
||||
|
||||
def updateData(self, obj, prop):
|
||||
return
|
||||
|
||||
def onChanged(self, vobj, prop):
|
||||
return
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
def __setstate__(self, state):
|
||||
return None
|
Loading…
Reference in New Issue
Block a user