diff --git a/src/Mod/Fem/femexamples/boxanalysis_frequency.py b/src/Mod/Fem/femexamples/boxanalysis_frequency.py index e4bdbcccd69a..b00e1a70af6a 100644 --- a/src/Mod/Fem/femexamples/boxanalysis_frequency.py +++ b/src/Mod/Fem/femexamples/boxanalysis_frequency.py @@ -22,16 +22,11 @@ # * * # *************************************************************************** -# to run the example use: -""" -from femexamples.boxanalysis_frequency import setup -setup() - -""" - import ObjectsFem +from . import manager from .boxanalysis_base import setup_boxanalysisbase +from .manager import init_doc def get_information(): @@ -46,8 +41,30 @@ def get_information(): } +def get_explanation(header=""): + return header + """ + +To run the example from Python console use: +from femexamples.boxanalysis_frequency import setup +setup() + + +See forum topic post: +... + +""" + + 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()))) + # setup box frequency, change solver attributes doc = setup_boxanalysisbase(doc, solvertype) analysis = doc.Analysis diff --git a/src/Mod/Fem/femexamples/boxanalysis_static.py b/src/Mod/Fem/femexamples/boxanalysis_static.py index df766ee3a617..e08ac1194cd0 100644 --- a/src/Mod/Fem/femexamples/boxanalysis_static.py +++ b/src/Mod/Fem/femexamples/boxanalysis_static.py @@ -22,18 +22,13 @@ # * * # *************************************************************************** -# to run the example use: -""" -from femexamples.boxanalysis_static import setup -setup() - -""" - import FreeCAD import ObjectsFem +from . import manager from .boxanalysis_base import setup_boxanalysisbase +from .manager import init_doc def get_information(): @@ -48,8 +43,30 @@ def get_information(): } +def get_explanation(header=""): + return header + """ + +To run the example from Python console use: +from femexamples.boxanalysis_static import setup +setup() + + +See forum topic post: +... + +""" + + 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()))) + # setup box static, add a fixed, force and a pressure constraint doc = setup_boxanalysisbase(doc, solvertype) geom_obj = doc.Box diff --git a/src/Mod/Fem/femexamples/ccx_cantilever_faceload.py b/src/Mod/Fem/femexamples/ccx_cantilever_faceload.py index b0a810aa9fbc..249be5a17625 100644 --- a/src/Mod/Fem/femexamples/ccx_cantilever_faceload.py +++ b/src/Mod/Fem/femexamples/ccx_cantilever_faceload.py @@ -22,16 +22,11 @@ # * * # *************************************************************************** -# to run the example use: -""" -from femexamples.ccx_cantilever_faceload import setup -setup() - -""" - import ObjectsFem +from . import manager from .ccx_cantilever_base import setup_cantileverbase +from .manager import init_doc def get_information(): @@ -46,9 +41,31 @@ def get_information(): } +def get_explanation(header=""): + return header + """ + +To run the example from Python console use: +from femexamples.ccx_cantilever_faceload import setup +setup() + + +See forum topic post: +... + +""" + + def setup(doc=None, solvertype="ccxtools"): - # setup CalculiX cantilever, apply 9 MN on surface of front end face + # 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()))) + + # setup CalculiX cantilever, apply 9 MN on surface of front end face doc = setup_cantileverbase(doc, solvertype) analysis = doc.Analysis geom_obj = doc.Box diff --git a/src/Mod/Fem/femexamples/ccx_cantilever_hexa20faceload.py b/src/Mod/Fem/femexamples/ccx_cantilever_hexa20faceload.py index b4b2e6274814..62f525290392 100644 --- a/src/Mod/Fem/femexamples/ccx_cantilever_hexa20faceload.py +++ b/src/Mod/Fem/femexamples/ccx_cantilever_hexa20faceload.py @@ -22,19 +22,14 @@ # * * # *************************************************************************** -# to run the example use: -""" -from femexamples.ccx_cantilever_hexa20faceload import setup -setup() - -""" - import FreeCAD import Fem +from . import manager from .ccx_cantilever_faceload import setup as setup_with_faceload from .manager import get_meshname +from .manager import init_doc def get_information(): @@ -49,8 +44,31 @@ def get_information(): } +def get_explanation(header=""): + return header + """ + +To run the example from Python console use: +from femexamples.ccx_cantilever_hexa20faceload import setup +setup() + + +See forum topic post: +... + +""" + + 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()))) + + # setup cantilever faceload and exchange the mesh doc = setup_with_faceload(doc, solvertype) femmesh_obj = doc.getObject(get_meshname()) diff --git a/src/Mod/Fem/femexamples/ccx_cantilever_nodeload.py b/src/Mod/Fem/femexamples/ccx_cantilever_nodeload.py index e43ef69e9a69..b34367e3bb71 100644 --- a/src/Mod/Fem/femexamples/ccx_cantilever_nodeload.py +++ b/src/Mod/Fem/femexamples/ccx_cantilever_nodeload.py @@ -22,16 +22,11 @@ # * * # *************************************************************************** -# to run the example use: -""" -from femexamples.ccx_cantilever_nodeload import setup -setup() - -""" - import ObjectsFem +from . import manager from .ccx_cantilever_base import setup_cantileverbase +from .manager import init_doc def get_information(): @@ -46,9 +41,31 @@ def get_information(): } +def get_explanation(header=""): + return header + """ + +To run the example from Python console use: +from femexamples.ccx_cantilever_nodeload import setup +setup() + + +See forum topic post: +... + +""" + + def setup(doc=None, solvertype="ccxtools"): - # setup CalculiX cantilever, apply 9 MN on the 4 nodes of the front end face + # 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()))) + + # setup CalculiX cantilever, apply 9 MN on the 4 nodes of the front end face doc = setup_cantileverbase(doc, solvertype) analysis = doc.Analysis geom_obj = doc.Box diff --git a/src/Mod/Fem/femexamples/ccx_cantilever_prescribeddisplacement.py b/src/Mod/Fem/femexamples/ccx_cantilever_prescribeddisplacement.py index 9da4d442b745..6308d8fd9fd0 100644 --- a/src/Mod/Fem/femexamples/ccx_cantilever_prescribeddisplacement.py +++ b/src/Mod/Fem/femexamples/ccx_cantilever_prescribeddisplacement.py @@ -22,16 +22,11 @@ # * * # *************************************************************************** -# to run the example use: -""" -from femexamples.ccx_cantilever_prescribeddisplacement import setup -setup() - -""" - import ObjectsFem +from . import manager from .ccx_cantilever_base import setup_cantileverbase +from .manager import init_doc def get_information(): @@ -46,15 +41,37 @@ def get_information(): } +def get_explanation(header=""): + return header + """ + +To run the example from Python console use: +from femexamples.ccx_cantilever_prescribeddisplacement import setup +setup() + + +See forum topic post: +... + +""" + + def setup(doc=None, solvertype="ccxtools"): - # setup CalculiX cantilever - # apply a prescribed displacement of 250 mm in -z on the front end face if solvertype == "z88": # constraint displacement is not supported for Z88 # pass a not valid solver name for z88, thus no solver is created solvertype = "z88_not_valid" + # 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()))) + + # setup CalculiX cantilever + # apply a prescribed displacement of 250 mm in -z on the front end face doc = setup_cantileverbase(doc, solvertype) analysis = doc.Analysis geom_obj = doc.Box diff --git a/src/Mod/Fem/femexamples/constraint_contact_shell_shell.py b/src/Mod/Fem/femexamples/constraint_contact_shell_shell.py index bc67331861c6..74f1be4dffcf 100644 --- a/src/Mod/Fem/femexamples/constraint_contact_shell_shell.py +++ b/src/Mod/Fem/femexamples/constraint_contact_shell_shell.py @@ -22,17 +22,6 @@ # * * # *************************************************************************** -# to run the example use: -""" -from femexamples.constraint_contact_shell_shell import setup -setup() - -""" - -# contact example shell to shell elements -# https://forum.freecadweb.org/viewtopic.php?f=18&t=42228 -# based on https://forum.freecadweb.org/viewtopic.php?f=18&t=42228#p359488 - import FreeCAD import Part @@ -41,6 +30,7 @@ import Fem import ObjectsFem +from . import manager from .manager import get_meshname from .manager import init_doc @@ -57,12 +47,33 @@ def get_information(): } +def get_explanation(header=""): + return header + """ + +To run the example from Python console use: +from femexamples.constraint_contact_shell_shell import setup +setup() + + +See forum topic post: +https://forum.freecadweb.org/viewtopic.php?f=18&t=42228 +based on https://forum.freecadweb.org/viewtopic.php?f=18&t=42228#p359488 + +contact example shell to shell elements + +""" + + 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 # TODO: turn circle of upper tube to have the line on the other side # make a boolean fragment of them to be sure there is a mesh point on remesh diff --git a/src/Mod/Fem/femexamples/constraint_contact_solid_solid.py b/src/Mod/Fem/femexamples/constraint_contact_solid_solid.py index d6260e8e3105..5b10f5cf6d61 100644 --- a/src/Mod/Fem/femexamples/constraint_contact_solid_solid.py +++ b/src/Mod/Fem/femexamples/constraint_contact_solid_solid.py @@ -22,16 +22,6 @@ # * * # *************************************************************************** -# to run the example use: -""" -from femexamples.constraint_contact_solid_solid import setup -setup() - -""" - -# constraint contact for solid to solid mesh -# https://forum.freecadweb.org/viewtopic.php?f=18&t=20276 - import FreeCAD from FreeCAD import Rotation from FreeCAD import Vector @@ -41,6 +31,7 @@ import Fem import ObjectsFem +from . import manager from .manager import get_meshname from .manager import init_doc @@ -57,12 +48,31 @@ def get_information(): } +def get_explanation(header=""): + return header + """ + +To run the example from Python console use: +from femexamples.constraint_contact_solid_solid import setup +setup() + + +See forum topic post: +https://forum.freecadweb.org/viewtopic.php?f=18&t=20276 +constraint contact for solid to solid mesh + +""" + + 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 # bottom box bottom_box_obj = doc.addObject("Part::Box", "BottomBox") diff --git a/src/Mod/Fem/femexamples/constraint_section_print.py b/src/Mod/Fem/femexamples/constraint_section_print.py index 6601300c0a84..cd50b133dcc4 100644 --- a/src/Mod/Fem/femexamples/constraint_section_print.py +++ b/src/Mod/Fem/femexamples/constraint_section_print.py @@ -22,16 +22,6 @@ # * * # *************************************************************************** -# to run the example use: -""" -from femexamples.constraint_section_print import setup -setup() - -""" - -# constraint section print with volume elements -# https://forum.freecadweb.org/viewtopic.php?t=43044 - import math import FreeCAD @@ -47,6 +37,7 @@ import Fem import ObjectsFem +from . import manager from .manager import get_meshname from .manager import init_doc @@ -63,12 +54,32 @@ def get_information(): } +def get_explanation(header=""): + return header + """ + +To run the example from Python console use: +from femexamples.constraint_section_print import setup +setup() + + +See forum topic post: +https://forum.freecadweb.org/viewtopic.php?t=43044 + +constraint section print with volume elements + +""" + + 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 # the part sketch arc_sketch = doc.addObject("Sketcher::SketchObject", "Arc_Sketch") diff --git a/src/Mod/Fem/femexamples/constraint_selfweight_cantilever.py b/src/Mod/Fem/femexamples/constraint_selfweight_cantilever.py index 79e658f33922..650db6459bee 100644 --- a/src/Mod/Fem/femexamples/constraint_selfweight_cantilever.py +++ b/src/Mod/Fem/femexamples/constraint_selfweight_cantilever.py @@ -21,23 +21,12 @@ # * * # *************************************************************************** -# to run the example use: -""" -from femexamples.constraint_selfweight_cantilever import setup -setup() - -""" - -# cantilever under self weight made from steel grad 235 -# l = 32 m, yields just from self weight, means max sigma around 235 n/mm2 -# max deformation = 576.8 mm -# https://forum.freecadweb.org/viewtopic.php?f=18&t=48513 - import FreeCAD import Fem import ObjectsFem +from . import manager from .manager import get_meshname from .manager import init_doc @@ -54,12 +43,34 @@ def get_information(): } +def get_explanation(header=""): + return header + """ + +To run the example from Python console use: +from femexamples.constraint_selfweight_cantilever import setup +setup() + + +See forum topic post: +https://forum.freecadweb.org/viewtopic.php?f=18&t=48513 + +cantilever under self weight made from steel grad 235 +l = 32 m, yields just from self weight, means max sigma around 235 n/mm2 +max deformation = 576.8 mm + +""" + + 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", "Box") geom_obj.Height = geom_obj.Width = 1000 diff --git a/src/Mod/Fem/femexamples/constraint_transform_beam_hinged.py b/src/Mod/Fem/femexamples/constraint_transform_beam_hinged.py index 07e6438f301d..ffa06b15c849 100644 --- a/src/Mod/Fem/femexamples/constraint_transform_beam_hinged.py +++ b/src/Mod/Fem/femexamples/constraint_transform_beam_hinged.py @@ -22,15 +22,6 @@ # * * # *************************************************************************** -# to run the example use: -""" -from femexamples.constraint_transform_beam_hinged import setup -setup() - -""" -# Constraint transform on a beam -# https://forum.freecadweb.org/viewtopic.php?f=18&t=20238#p157643 - import FreeCAD from FreeCAD import Rotation from FreeCAD import Vector @@ -40,6 +31,7 @@ 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_transform_beam_hinged import setup +setup() + + +See forum topic post: +https://forum.freecadweb.org/viewtopic.php?f=18&t=20238#p157643 + +Constraint transform on a beam + +""" + + 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 # name is important because the other method in this module use obj name cube = doc.addObject("Part::Box", "Cube") diff --git a/src/Mod/Fem/femexamples/elmer_nonguitutorial01_eigenvalue_of_elastic_beam.py b/src/Mod/Fem/femexamples/elmer_nonguitutorial01_eigenvalue_of_elastic_beam.py index 23a64071c52e..fedc5e69a1cb 100644 --- a/src/Mod/Fem/femexamples/elmer_nonguitutorial01_eigenvalue_of_elastic_beam.py +++ b/src/Mod/Fem/femexamples/elmer_nonguitutorial01_eigenvalue_of_elastic_beam.py @@ -21,20 +21,12 @@ # * * # *************************************************************************** -# to run the example use: -""" -from femexamples.elmer_nonguitutorial01_eigenvalue_of_elastic_beam import setup -setup() - -""" - -# https://forum.freecadweb.org/viewtopic.php?t=56590 - import FreeCAD import Fem import ObjectsFem +from . import manager from .manager import get_meshname from .manager import init_doc @@ -51,12 +43,30 @@ def get_information(): } +def get_explanation(header=""): + return header + """ + +To run the example from Python console use: +from femexamples.elmer_nonguitutorial01_eigenvalue_of_elastic_beam import setup +setup() + + +See forum topic post: +https://forum.freecadweb.org/viewtopic.php?t=56590 + +""" + + def setup(doc=None, solvertype="elmer"): # 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", "Box") geom_obj.Length = 1000 diff --git a/src/Mod/Fem/femexamples/equation_electrostatics_capacitance_two_balls.py b/src/Mod/Fem/femexamples/equation_electrostatics_capacitance_two_balls.py index e9684572a1b4..e851bdf5216f 100644 --- a/src/Mod/Fem/femexamples/equation_electrostatics_capacitance_two_balls.py +++ b/src/Mod/Fem/femexamples/equation_electrostatics_capacitance_two_balls.py @@ -22,15 +22,6 @@ # * * # *************************************************************************** -# to run the example use: -""" -from femexamples.equation_electrostatics_capacitance_two_balls import setup -setup() - -""" -# Electrostatics equation in FreeCAD FEM-Elmer -# https://forum.freecadweb.org/viewtopic.php?f=18&t=41488&start=90#p412047 - import FreeCAD from FreeCAD import Rotation from FreeCAD import Vector @@ -38,6 +29,7 @@ import Fem import ObjectsFem +from . import manager from .manager import get_meshname from .manager import init_doc @@ -54,12 +46,32 @@ def get_information(): } +def get_explanation(header=""): + return header + """ + +To run the example from Python console use: +from femexamples.equation_electrostatics_capacitance_two_balls import setup +setup() + + +See forum topic post: +https://forum.freecadweb.org/viewtopic.php?f=18&t=41488&start=90#p412047 + +Electrostatics equation in FreeCAD FEM-Elmer + +""" + + def setup(doc=None, solvertype="elmer"): # 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 small_sphere1 = doc.addObject("Part::Sphere", "Small_Sphere1") small_sphere1.Placement = FreeCAD.Placement(Vector(-1000, 0, 0), Rotation(Vector(0, 0, 1), 0)) diff --git a/src/Mod/Fem/femexamples/equation_electrostatics_electricforce_elmer_nongui6.py b/src/Mod/Fem/femexamples/equation_electrostatics_electricforce_elmer_nongui6.py index 6ff5ecb59a4e..663d02ba6f8b 100644 --- a/src/Mod/Fem/femexamples/equation_electrostatics_electricforce_elmer_nongui6.py +++ b/src/Mod/Fem/femexamples/equation_electrostatics_electricforce_elmer_nongui6.py @@ -22,15 +22,6 @@ # * * # *************************************************************************** -# to run the example use: -""" -from femexamples.equation_electrostatics_electricforce_elmer_nongui6 import setup -setup() - -""" -# Electrostatics equation in FreeCAD FEM-Elmer -# https://forum.freecadweb.org/viewtopic.php?f=18&t=41488&start=40#p373292 - import FreeCAD from FreeCAD import Rotation from FreeCAD import Vector @@ -42,6 +33,7 @@ import Fem import ObjectsFem +from . import manager from .manager import get_meshname from .manager import init_doc @@ -58,12 +50,32 @@ def get_information(): } +def get_explanation(header=""): + return header + """ + +To run the example from Python console use: +from femexamples.equation_electrostatics_electricforce_elmer_nongui6 import setup +setup() + + +See forum topic post: +https://forum.freecadweb.org/viewtopic.php?f=18&t=41488&start=40#p373292 + +Electrostatics equation in FreeCAD FEM-Elmer + +""" + + def setup(doc=None, solvertype="elmer"): # 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 # name is important because the other method in this module use obj name geom_obj = doc.addObject("PartDesign::Body", "Body") diff --git a/src/Mod/Fem/femexamples/frequency_beamsimple.py b/src/Mod/Fem/femexamples/frequency_beamsimple.py index ba036be62061..0362047c971a 100644 --- a/src/Mod/Fem/femexamples/frequency_beamsimple.py +++ b/src/Mod/Fem/femexamples/frequency_beamsimple.py @@ -21,20 +21,12 @@ # * * # *************************************************************************** -# to run the example use: -""" -from femexamples.frequency_beamsimple import setup -setup() - -""" -# simple frequency analysis -# https://forum.freecadweb.org/viewtopic.php?f=18&t=58959#p506565 - import FreeCAD import Fem import ObjectsFem +from . import manager from .manager import get_meshname from .manager import init_doc @@ -51,12 +43,32 @@ def get_information(): } +def get_explanation(header=""): + return header + """ + +To run the example from Python console use: +from femexamples.frequency_beamsimple import setup +setup() + + +See forum topic post: +https://forum.freecadweb.org/viewtopic.php?f=18&t=58959#p506565 + +simple frequency analysis + +""" + + 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", "Box") geom_obj.Length = 3000 diff --git a/src/Mod/Fem/femexamples/material_multiple_bendingbeam_fiveboxes.py b/src/Mod/Fem/femexamples/material_multiple_bendingbeam_fiveboxes.py index 3916fd272793..46f99eacad2b 100644 --- a/src/Mod/Fem/femexamples/material_multiple_bendingbeam_fiveboxes.py +++ b/src/Mod/Fem/femexamples/material_multiple_bendingbeam_fiveboxes.py @@ -22,13 +22,6 @@ # * * # *************************************************************************** -# to run the example use: -""" -from femexamples.material_multiple_bendingbeam_fiveboxes import setup -setup() - -""" - import FreeCAD import BOPTools.SplitFeatures @@ -36,6 +29,7 @@ import Fem import ObjectsFem +from . import manager from .manager import get_meshname from .manager import init_doc @@ -52,12 +46,30 @@ def get_information(): } +def get_explanation(header=""): + return header + """ + +To run the example from Python console use: +from femexamples.material_multiple_bendingbeam_fiveboxes import setup +setup() + + +See forum topic post: +... + +""" + + 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 # name is important because the other method in this module use obj name box_obj1 = doc.addObject('Part::Box', 'Box1') diff --git a/src/Mod/Fem/femexamples/material_multiple_bendingbeam_fivefaces.py b/src/Mod/Fem/femexamples/material_multiple_bendingbeam_fivefaces.py index 70f281252c10..50c7b29f8a78 100644 --- a/src/Mod/Fem/femexamples/material_multiple_bendingbeam_fivefaces.py +++ b/src/Mod/Fem/femexamples/material_multiple_bendingbeam_fivefaces.py @@ -22,18 +22,12 @@ # * * # *************************************************************************** -# to run the example use: -""" -from femexamples.material_multiple_bendingbeam_fivefaces import setup -setup() - -""" - import FreeCAD import Fem import ObjectsFem +from . import manager from .manager import get_meshname from .manager import init_doc @@ -50,12 +44,30 @@ def get_information(): } +def get_explanation(header=""): + return header + """ + +To run the example from Python console use: +from femexamples.material_multiple_bendingbeam_fivefaces import setup +setup() + + +See forum topic post: +... + +""" + + 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 # name is important because the other method in this module use obj name # parts diff --git a/src/Mod/Fem/femexamples/material_multiple_tensionrod_twoboxes.py b/src/Mod/Fem/femexamples/material_multiple_tensionrod_twoboxes.py index 539178475db4..056f74f706cc 100644 --- a/src/Mod/Fem/femexamples/material_multiple_tensionrod_twoboxes.py +++ b/src/Mod/Fem/femexamples/material_multiple_tensionrod_twoboxes.py @@ -22,13 +22,6 @@ # * * # *************************************************************************** -# to run the example use: -""" -from femexamples.material_multiple_tensionrod_twoboxes import setup -setup() - -""" - import FreeCAD from BOPTools import SplitFeatures @@ -37,6 +30,7 @@ import Fem import ObjectsFem +from . import manager from .manager import get_meshname from .manager import init_doc @@ -53,12 +47,30 @@ def get_information(): } +def get_explanation(header=""): + return header + """ + +To run the example from Python console use: +from femexamples.material_multiple_tensionrod_twoboxes import setup +setup() + + +See forum topic post: +... + +""" + + 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 # two boxes boxlow = doc.addObject("Part::Box", "BoxLower") diff --git a/src/Mod/Fem/femexamples/material_nl_platewithhole.py b/src/Mod/Fem/femexamples/material_nl_platewithhole.py index 10dfe2437ca9..9f2d63506992 100644 --- a/src/Mod/Fem/femexamples/material_nl_platewithhole.py +++ b/src/Mod/Fem/femexamples/material_nl_platewithhole.py @@ -28,21 +28,6 @@ setup() """ -# Nonlinear material example, plate with hole. - -# https://forum.freecadweb.org/viewtopic.php?f=24&t=31997&start=30 -# https://forum.freecadweb.org/viewtopic.php?t=33974&start=90 -# https://forum.freecadweb.org/viewtopic.php?t=35893 -# https://forum.freecadweb.org/viewtopic.php?t=23101 - -# plate: 400x200x10 mm -# hole: diameter 100 mm (half cross section) -# load: 130 MPa tension -# linear material: Steel, E = 210000 MPa, my = 0.3 -# nonlinear material: '240.0, 0.0' to '270.0, 0.025' -# TODO nonlinear material: give more information, use values from harry -# TODO compare results with example from HarryvL - import FreeCAD from FreeCAD import Vector as vec @@ -53,6 +38,7 @@ import Fem import ObjectsFem +from . import manager from .manager import get_meshname from .manager import init_doc @@ -69,12 +55,43 @@ def get_information(): } +def get_explanation(header=""): + return header + """ + +To run the example from Python console use: +from femexamples.material_nl_platewithhole import setup +setup() + + +See forum topic post: +https://forum.freecadweb.org/viewtopic.php?f=24&t=31997&start=30 +https://forum.freecadweb.org/viewtopic.php?t=33974&start=90 +https://forum.freecadweb.org/viewtopic.php?t=35893 +https://forum.freecadweb.org/viewtopic.php?t=23101 + +Nonlinear material example, plate with hole. + +plate: 400x200x10 mm +hole: diameter 100 mm (half cross section) +load: 130 MPa tension +linear material: Steel, E = 210000 MPa, my = 0.3 +nonlinear material: '240.0, 0.0' to '270.0, 0.025' +TODO nonlinear material: give more information, use values from harry +TODO compare results with example from HarryvL + +""" + + 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 v1 = vec(-200, -100, 0) v2 = vec(200, -100, 0) diff --git a/src/Mod/Fem/femexamples/rc_wall_2d.py b/src/Mod/Fem/femexamples/rc_wall_2d.py index f4e40cc14bcd..5f1f0dd2a0d5 100644 --- a/src/Mod/Fem/femexamples/rc_wall_2d.py +++ b/src/Mod/Fem/femexamples/rc_wall_2d.py @@ -22,16 +22,6 @@ # * * # *************************************************************************** -# to run the example use: -""" -from femexamples.rc_wall_2d import setup -setup() - -""" - -# example from Harry's epic topic: Concrete branch ready for testing -# https://forum.freecadweb.org/viewtopic.php?f=18&t=33106&start=80#p296469 - import FreeCAD from FreeCAD import Vector as vec @@ -41,6 +31,7 @@ import Fem import ObjectsFem +from . import manager from .manager import get_meshname from .manager import init_doc @@ -57,12 +48,32 @@ def get_information(): } +def get_explanation(header=""): + return header + """ + +To run the example from Python console use: +from femexamples.rc_wall_2d import setup +setup() + + +See forum topic post: +https://forum.freecadweb.org/viewtopic.php?f=18&t=33106&start=80#p296469 + +example from Harry's epic topic: Concrete branch ready for testing + +""" + + 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 v1 = vec(0, -2000, 0) v2 = vec(500, -2000, 0) diff --git a/src/Mod/Fem/femexamples/square_pipe_end_twisted_edgeforces.py b/src/Mod/Fem/femexamples/square_pipe_end_twisted_edgeforces.py index 0c5b372b788c..1fe781983af4 100644 --- a/src/Mod/Fem/femexamples/square_pipe_end_twisted_edgeforces.py +++ b/src/Mod/Fem/femexamples/square_pipe_end_twisted_edgeforces.py @@ -22,13 +22,6 @@ # * * # *************************************************************************** -# to run the example use: -""" -from femexamples.square_pipe_end_twisted_edgeforces import setup -setup() - -""" - import FreeCAD from FreeCAD import Vector @@ -37,6 +30,7 @@ import Fem import ObjectsFem +from . import manager from .manager import get_meshname from .manager import init_doc @@ -53,12 +47,30 @@ def get_information(): } +def get_explanation(header=""): + return header + """ + +To run the example from Python console use: +from femexamples.square_pipe_end_twisted_edgeforces import setup +setup() + + +See forum topic post: +... + +""" + + 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 # name is important because the other method in this module use obj name l1 = Part.makeLine((-142.5, -142.5, 0), (142.5, -142.5, 0)) diff --git a/src/Mod/Fem/femexamples/square_pipe_end_twisted_nodeforces.py b/src/Mod/Fem/femexamples/square_pipe_end_twisted_nodeforces.py index 430ff8acff37..c2b4310fd480 100644 --- a/src/Mod/Fem/femexamples/square_pipe_end_twisted_nodeforces.py +++ b/src/Mod/Fem/femexamples/square_pipe_end_twisted_nodeforces.py @@ -22,13 +22,6 @@ # * * # *************************************************************************** -# to run the example use: -""" -from femexamples.square_pipe_end_twisted_nodeforces import setup -setup() - -""" - import FreeCAD from FreeCAD import Vector @@ -37,6 +30,7 @@ import Fem import ObjectsFem +from . import manager from .manager import get_meshname from .manager import init_doc @@ -53,12 +47,30 @@ def get_information(): } +def get_explanation(header=""): + return header + """ + +To run the example from Python console use: +from femexamples.square_pipe_end_twisted_nodeforces import setup +setup() + + +See forum topic post: +... + +""" + + 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 # name is important because the other method in this module use obj name l1 = Part.makeLine((-142.5, -142.5, 0), (142.5, -142.5, 0)) diff --git a/src/Mod/Fem/femexamples/thermomech_bimetall.py b/src/Mod/Fem/femexamples/thermomech_bimetall.py index 60b43bcad148..28acc934e990 100644 --- a/src/Mod/Fem/femexamples/thermomech_bimetall.py +++ b/src/Mod/Fem/femexamples/thermomech_bimetall.py @@ -28,11 +28,6 @@ """ -# thermomechanical bimetall -# https://forum.freecadweb.org/viewtopic.php?f=18&t=43040&start=10#p366664 -# analytical solution 7.05 mm deflection in the invar material direction -# see post in the forum link -# this file has 7.15 mm max deflection import FreeCAD from FreeCAD import Rotation @@ -43,6 +38,7 @@ import Fem import ObjectsFem +from . import manager from .manager import get_meshname from .manager import init_doc @@ -59,12 +55,36 @@ def get_information(): } +def get_explanation(header=""): + return header + """ + +To run the example from Python console use: +from femexamples.thermomech_bimetall import setup +setup() + + +See forum topic post: +https://forum.freecadweb.org/viewtopic.php?f=18&t=43040&start=10#p366664 + +thermomechanical bimetall +analytical solution 7.05 mm deflection in the invar material direction +see post in the forum link +this file has 7.15 mm max deflection + + +""" + + 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 # bottom box bottom_box_obj = doc.addObject("Part::Box", "BottomBox") diff --git a/src/Mod/Fem/femexamples/thermomech_flow1d.py b/src/Mod/Fem/femexamples/thermomech_flow1d.py index 52c1b07b6b2a..905739297efc 100644 --- a/src/Mod/Fem/femexamples/thermomech_flow1d.py +++ b/src/Mod/Fem/femexamples/thermomech_flow1d.py @@ -22,16 +22,6 @@ # * * # *************************************************************************** -# to run the example use: -""" -from femexamples.thermomech_flow1d import setup -setup() - -""" - -# topic about the 1D flow analysis -# https://forum.freecadweb.org/viewtopic.php?f=18&t=20076 - import FreeCAD from FreeCAD import Vector as vec @@ -40,6 +30,7 @@ import Fem import ObjectsFem +from . import manager from .manager import get_meshname from .manager import init_doc @@ -56,12 +47,31 @@ def get_information(): } +def get_explanation(header=""): + return header + """ + +To run the example from Python console use: +from femexamples.thermomech_flow1d import setup +setup() + + +See forum topic post: +https://forum.freecadweb.org/viewtopic.php?f=18&t=20076 + + +""" + + 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 p1 = vec(0, 0, 50) p2 = vec(0, 0, -50) diff --git a/src/Mod/Fem/femexamples/thermomech_spine.py b/src/Mod/Fem/femexamples/thermomech_spine.py index 0b57629fb33f..7820d986a819 100644 --- a/src/Mod/Fem/femexamples/thermomech_spine.py +++ b/src/Mod/Fem/femexamples/thermomech_spine.py @@ -22,18 +22,12 @@ # * * # *************************************************************************** -# to run the example use: -""" -from femexamples.thermomech_spine import setup -setup() - -""" - import FreeCAD import Fem import ObjectsFem +from . import manager from .manager import get_meshname from .manager import init_doc @@ -50,12 +44,30 @@ def get_information(): } +def get_explanation(header=""): + return header + """ + +To run the example from Python console use: +from femexamples.thermomech_spine import setup +setup() + + +See forum topic post: +... + +""" + + 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", "Box") geom_obj.Height = 25.4