In the edge pockets, we will insert splines (here steel rebars) that can in turn be attached by hooks to the supporting structure. In order to visualize the splines, we first need to find edges where both vertices are anchored. Then we draw a cylinder with the spline radius.
mesh.update_default_edge_attributes({'is_spline': False})for u, v in mesh.edges():if mesh.vertex_attribute(u, 'is_anchor')and mesh.vertex_attribute(v, 'is_anchor'): mesh.edge_attribute((u, v), 'is_spline', True)elif mesh.edge_attribute((u, v), 'cable'): mesh.edge_attribute((u, v), 'is_spline', True)for u, v in mesh.edges_where({'is_spline': True}): sp, ep = mesh.edge_coordinates(u, v) lines.append({'start': sp,'end': ep,'radius': radius,'color': (255, 0,0),'name': "spline.{}-{}".format(u, v) })
Calculate Spline Length and Weight
To order splines, we can calculate the edge length.
# initialize the total length and weighttotal_length =0total_weight =0weight =7850# kg/m3section =0.008**2* m.pi# loop through the edges to calculate edge length and weightfor u, v in mesh_1.edges_where({'is_spline': True}): edge_len = mesh_1.edge_length(u, v) total_length += edge_len total_weight += edge_len * weight * sectionfor u, v in mesh_2.edges_where({'is_spline': True}): edge_len = mesh_2.edge_length(u, v) total_length += edge_len total_weight += edge_len * weight * section