diff --git a/src/Mod/Fem/CMakeLists.txt b/src/Mod/Fem/CMakeLists.txt index 241704926e..e44cce1b37 100755 --- a/src/Mod/Fem/CMakeLists.txt +++ b/src/Mod/Fem/CMakeLists.txt @@ -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 diff --git a/src/Mod/Fem/ObjectsFem.py b/src/Mod/Fem/ObjectsFem.py index 3542c4a92c..7066bccbe7 100644 --- a/src/Mod/Fem/ObjectsFem.py +++ b/src/Mod/Fem/ObjectsFem.py @@ -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, diff --git a/src/Mod/Fem/femobjects/constraint_sectionprint.py b/src/Mod/Fem/femobjects/constraint_sectionprint.py new file mode 100644 index 0000000000..006b6b75d3 --- /dev/null +++ b/src/Mod/Fem/femobjects/constraint_sectionprint.py @@ -0,0 +1,45 @@ +# *************************************************************************** +# * Copyright (c) 2020 Bernd Hahnebach * +# * * +# * 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 diff --git a/src/Mod/Fem/femtest/app/test_object.py b/src/Mod/Fem/femtest/app/test_object.py index 22fd33d437..444dc4f5db 100644 --- a/src/Mod/Fem/femtest/app/test_object.py +++ b/src/Mod/Fem/femtest/app/test_object.py @@ -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)) diff --git a/src/Mod/Fem/femviewprovider/view_constraint_sectionprint.py b/src/Mod/Fem/femviewprovider/view_constraint_sectionprint.py new file mode 100644 index 0000000000..0f37668276 --- /dev/null +++ b/src/Mod/Fem/femviewprovider/view_constraint_sectionprint.py @@ -0,0 +1,40 @@ +# *************************************************************************** +# * Copyright (c) 2020 Bernd Hahnebach * +# * * +# * 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