Beispiel #1
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

    keys = CablenetHelper.select_edges(FOFIN['cablenet'])

    scale = rs.GetReal("Scaling factor", 1.0, 0.1, 10.0)

    if not scale:
        return

    for edge in keys:
        q = FOFIN['cablenet'].get_edge_attribute(edge, 'q')
        FOFIN['cablenet'].set_edge_attribute(edge, 'q', scale * q)

    FOFIN['cablenet'].draw(layer=FOFIN['settings']['layer'],
                           clear_layer=True,
                           settings=FOFIN['settings'])
Beispiel #2
0
def select_parallel_edges(cablenet):
    keys = CablenetHelper.select_edges(cablenet)
    keys = CablenetHelper.select_parallel_edges(cablenet, keys)
    highlight_edges(cablenet, keys)
    return keys
Beispiel #3
0
def select_continuous_edges(cablenet):
    keys = CablenetHelper.select_edges(cablenet)
    keys = CablenetHelper.select_continuous_edges(cablenet, keys)
    highlight_edges(cablenet, keys)
    return keys
Beispiel #4
0
def update_edge_attributes(cablenet, settings):
    keys = CablenetHelper.select_edges(cablenet)
    if keys:
        return CablenetHelper.update_edge_attributes(cablenet, keys)

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()
    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)
artist.draw_loads()
artist.draw_reactions()
artist.redraw()