cablenet = Cablenet.from_obj(compas.get('faces.obj'))

for key, attr in cablenet.vertices(True):
    attr['is_anchor'] = cablenet.vertex_degree(key) == 2

artist = CablenetArtist(cablenet, layer="Mesh::FD")

draw()

while True:
    selected = CablenetHelper.select_vertices(cablenet)
    if not selected:
        break

    if CablenetHelper.update_vertex_attributes(cablenet, selected):
        cablenet_fd(cablenet)
        draw()

while True:
    selected = CablenetHelper.select_edges(cablenet)
    if not selected:
        break

    if CablenetHelper.update_edge_attributes(cablenet, selected):
        cablenet_fd(cablenet)
        draw()

draw()
예제 #2
0
def update_vertex_attributes(cablenet, settings):
    keys = CablenetHelper.select_vertices(cablenet)
    if keys:
        return CablenetHelper.update_vertex_attributes(cablenet, keys)
예제 #3
0

def draw():
    artist.clear_layer()
    artist.draw_vertices()
    artist.draw_edges()
    artist.redraw()


draw()

while True:
    keys = CablenetHelper.select_vertices(cablenet)
    if not keys:
        break
    if CablenetHelper.update_vertex_attributes(cablenet, keys):
        cablenet_fd_alglib(cablenet)
        draw()

while True:
    keys = CablenetHelper.select_edges(cablenet)
    if not keys:
        break
    if CablenetHelper.update_edge_attributes(cablenet, keys):
        cablenet_fd_alglib(cablenet)
        draw()

artist.clear_layer()
artist.draw_vertices()
artist.draw_edges()
artist.draw_forces(scale=0.05)