Skip to main content

trussme

trussme is a Python library for building, analyzing, and optimizing truss structures.

Installation

trussme supports Python 3.10 and newer.

pip install trussme

The package depends on numpy, scipy, pandas, matplotlib, and tabulate at runtime.

Quick Start

import trussme

truss = trussme.Truss()
pin = truss.add_pinned_joint([0.0, 0.0, 0.0])
free = truss.add_free_joint([2.5, 2.5, 0.0])
roller = truss.add_roller_joint([5.0, 0.0, 0.0])

truss.add_member(pin, free)
truss.add_member(pin, roller)
truss.add_member(roller, free)

truss.add_out_of_plane_support("z")
truss.set_load(free, [0.0, -10000.0, 0.0])

truss.analyze()

print(truss.fos)
print(truss.mass)

Built-in Materials

Trussme ships with a small library of common engineering materials. Each record includes a source URL citing where the mechanical properties originate.

Custom materials must also provide a provenance source when added to a truss.

License

This project is released under the MIT License.

Directional buckling and self-weight (0.2)

Self-weight remains enabled by default. Each member contributes half its mass times gravity to each endpoint. truss.set_gravity((0, 0, 0)) disables it; any finite acceleration vector is supported. The default is (0, -9.80665, 0) m/s². truss.nodal_loads includes external loads and member weight, and reactions now use K u - f, including loads at supports.

Buckling now checks both transverse directions. The lower Euler capacity governs by default, including for rectangular sections. Configure orientation and effective lengths explicitly when they matter:

truss.set_member_buckling(0, trussme.BucklingSettings(
    transverse_reference=(0, 0, 1),
    effective_length_factors=(1.0, 0.4),
))
truss.analyze()
for mode in truss.members[0].buckling_modes:
    print(mode.direction, mode.effective_length, mode.critical_load,
          mode.factor_of_safety)
print(truss.members[0].governing_buckling)

The first direction is the reference projected perpendicular to the member. For a rectangle it corresponds to the height, with inertia w*h**3/12; the second is the member direction crossed with the first. An omitted reference uses the least-aligned global axis. Each mode uses Pcr = pi**2*E*I/(K*L)**2. Equal capacities have no unique governing direction; the first is returned consistently. Planar joint restraints do not suppress out-of-plane member buckling.

K factors represent caller-supplied bracing or end conditions. They add no actual brace, mass, or stiffness. These are linear axial analyses and Euler member capacity checks; they do not solve eigenmodes, nonlinear/post-buckling behavior, or local/torsional buckling. Reports include both directions and assumptions. plot_truss(truss, projection="xz", buckling_directions=True) displays governing capacity directions; a circle with a dot indicates a direction normal to the view.

Model objects remain mutable: call analyze() again after edits before reading forces, reactions, deflections, or safety factors. Geometry, material properties, and buckling assumptions are validated before analysis.

Migration and exchange with trussx

Version 0.2 changes rectangular-section buckling results and optimization constraint values. set_buckling_axis("strong") explicitly reproduces the 0.1 scalar convention when both K values are 1. Shape.moi() retains the legacy scalar inertia; Shape.principal_inertias() exposes both. Reports and design goals always use the physical lower capacity, even in strong compatibility mode. Existing shape subclasses that only implement moi() are treated as isotropic; override principal_inertias() for asymmetric sections.

Native JSON and TRS now preserve gravity, orientation, K factors, and the scalar convention using the same trussx metadata as trussx 0.3. Both libraries can exchange pipe, bar, rectangle, box, and Custom(area, i1, i2) sections. Arbitrary Python shape subclasses require caller-defined serialization and sizing logic.

Original files without metadata use the new weak convention in TrussMe 0.2; trussx imports original files in legacy strong mode. Explicitly select the desired convention when comparing old files. Native files emitted by either new version carry that choice. TrussMe 0.1 ignores the metadata and cannot preserve custom gravity or directional assumptions; trussx's to_trussme_json() is the checked export specifically for that older format.

Optimization helpers now enforce maximum mass and recognize applied loads componentwise, including [100, -100, 0]. Generators own a snapshot of the source model. The first four constraint residuals are dimensionless, feasible at <= 0: buckling, yielding, deflection, and mass. Minimum safety uses goal/actual - 1; upper limits use (actual-limit)/max(limit, 1) in SI units. Infinite upper limits are disabled (-1), with no artificial deflection cap. Full sizing appends t-r for pipes or 2*t-w, 2*t-h for boxes, in metres. Invalid or singular trial models return finite positive design penalties so an optimizer can reject them; malformed/nonfinite design vectors raise ValueError. Custom sections require caller-defined sizing logic.

Metadata

Release files for trussme 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for trussme 0.2.0
File Size Uploaded
trussme-0.2.0.tar.gz 41.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for trussme 0.2.0
File Interpreter ABI Platform
trussme-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 67.1 kB

Release files / trussme-0.2.0.tar.gz

Download URL trussme-0.2.0.tar.gz
Size 41.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0eb818034d8de1ec79728a94150955a45c2801eb7434c6aeacb67f5a6bb7c834
BLAKE2b-256 checksum
How to use checksums
0b9bcd00baac67bcae79430c89e76d70c1e570560b30a22f49dcbd45ff24683c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 19, 2026.

Transparency log

Release files / trussme-0.2.0-py3-none-any.whl

Download URL trussme-0.2.0-py3-none-any.whl
Size 25.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
556a8d99c1932f8688db30e689bc29046387747d092d4694d4e62f641aee15e6
BLAKE2b-256 checksum
How to use checksums
e455e1763d2fb5bea65307d886ad019f4dbc0fabc264787315140922746c0049
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 19, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page