ParaBridge generates a fully parametric 3D CAD model of a short-span, composite steel-girder bridge with
pythonOCC (the Python bindings for OpenCASCADE). A single
BridgeConfig dataclass drives every dimension; the script builds the superstructure, substructure and
reinforcement, exports the assembly to a STEP file and opens an interactive 3D viewer.
It was developed to meet the design requirements of the FOSSEE Osdag bridge module.
- Fully parametric geometry — span, girder count and spacing, I-section dimensions, deck thickness, pier and pile sizes, cross-frame count and reinforcement layout are all configuration values; derived quantities (deck width, pier position, pier-cap widths) update automatically.
- Complete bridge assembly
- asymmetric steel I-girders (separate top / bottom flange sizes, IS 800 style sections)
- diagonal X cross-frames between girders
- RC deck slab built from prism segments
- hammerhead (trapezoidal) pier caps, circular piers, pile caps and a pile group under each pier (2 × 2 by default, set by
n_piles_per_cap)
- Reinforcement modelling — two-layer orthogonal deck mesh, longitudinal bars in piers, pier caps and pile
caps, and circular stirrup rings on the piles (full torus solids, or lightweight edge rings with
--lod). - Export — STEP (ISO 10303) on every run, optional BREP.
- Interactive viewer — semi-transparent concrete over opaque steel and rebar so the reinforcement is visible inside the concrete.
- Command-line overrides for the most common parameters, in millimetres or metres.
- Test suite covering the configuration logic, every component factory, the full assembly, exports and the CLI.
Python 3.10+, pythonocc-core (OpenCASCADE), PySide6 (viewer backend), pytest.
| File | Purpose |
|---|---|
bridge_model.py |
Main script: BridgeConfig, component factories, assembly, STEP/BREP export, viewer and CLI |
draw_i_section.py |
FOSSEE base primitive for steel I-sections |
draw_rectangular_prism.py |
FOSSEE base primitive for concrete slabs / boxes |
tests/test_model.py |
pytest suite |
output/bridge_model.step |
Sample STEP export of the default bridge (regenerated by every run) |
environment.yml, requirements.txt |
Dependency lists |
pythonocc-core is not published on PyPI, so install it from conda-forge. The provided environment.yml
creates a ready-to-use environment:
conda env create -f environment.yml
conda activate parabridgeOr manually:
conda create -n parabridge python=3.10
conda activate parabridge
conda install -c conda-forge pythonocc-core pyside6 numpy pytestBuild the default bridge, write output/bridge_model.step and open the 3D viewer:
python bridge_model.pyOverride parameters from the command line (lengths are in millimetres unless --units m is given):
python bridge_model.py --span 18000 --n-girders 4 --girder-spacing 2800
python bridge_model.py --units m --span 18 --deck-thickness 0.22 --pier-height 4
python bridge_model.py --no-viewer --step-file output/my_bridge.step # export only
python bridge_model.py --no-rebar --lod # lighter model| Option | Meaning |
|---|---|
--span |
Span length |
--units {mm,m} |
Unit of all dimensional options (the model itself is always built in mm) |
--n-girders, --girder-spacing |
Girder count and centre-to-centre spacing |
--deck-thickness, --deck-overhang |
Deck slab thickness and overhang beyond the outer girders |
--girder-d, --girder-bf, --girder-tf, --girder-tw |
Girder depth, flange width, flange thickness, web thickness |
--pier-height, --pier-diameter |
Pier column |
--pile-length, --pile-diameter, --n-piles |
Pile length, diameter and number of piles per pile cap |
--n-crossframes |
Number of cross-frame planes along the span |
--no-rebar, --rebar-spacing |
Hide reinforcement / set longitudinal bar spacing |
--concrete-opacity |
Concrete transparency in the viewer (0 = opaque, 1 = invisible) |
--lod |
Lightweight edge rings for pile stirrups (faster export) |
--no-step, --save-brep, --step-file |
Control the exported files |
--no-viewer, --show-axes |
Viewer behaviour |
Run python bridge_model.py --help for the full list. Parameters without a CLI option (pier-cap sizes, pile
cap sizes, rebar diameters, cover, …) can be changed on BridgeConfig directly:
import bridge_model as bm
config = bm.BridgeConfig(span_length_L=15000.0, n_girders=4, pier_cap_depth=700.0)
compound, parts = bm.assemble_bridge(config) # TopoDS_Compound + dict of component lists
bm.export_step(compound, "output/custom.step")X is along the span, Y across the deck width, Z is up. The origin is at the span centre on the top surface of the deck slab.
pytest tests/output/bridge_model.stepis a tracked sample; running the script with the default settings overwrites it. Other files inoutput/are ignored by git.BridgeConfig(units="m")only records the unit system; dimensional values passed to the dataclass are always millimetres. The CLI performs the metre-to-millimetre conversion.