I met a problem in this function,
why is nodes is []? It sometimes is normal, same with total_nodes, but every once in 2 calls it became [].
Why? How to make it as same as total_nodes?
def generate_element(
x, y, z_top, z_bottom, grayscale, material: Material, nodes: list[Node]
) -> Tuple[Element, list[Node]]:
print(f"{node_no(nodes, x, y, z_bottom) = }")
print(f"{nodes = }")
try:
input("Press Enter...")
except KeyboardInterrupt:
exit(1)
total_nodes = []
for lindex, layer in enumerate(layers):
element, ns = generate_element(
x,
y,
z_top=zs[lindex + 1],
z_bottom=zs[lindex],
grayscale=grayscale,
material=layer.material_type,
nodes=total_nodes,
)
elements.append(element)
total_nodes += ns
print(f"{total_nodes = }")
Expected:
nodes
arg is always as same as total_nodes
variable.