Summary
In this lecture, we'll cover:
- How to generate a visualisation of the undeformed and deformed structure using Python’s plotting tools
- How to set up a figure and axes with the correct aspect ratio for structural geometry
- How to plot individual members manually and overlay the deformed shape
- How to apply a displacement scale factor to make small deflections visible
- How to annotate and tidy a plot with labels, gridlines and descriptive text
In this lecture, we focus on visualising the structural response we have already calculated. We set up a plotting environment in Python by creating a figure and axes, ensuring that the aspect ratio is equal so that distances in the x and y directions are represented correctly. We manually plot the undeformed structure by drawing lines between nodal coordinates, and then overlay the deformed shape by adding the calculated nodal displacements to the original coordinates. To make the very small physical displacements visible, we introduce a displacement scale factor, similar to what is done in commercial structural analysis software.
We also enhance the clarity and presentation of the plot by adding nodal markers, gridlines, axis labels, and a title. Finally, we construct a formatted text label that displays the displacement scale factor and the numerical values of the key nodal displacements directly on the figure. Throughout, we emphasise a pragmatic approach to plotting in Python—reusing code, consulting documentation as needed, and focusing on producing clear visual output rather than memorising commands. The lecture concludes by preparing us for the next step: refactoring the code to improve efficiency and reduce repetition.
Next up:
In the next lecture, we refactor our code by encapsulating repeated calculations into reusable functions, improving efficiency and preparing for more complex structures.
Tags
Please log in or enroll to continue
If you've already enrolled, please log in to continue.
The Direct Stiffness Method for Truss Analysis with Python
Build your own finite element truss analysis software using Python and tackle large scale structures.
After completing this course...
- You’ll understand how to use the Direct Stiffness Method to build complete structural models that can be solved using Python.
- You’ll have your own analysis programme to identify displacements, reactions and internal member forces for any truss.
- You’ll understand how common models of elastic behaviour such as plane stress and plane strain apply to real-world structures.