FEM: examples, add text explanation object to more examples

This commit is contained in:
Bernd Hahnebach
2021-06-17 10:40:29 +02:00
parent 1d760a979b
commit 1730df54c2
3 changed files with 67 additions and 36 deletions

View File

@@ -21,21 +21,12 @@
# * *
# ***************************************************************************
# to run the example use:
"""
from femexamples.buckling_platebuckling import setup
setup()
"""
# Forum discussion
# https://forum.freecadweb.org/viewtopic.php?f=18&t=20217&start=110#p509935
import FreeCAD
import Fem
import ObjectsFem
from . import manager
from .manager import get_meshname
from .manager import init_doc
@@ -52,12 +43,30 @@ def get_information():
}
def get_explanation(header=""):
return header + """
To run the example from Python console use:
from femexamples.buckling_platebuckling import setup
setup()
See forum topic post:
https://forum.freecadweb.org/viewtopic.php?f=18&t=20217&start=110#p509935
"""
def setup(doc=None, solvertype="ccxtools"):
# init FreeCAD document
if doc is None:
doc = init_doc()
# explanation object
# just keep the following line and change text string in get_explanation method
manager.add_explanation_obj(doc, get_explanation(manager.get_header(get_information())))
# geometric object
geom_obj = doc.addObject("Part::Plane", "Plate")
geom_obj.Width = 6000

View File

@@ -22,23 +22,12 @@
# * *
# ***************************************************************************
# to run the example use:
"""
from femexamples.ccx_buckling_flexuralbuckling import setup
setup()
"""
# Forum discussion
# https://forum.freecadweb.org/viewtopic.php?f=18&t=20217&start=80#p488666
# This example is based on Calculix own verification example.
# http://www.feacluster.com/CalculiX/ccx_2.13/doc/ccx/input_deck_viewer.php?input_deck=beam8b.inp
import FreeCAD
import Fem
import ObjectsFem
from . import manager
from .manager import get_meshname
from .manager import init_doc
@@ -55,12 +44,33 @@ def get_information():
}
def get_explanation(header=""):
return header + """
To run the example from Python console use:
from femexamples.ccx_buckling_flexuralbuckling import setup
setup()
See forum topic post:
https://forum.freecadweb.org/viewtopic.php?f=18&t=20217&start=80#p488666
This example is based on a CalculiX verification example.
http://www.feacluster.com/CalculiX/ccx_2.13/doc/ccx/input_deck_viewer.php?input_deck=beam8b.inp
"""
def setup(doc=None, solvertype="ccxtools"):
# init FreeCAD document
if doc is None:
doc = init_doc()
# explanation object
# just keep the following line and change text string in get_explanation method
manager.add_explanation_obj(doc, get_explanation(manager.get_header(get_information())))
# geometric object
geom_obj = doc.addObject("Part::Box", "Beam")
geom_obj.Length = 1

View File

@@ -22,24 +22,16 @@
# * *
# ***************************************************************************
# to run the example use:
"""
from femexamples.constraint_tie import setup
setup()
"""
# constraint tie, bond two surfaces together (solid mesh only)
# https://forum.freecadweb.org/viewtopic.php?f=18&t=42783
import FreeCAD
from FreeCAD import Vector
import Fem
import ObjectsFem
import Part
from BOPTools import SplitFeatures
import Fem
import ObjectsFem
from . import manager
from .manager import get_meshname
from .manager import init_doc
@@ -56,12 +48,32 @@ def get_information():
}
def get_explanation(header=""):
return header + """
To run the example from Python console use:
from femexamples.constraint_tie import setup
setup()
See forum topic post:
https://forum.freecadweb.org/viewtopic.php?f=18&t=42783
constraint tie, bond two surfaces together (solid mesh only)
"""
def setup(doc=None, solvertype="ccxtools"):
# init FreeCAD document
if doc is None:
doc = init_doc()
# explanation object
# just keep the following line and change text string in get_explanation method
manager.add_explanation_obj(doc, get_explanation(manager.get_header(get_information())))
# geometric objects
# cones cut
cone_outer_sh = Part.makeCone(1100, 1235, 1005, Vector(0, 0, 0), Vector(0, 0, 1), 359)