You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I run the example code with Beam length equal or greater than 10:
importosfrombeambendingimportBeam, DistributedLoadV, PointLoadH, PointLoadV, xdefexample_1():
"""Run example 1"""# <<< ONLY CHANGE >>>beam=Beam(10) # Initialize a Beam object of length 9 m# <<< ONLY CHANGE >>>beam.pinned_support=2# x-coordinate of the pinned supportbeam.rolling_support=7# x-coordinate of the rolling supportbeam.add_loads((
PointLoadH(10, 3), # 10 kN pointing right, at x=3 mPointLoadV(-20, 3), # 20 kN downwards, at x=3 mDistributedLoadV(-10, (3, 9)), # 10 kN/m, downwards, for 3 m <= x <= 9 mDistributedLoadV(-20+x**2, (0, 2)), # variable load, for 0 <= x <= 2 m
))
fig=beam.plot()
# save the png and add it to the documentationmod_path=os.path.dirname(os.path.abspath(__file__)) # current modulesave_name=os.path.basename(__file__).replace('.py', '.png') # file namesave_path=os.path.join(mod_path, save_name)
fig.savefig(save_path, transparent=True)
if__name__=='__main__': # call function when run as scriptexample_1()
I get the following error:
Traceback (most recent call last):
File "/Users/pedrober/.local/share/virtualenvs/pontes/lib/python3.7/site-packages/numpy/core/function_base.py", line 117, in linspace
num = operator.index(num)
TypeError: 'float' object cannot be interpreted as an integer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "diagrams.py", line 28, in<module>example_1()
File "diagrams.py", line 18, in example_1
fig = beam.plot()
File "/Users/pedrober/.local/share/virtualenvs/pontes/lib/python3.7/site-packages/beambending/beam.py", line 229, in plot
self.plot_beam_diagram(ax1)
File "/Users/pedrober/.local/share/virtualenvs/pontes/lib/python3.7/site-packages/beambending/beam.py", line 252, in plot_beam_diagram
self._plot_analytical(ax, sum(self._distributed_forces_y), **plot01_params)
File "/Users/pedrober/.local/share/virtualenvs/pontes/lib/python3.7/site-packages/beambending/beam.py", line 307, in _plot_analytical
x_vec = np.linspace(self._x0, self._x1, min(int((self.length) *1000+1),1e4))
File "<__array_function__ internals>", line 6, in linspace
File "/Users/pedrober/.local/share/virtualenvs/pontes/lib/python3.7/site-packages/numpy/core/function_base.py", line 121, in linspace
.format(type(num)))
TypeError: object of type<class 'float'> cannot be safely interpreted as an integer.
If I try to plot each figure instead of plotting all together, I get the same error.
The text was updated successfully, but these errors were encountered:
Hi, thanks for this awesome package!
If I run the example code with Beam length equal or greater than 10:
I get the following error:
If I try to plot each figure instead of plotting all together, I get the same error.
The text was updated successfully, but these errors were encountered: