From 881e6d1fd7951009ebaa0b9c2dc062b5eea53e89 Mon Sep 17 00:00:00 2001 From: thisisapple <85461103+thisisapple@users.noreply.github.com> Date: Sun, 1 Sep 2024 20:56:56 -0500 Subject: [PATCH] Update assembly.py When the user adds a node, the original element will be deleted. The SystemElements object cannot pass validation because a non-existing element was referenced. An error will occur. To avoid this error, I use the enumerate() method. --- anastruct/fem/system_components/assembly.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/anastruct/fem/system_components/assembly.py b/anastruct/fem/system_components/assembly.py index 7cf830ec..e4cc38d0 100644 --- a/anastruct/fem/system_components/assembly.py +++ b/anastruct/fem/system_components/assembly.py @@ -223,8 +223,8 @@ def assemble_system_matrix( # # thus with appending numbers in the system matrix: column = row - for i in range(len(system.element_map)): - element = system.element_map[i + 1] + i, element in enumerate(system.element_map.values()): + # element = system.element_map[i + 1] element_matrix = element.stiffness_matrix # n1 and n2 are starting indexes of the rows and the columns for node 1 and node 2