Skip to content

Commit

Permalink
FEM: examples, add text explanation object to more examples
Browse files Browse the repository at this point in the history
  • Loading branch information
berndhahnebach committed Jun 17, 2021
1 parent c3c383a commit 00adea5
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 36 deletions.
31 changes: 20 additions & 11 deletions src/Mod/Fem/femexamples/buckling_platebuckling.py
Expand Up @@ -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

Expand All @@ -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
Expand Down
36 changes: 23 additions & 13 deletions src/Mod/Fem/femexamples/ccx_buckling_flexuralbuckling.py
Expand Up @@ -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

Expand All @@ -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
Expand Down
36 changes: 24 additions & 12 deletions src/Mod/Fem/femexamples/constraint_tie.py
Expand Up @@ -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

Expand All @@ -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)
Expand Down

0 comments on commit 00adea5

Please sign in to comment.