PyBeam is a lightweight, Python-based library for analyzing beams. v0.1.0 supports creating internal stress diagrams
Install via pip:
pip install pybeam-structuralfrom pybeam import members
# Define beam properties
length = 5 # meters
resolution = 1000
# Define load
load = 50 # N
load_position = 5 # meters from fixed end
# Create beam object
beam = members.Loadable(length, resolution)
# Apply point load (as fraction of beam length)
beam.add_shear_point_force(load, load_position / length)
# Manually add support reactions
beam.add_shear_point_force(-load, 0) # Fixed end vertical reaction
beam.add_point_moment(-load * length, 0) # Fixed end moment
# Plot shear and moment diagrams
beam.plot()- Positive shear force: acts downward
- Positive moment: causes sagging (concave up)
Install dev dependencies into a venv:
python3 -m venv ./venv
chmod +x ./venv/bin/activate
./venv/bin/activate
pip install -r requirements-dev.txtRun tests:
pytestRun with coverage:
coverage run -m pytest
coverage report -mBuild the package (creates .whl in dist/):
python -m buildhttps://pybeam-structural.readthedocs.io/en/latest/
Generated via sphinx, see docs
MIT License – see LICENSE