byADIT Free software for engineers and students
EngiFree
anaStruct — The Complete Guide: 2D Frame and Truss Analysis in Python in a Few Lines

anaStruct — The Complete Guide: 2D Frame and Truss Analysis in Python in a Few Lines

anaStruct is a light open-source Python library (LGPL-3.0 licence) for analysing plane frames and trusses. You build the structure from elements, define supports — hinged, fixed or spring — and loads, and get plots of bending moment, shear force, axial force and displacements. All of it in a few lines of code.

What you get

Who it suits

anaStruct suits students who want to check a hand solution for a beam or frame, and engineers who want to turn a simple calculation into a script. It is not meant for 3D structures — for those you need another tool. It works best inside JupyterLab, where the plots appear right below the code.

Related tools

For 3D structural analysis in Python — Pynite. For 2D analysis with a graphical interface — Ftool. For properties of any cross-section shape — sectionproperties.

Known limitation: hinges in frames

Checking against a hand solution and a second program, we found that in version 1.7.0 the result is wrong where a beam hinged at its end meets a column at an angle in a statically indeterminate frame. This happens both with an end release (spring={1:0}) and with add_internal_hinge.

Example: a 6 × 4 m portal, columns EI = 2·10⁴ kNm², beam EI = 3·10⁴ kNm², one fixed base and one pinned base, the beam hinged at its left end and 10 kN/m on the beam. The force method gives a horizontal reaction of 3.75 kN at the pin; anaStruct gives 3.37 kN, about 10 % low. With a rotational spring in place of the hinge, the result does not even change monotonically with the spring stiffness.

A collinear hinge (a Gerber beam) is computed correctly. Also worth knowing: a second distributed load on the same element replaces the first rather than adding to it.

Until this is fixed, check hinged frames by hand or with a second program such as Pynite or OpenSees.

An alternative with a graphical interface: STRUCTSOFT from ADIT, the publisher of EngiFree, analyses 2D frames, trusses and arches for free. In the cross-check that revealed the problem, STRUCTSOFT gave 3.75 kN for the frame above, matching the hand solution. Guide: STRUCTSOFT — The Complete Guide.

The bottom line

anaStruct is the fast way to get force diagrams for a plane structure from Python. Simple, free and ideal for learning and for checking hand calculations.

Further reading

מדריכי AI למהנדסים ולמשרד, ב-5 שפות: adit-ai.com ←