Skip to content

Error #245

@MunsakaPKM

Description

@MunsakaPKM

i am getting an error when i try to run the example about creating a truss in the Load cases in the documentation:

error message : C:\ProgramData\miniconda3\python.exe "C:\Users\Bukkale\PycharmProjects\pythonProject12\Environment(Urban, Rural, and Natural).py"
Traceback (most recent call last):
File "C:\Users\Bukkale\PycharmProjects\pythonProject12\Environment(Urban, Rural, and Natural).py", line 17, in
ss.add_element_grid(x[1:-1][::2], np.ones(x.shape) * y.max(), element_type=element_type)
File "C:\Users\Bukkale\AppData\Roaming\Python\Python311\site-packages\anastruct\fem\system.py", line 298, in add_element_grid
raise FEMException(
anastruct.basic.FEMException: ('Wrong parameters', 'x and y should have the same length.')

Process finished with exit code 1

code :

 from anastruct import SystemElements
import matplotlib.pyplot as plt
import numpy as np
ss = SystemElements()
element_type = 'truss'
# create triangles
x = np.arange(1, 10) * np.pi
y = np.cos(x)
y -= y.min()
ss.add_element_grid(x, y, element_type=element_type)
# add top girder
ss.add_element_grid(x[1:-1][::2], np.ones(x.shape) * y.max(), element_type=element_type)
# add bottom girder
ss.add_element_grid(x[::2], np.ones(x.shape) * y.min(), element_type=element_type)
# supports
ss.add_support_hinged(1)
ss.add_support_roll(-1, 2)
# loads
ss.point_load(node_id=np.arange(2, 9, 2), Fy=-100)
ss.solve()
ss.show_structure()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions