Skip to content

Meshing a solid from a STEP file

A plate with a bolt hole, a pin standing on it and a rounded back edge. describe lists its faces with their properties: planes with their outward normals, round faces with their radius and axis, and whether a round face is a hole’s wall. Select names the faces the model needs, by those properties, as groups of the meshed part’s nodes: the base to hold, the hole, the pin’s top to load.

The model before it is solved: parts, supports and loads

The model before it is solved: its parts, supports (red) and loads (blue).

Open in 3D turn it, cut it, hide parts: in xfea's viewer, in your browser

examples/scripts/02_core_concepts/geometry_and_meshing/mesh_a_solid.py. Run it from the repository with uv run python examples/scripts/02_core_concepts/geometry_and_meshing/mesh_a_solid.py, or, with xfea-examples installed, xfea-examples run 02_core_concepts/geometry_and_meshing/mesh_a_solid.py.

from xfea.meshing import MeshingSettings
from xfea.meshing import Select
from xfea.meshing import describe
from xfea.model import ElasticIsotropic
from xfea.model import Model
from xfea.model import Part
from xfea.model import SolidSection
from xfea_examples import get_asset
from xfea_examples import show_viewer
path = get_asset("plate_hole_pin.stp") # 100 x 60 x 20 mm
print("The plate's faces:")
for face in describe(path, what="faces"):
print(f" {face}")
steel = ElasticIsotropic(E=210_000, v=0.3, density=7.85e-9) # N, mm, t
model = Model(name="mesh_a_solid")
plate = model.add_part(Part(name="plate"))
plate.base_geometry = path
plate.mesh(
settings=MeshingSettings(max=6, element_order=2), # quadratic tetrahedra: linear ones are far too stiff in bending
section=SolidSection(material=steel),
groups={
"base": Select.faces(normal="-z"), # the face facing down
"bolt_hole": Select.holes(), # a hole's wall, not the pin, not the rounded edge
"pin_top": Select.faces(normal="+z", near=(75, 30, 35)),
},
)
print(f"\nMesh: {len(plate.nodes)} nodes, {len(plate.elements)} quadratic tetrahedra")
for name in ("base", "bolt_hole", "pin_top"):
print(f" {name}: {len(plate.find_group_by_name(name))} nodes")
model.add_fix_bc(nodes=plate.find_group_by_name("base"))
show_viewer(model, units="mm")

© 2026 Francesco Ranaudo · Text and pictures CC BY 4.0 · Code Elastic License 2.0 · how to reuse them