The 8th week has ended and we are now in the middle of phase –III.
Last week was a bit of research-based, understanding matplotlib and how it can be used to plot a beam diagram. I had a conversation with Jason Moore and Jashan where Jason shared a link of a repository, which also was a bit of help as I took some hints from it for the draw() function. After a lot of investigation and analysis, I was finally able to make a draft PR # 17240 which did the work as we intended.
Here is an example of how it would function:
# This example has no prior logic involved. It just tests whether every functionality works or not >>> E, I = symbols('E, I') >>> b1 = Beam(50, E, I) >>> b1.apply_load(-10, 0, -1) >>> b1.apply_load(R1, 10, -1) >>> b1.apply_load(R2, 30, -1) >>> b1.apply_load(9, 5, 0, 23) >>> b1.apply_load(9, 30, 1, 50) >>> b1.apply_support(50, "pin") >>> b1.apply_support(0, "fixed") >>> b1.apply_support(20, "roller") >>> b1.draw()
Here we are using matplotlib and numpy by importing them as external modules. Of course, it would be better to have it done via SymPy’s own plot(), but I think that is something we could work on in later stages as SymPy’s plot() is limited to work on equations and stuff (although on can use _backend attribute for further functionalities). Also to be noted here that SymPy’s plot() is not a replica of matplotib’s plot() but it makes it easier for SymPy equation to be plotted and it uses matplotlib to do so.
Following are the matplotlib modules/classes used:
- matplotlib.patches.Rectangle -to draw the beam
- matplotlib.pyplot.annotate – to draw arrows of load
- matplotlib.markers– to draw supports
Also, considering Jason’s comment in the PR, I will have to work on making SymPy’s plot() to accept a singularity function, so that it would be easier to plot loads which are indeed equations of Singularity function. This is still in consideration, so I will have to look into it and of course will have a discussion on how it is to be done.
Currently, I am not able to determine how to plot parabolic loads. I think this could be added later as we should currently focus on plotting simple parts and certainly work on other complexities later. But we can have a discussion on it.
Other PR’s are still being parallelly worked on.
- Working on the idea of plotting singularity function via SymPy’s plot()
- Plotting parabolic loads
- Writing documentation and tests
Will keep you updated!