{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Basic usage (Readme example)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# RUN THIS CELL FIRST TO INITIALISE GOOGLE NOTEBOOK!!!!\n", "!pip install indeterminatebeam\n", "%matplotlib inline\n", "\n", "# import beam and supports\n", "from indeterminatebeam import Beam, Support\n", "\n", "# import loads (all load types imported for reference)\n", "from indeterminatebeam import (\n", " PointTorque,\n", " PointLoad,\n", " PointLoadV,\n", " PointLoadH,\n", " UDL,\n", " UDLV,\n", " UDLH,\n", " TrapezoidalLoad,\n", " TrapezoidalLoadV,\n", " TrapezoidalLoadH,\n", " DistributedLoad,\n", " DistributedLoadV,\n", " DistributedLoadH\n", ")\n", "\n", "# Note: load ending in V are vertical loads\n", "# load ending in H are horizontal loads\n", "# load not ending in either takes angle as an input (except torque)\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Arbritrary example defined in README.md\n", "beam = Beam(7) # Initialize a Beam object of length 7 m with E and I as defaults\n", "beam_2 = Beam(9,E=2000, I =100000) # Initialize a Beam specifying some beam parameters\n", "\n", "a = Support(5,(1,1,0)) # Defines a pin support at location x = 5 m \n", "b = Support(0,(0,1,0)) # Defines a roller support at location x = 0 m\n", "c = Support(7,(1,1,1)) # Defines a fixed support at location x = 7 m\n", "beam.add_supports(a,b,c) \n", "\n", "load_1 = PointLoadV(1000,2) # Defines a point load of 1000 N acting up, at location x = 2 m\n", "load_2 = DistributedLoadV(2000,(1,4)) # Defines a 2000 N/m UDL from location x = 1 m to x = 4 m \n", "load_3 = PointTorque(2*10**3, 3.5) # Defines a 2*10**3 N.m point torque at location x = 3.5 m\n", "beam.add_loads(load_1,load_2,load_3) # Assign the support objects to a beam object created earlier\n", "\n", "beam.analyse()\n", "\n", "fig_1 = beam.plot_beam_external()\n", "fig_1.show()\n", "\n", "fig_2 = beam.plot_beam_internal()\n", "fig_2.show()\n", "\n", "# save the results (optional)\n", "# Can save figure using ``fig.write_image(\"./results.pdf\")`` (can change extension to be\n", "# png, jpg, svg or other formats as reired). Requires pip install -U kaleido\n", "\n", "# fig_1.write_image(\"./readme_example_diagram.png\")\n", "# fig_2.write_image(\"./readme_example_internal.png\")" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.3" } }, "nbformat": 4, "nbformat_minor": 2 }