FEM: ccx constraint section print, add object

This commit is contained in:
UR-0
2020-06-24 07:39:20 +02:00
committed by Bernd Hahnebach
parent 94e5f205ee
commit 337c935f20
5 changed files with 131 additions and 0 deletions

View File

@@ -109,6 +109,7 @@ SET(FemObjects_SRCS
femobjects/constraint_electrostaticpotential.py
femobjects/constraint_flowvelocity.py
femobjects/constraint_initialflowvelocity.py
femobjects/constraint_sectionprint.py
femobjects/constraint_selfweight.py
femobjects/constraint_tie.py
femobjects/element_fluid1D.py
@@ -389,6 +390,7 @@ SET(FemGuiViewProvider_SRCS
femviewprovider/view_constraint_electrostaticpotential.py
femviewprovider/view_constraint_flowvelocity.py
femviewprovider/view_constraint_initialflowvelocity.py
femviewprovider/view_constraint_sectionprint.py
femviewprovider/view_constraint_selfweight.py
femviewprovider/view_constraint_tie.py
femviewprovider/view_element_fluid1D.py

View File

@@ -283,6 +283,21 @@ def makeConstraintTransform(
return obj
def makeConstraintSectionPrint(
doc,
name="ConstraintSectionPrint"
):
"""makeConstraintSectionPrint(document, [name]):
creates an section print object to evaluate forces and moments of defined face"""
obj = doc.addObject("Fem::ConstraintPython", name)
from femobjects import constraint_sectionprint
constraint_sectionprint.ConstraintSectionPrint(obj)
if FreeCAD.GuiUp:
from femviewprovider import view_constraint_sectionprint
view_constraint_sectionprint.VPConstraintSectionPrint(obj.ViewObject)
return obj
# ********* element definition objects ***********************************************************
def makeElementFluid1D(
doc,

View File

@@ -0,0 +1,45 @@
# ***************************************************************************
# * Copyright (c) 2020 Bernd Hahnebach <bernd@bimstatik.org> *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * 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__ = "FreeCAD FEM constraint section print document object"
__author__ = "Bernd Hahnebach"
__url__ = "https://www.freecadweb.org"
## @package constraint_sectionprint
# \ingroup FEM
# \brief constraint section print object
from . import base_fempythonobject
class ConstraintSectionPrint(base_fempythonobject.BaseFemPythonObject):
"""
The FemConstraintSectionPrint object
"""
Type = "Fem::ConstraintSectionPrint"
def __init__(self, obj):
super(ConstraintSectionPrint, self).__init__(obj)
pass

View File

@@ -222,6 +222,10 @@ class TestObjectType(unittest.TestCase):
"Fem::ConstraintPulley",
type_of_obj(ObjectsFem.makeConstraintPulley(doc))
)
self.assertEqual(
"Fem::ConstraintSectionPrint",
type_of_obj(ObjectsFem.makeConstraintSectionPrint(doc))
)
self.assertEqual(
"Fem::ConstraintSelfWeight",
type_of_obj(ObjectsFem.makeConstraintSelfWeight(doc))
@@ -423,6 +427,10 @@ class TestObjectType(unittest.TestCase):
ObjectsFem.makeConstraintPulley(doc),
"Fem::ConstraintPulley"
))
self.assertTrue(is_of_type(
ObjectsFem.makeConstraintSectionPrint(doc),
"Fem::ConstraintSectionPrint"
))
self.assertTrue(is_of_type(
ObjectsFem.makeConstraintSelfWeight(doc),
"Fem::ConstraintSelfWeight"
@@ -811,6 +819,21 @@ class TestObjectType(unittest.TestCase):
"Fem::ConstraintPulley"
))
# ConstraintSectionPrint
constraint_self_weight = ObjectsFem.makeConstraintSectionPrint(doc)
self.assertTrue(is_derived_from(
constraint_self_weight,
"App::DocumentObject"
))
self.assertTrue(is_derived_from(
constraint_self_weight,
"Fem::ConstraintPython"
))
self.assertTrue(is_derived_from(
constraint_self_weight,
"Fem::ConstraintSectionPrint"
))
# ConstraintSelfWeight
constraint_self_weight = ObjectsFem.makeConstraintSelfWeight(doc)
self.assertTrue(is_derived_from(
@@ -1355,6 +1378,11 @@ class TestObjectType(unittest.TestCase):
doc
).isDerivedFrom("Fem::ConstraintPulley")
)
self.assertTrue(
ObjectsFem.makeConstraintSectionPrint(
doc
).isDerivedFrom("Fem::ConstraintPython")
)
self.assertTrue(
ObjectsFem.makeConstraintSelfWeight(
doc
@@ -1537,6 +1565,7 @@ def create_all_fem_objects_doc(
analysis.addObject(ObjectsFem.makeConstraintPlaneRotation(doc))
analysis.addObject(ObjectsFem.makeConstraintPressure(doc))
analysis.addObject(ObjectsFem.makeConstraintPulley(doc))
analysis.addObject(ObjectsFem.makeConstraintSectionPrint(doc))
analysis.addObject(ObjectsFem.makeConstraintSelfWeight(doc))
analysis.addObject(ObjectsFem.makeConstraintTemperature(doc))
analysis.addObject(ObjectsFem.makeConstraintTie(doc))

View File

@@ -0,0 +1,40 @@
# ***************************************************************************
# * Copyright (c) 2020 Bernd Hahnebach <bernd@bimstatik.org> *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * *
# * 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__ = "FreeCAD FEM constraint section print ViewProvider for the document object"
__author__ = "Bernd Hahnebach"
__url__ = "http://www.freecadweb.org"
## @package view_constraint_sectionprint
# \ingroup FEM
# \brief view provider for constraint section print object
from . import view_base_femconstraint
class VPConstraintSectionPrint(view_base_femconstraint.VPBaseFemConstraint):
"""
A View Provider for the ConstraintSectionPrint object
"""
pass