beamz9000
Beam free-body diagrams from a simple YAML scheme, drawn through shapely geometry.
Documentation: https://beamz9000.structuralpython.com
import beamz9000 as bz
bz.draw("examples/beam_scheme.yaml", "B1.png") # or .pdf, .svg
How it works
scheme YAML ──► scheme.Beam ──► spec.BeamSpec ──► graphics elements ──► renderer
(pydantic, (engine-neutral (shapely geometry (matplotlib:
validated, SI floats, legend + style mixins, png/pdf/svg;
locations keys, labels) Text, Group) native SVG)
resolved)
- shapely is the intermediate type. Supports, arrows, load regions and
dimension ticks are
Polygons andLineStrings built by small pure functions ingraphics/glyphs.py(the decomposition and proportions follow fbd_plotting). Each glyph is drawn at the origin, then oriented and placed. - Style lives next to the geometry, never inside a backend.
Shape,TextandGroup(graphics/elements.py) are frozen pydantic models built fromStroke(colour, opacity, width, line type),Fill(colour, opacity, hatch) andFontmixins, plus z-order, legend key and role.translate,rotate,scale,mirror_x/yandrestylereturn new elements. A whole diagram serializes to JSON and reads back equal. - Text stays text. Labels are drawn as native, searchable text (matplotlib
Text artists with TrueType embedded in PDF,
<text>in SVG). Layout measures each label with libraqm shaping (bundled with matplotlib ≥ 3.11), so the space it reserves is the space the label is drawn in. - Strata, top to bottom: load bands (one per load case, occupancy, or
"Factored", with overlapping loads packed into rows), the beam, supports,
dimensions, and a legend to the right. Sizes are fractions of the beam length
(
diagram.Layout), and the palette is colour-blind safe (Okabe-Ito).
The scheme format
A scheme file maps beam ids to beams. Write plain numbers in any consistent unit system, or name a forallpeople environment and write quantities:
_environment: structural # optional; enables "4500 mm", "2.5 kN/m", ...
B1:
spans: [4500 mm, 2500 mm]
cantilever: right # left | right | both
e: 200 GPa # optional; or `ei:`
i: 300e6 mm**4
depth: 450 mm # optional; drawn as a rectangle to scale
node_labels: auto # optional; A, B, C ... or a list like [A, B, null]
supports: [pin, roller, free] # optional override (see below)
loads:
- point: {p: 15 kN, span_loc: [1, 1250 mm], case: L}
- point: {mag: 10 kN, loc: -500 mm} # no case: already factored
- dist: {mag: 2.5 kN/m, case: D} # no locations: whole beam
- dist: {mag1: 1 kN/m, mag2: 4 kN/m, x1: 1000 mm, span_loc2: [0, S], case: L}
- pressure: {mag: residential, trib_width1: 3 m, trib_width2: 1.5 m, span_loc1: [1, 0 mm], loc2: L}
- moment: {mag: 5 kN*m, loc: 0 mm}
occupancies:
- residential: {D: 1.5 kPa, L: 1.9 kPa}
load_combos:
- ULS1: {name: D, factor: 1.4}
- ULS2: {D: 1.25, L: 1.5}
results:
diagrams: [moment, shear, deflection]
Locations
| Written | Means |
|---|---|
loc: 2000 (alias x) |
2000 from the left end |
loc: -500 |
500 back from the right end (L − 500) |
loc: L |
the right end |
span_loc: [1, 1250] |
1250 into span 1 (spans count from 0) |
span_loc: [1, -250] |
250 back from the end of span 1 |
span_loc: [0, S] |
the end of span 0 |
span_loc: 0 |
the end of span 0 (a bare index) |
A dist or pressure load takes loc1/x1/span_loc1 and
loc2/x2/span_loc2. Leaving out the start means the left end, and leaving
out the end means the right end.
Loads
| Type | Magnitude | Notes |
|---|---|---|
point |
mag (aliases magnitude, p) |
Positive acts downward. angle (alias alpha), in degrees from vertical between −90 and 90, tilts the arrow: positive turns its tail counter-clockwise about its tip. |
moment |
mag (aliases magnitude, m) |
Positive is counter-clockwise. |
dist |
mag (aliases magnitude, w) for a UDL, or mag1 → mag2 |
Linear between the two. |
pressure |
mag (aliases magnitude, q, occupancy) × trib_width1 → trib_width2 |
trib_width/trib gives a uniform width. mag may name an occupancy: the load then stands for one pressure per case in it, or only case if given. |
Every load takes an optional case (with no case, the load is already factored)
and an optional label that replaces the drawn magnitude. Loads may also be
written flat, as {type: point, p: 15, loc: 2000}.
Supports
Without supports, the first supported node is pinned and the rest are
rollers, with cantilevered ends left free. A single span with one cantilevered
end is fixed at the other end. supports overrides this, either with one
support per node or as {node index: support} for just the nodes that differ.
If cantilever is also given, supports must leave that end free.
| Type | Aliases | Drawn as |
|---|---|---|
pin |
pinned, hinge |
A triangle on the ground |
roller |
A circle on the ground | |
fixed |
fix |
A block. At a beam end it becomes a wall covering the beam's depth. |
spring |
v_spring, vertical_spring |
A zigzag spring to the ground |
rotational_spring |
m_spring, rot_spring |
A pin with a spiral |
free |
none |
Nothing |
A spring can take a stiffness, which is drawn beside it. Write it as
{spring: 12 kN/mm} or {type: spring, k: 12 kN/mm}. A spring takes a force
per length, and a rotational_spring a moment per radian (written as a moment,
e.g. 8000 kN*m).
supports:
- rotational_spring: 8000 kN*m
- roller
- spring: 12 kN/mm
- free
Drawing
- Labels show quantities as they were written:
12 kN/mmstays "12 kN/mm" rather than forallpeople's "12 MN/m".*is drawn as a middle dot and**nas a superscript (5 kN*m→ "5 kN·m"). Computed values, such as the overall length, use forallpeople's units. - Load labels show the magnitude without a sign, because the arrow shows the direction. The zero end of a triangular load has no label.
node_labelsare drawn in bold on one line under the lowest support.- See
examples/drawing_features.yamlfor depth, springs, angled loads and node labels together.
Fitting to a size
A renderer with a height outputs exactly width × height, and draw
arranges the diagram to fill it. The load strata stretch within
Layout.stretch, and the legend moves on top of the loads when that draws the
beam larger:
bz.draw("beams.yaml", "B1.png", renderer=bz.MatplotlibRenderer(width=6.5, height=2.5))
diagram = bz.beam_diagram("beams.yaml", aspect=6.5 / 2.5) # without a renderer
With Layout(font_size_pt=8), text is 8 pt in the output whatever the beam's
length, and symbols scale with it.
ymprint block and ReportLab
uv add "beamz9000[ymprint]" adds a _beam block for
ymprint reports
(ym convert report.yml renders it, or call register(app) in your own
application). beamz9000.render.reportlab.ReportLabRenderer draws a
diagram into any ReportLab document as vector graphics with searchable text.
Occupancies, combinations, results
occupanciesandload_combosaccept a list of- name: {...}items or a plain mapping.- A combination is
{name: D, factor: 1.4}, a list of those, or{D: 1.25, L: 1.5}. resultsanalyses the beam with pycba-tools or pynite-tools (thepycbaandpyniteextras): list any offorces,shear,moment,deflection(s),rotation(s), or write{diagrams: [...], engine: pynite}. The diagram then shows each support's reactions per load case, and the result diagrams below, with positive moment on the tension side.
Validation
Errors name the load and the problem, for example load 3 (dist): it must end after it starts. Other checks:
- every load lands on the beam
- span offsets stay inside their span
- quantities have the right dimensions
- a beam doesn't mix quantities with bare numbers
- named occupancies exist
- supports agree with
cantilever
Development
uv sync
uv run pytest
uv run --group docs sphinx-build -b html docs docs/_build/html # docs
Tests run on every push and pull request (.github/workflows/tests.yml). The docs
are built on pull requests and deployed to bunny.net on every push to main
(.github/workflows/publish-docs-to-bunny.yml). Publishing a GitHub release
uploads the package to PyPI (.github/workflows/publish.yml); the release tag
must match the version in pyproject.toml.
Metadata
Release files for beamz9000 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| beamz9000-0.1.0.tar.gz | 56.0 kB | With provenance | Details for beamz9000-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| beamz9000-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for beamz9000-0.1.0-py3-none-any.whl |
Total release size: 121.4 kB
Release files / beamz9000-0.1.0.tar.gz
| Download URL | beamz9000-0.1.0.tar.gz |
|---|---|
| Size | 56.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5ed4481cabf127f84d2d78eae4c37e626dd7224f0853aa5512309ef740b03e0e
|
|
BLAKE2b-256 checksum How to use checksums |
fb2d47d7499f6a02f2ac154729f7cb5a60899d5044efb4b9ebe37edddc6f02f1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.
Transparency logRelease files / beamz9000-0.1.0-py3-none-any.whl
| Download URL | beamz9000-0.1.0-py3-none-any.whl |
|---|---|
| Size | 65.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
126a3c6d2090caa5278a5027ee4eb2266a2c2221a8166c7f8d4fa1871aee3378
|
|
BLAKE2b-256 checksum How to use checksums |
44b7833c1df1c8887162d9fdc85fdb7773259a2b7641ab32fb6244c23735d836
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.
Transparency logSecurity for beamz9000 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for beamz9000-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.