示例#1
0
def move_vertices(cablenet, settings):
    keys = CablenetHelper.select_vertices(cablenet)
    if not keys:
        return
    if CablenetHelper.move_vertices(cablenet, keys):
        cablenet.draw(layer=settings['layer'],
                      clear_layer=True,
                      settings=settings)
示例#2
0
def RunCommand(is_interactive):
    if "FOFIN" not in sc.sticky:
        print("Initialise the plugin first!")
        return

    FOFIN = sc.sticky['FOFIN']
    if not FOFIN['cablenet']:
        return

    fkey = CablenetHelper.select_face(FOFIN['cablenet'])
    if fkey is None:
        return

    u, v = CablenetHelper.select_vertices(FOFIN['cablenet'])

    mesh_split_face(FOFIN['cablenet'], fkey, u, v)

    FOFIN['cablenet'].cull_vertices()

    FOFIN['cablenet'].draw(layer=FOFIN['settings']['layer'],
                           clear_layer=True,
                           settings=FOFIN['settings'])
示例#3
0
def update_vertex_attributes(cablenet, settings):
    keys = CablenetHelper.select_vertices(cablenet)
    if keys:
        return CablenetHelper.update_vertex_attributes(cablenet, keys)
    })
    artist.draw_edges()
    artist.redraw()


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()