Пример #1
0
# Attributes

network.update_default_edge_attributes({'E': E, 'A': A, 's0': s0})

# Pins

gkey_key = network.gkey_key()
pins = []

for i in rs.ObjectsByLayer('Pins'):
    gkey = geometric_key(rs.PointCoordinates(i))
    key = gkey_key[gkey]
    network.set_vertex_attributes(key, 'B', [[0, 0, 0]])
    pins.append(key)

# Run XFunc

X, f, l, network = XFunc('compas.numerical.drx.drx_numpy.drx_numpy')(
    structure=network,
    factor=factor,
    tol=tol,
    steps=steps,
    refresh=10,
    update=True)

# Draw Network

artist = NetworkArtist(network=network, layer='Plot')
artist.clear_layer()
artist.draw_edges()
Пример #2
0
        self.clear_edges()


# ==============================================================================
# Main
# ==============================================================================

if __name__ == "__main__":

    import compas
    from compas.datastructures import Network
    from compas_rhino.artists.networkartist import NetworkArtist

    network = Network.from_obj(compas.get('grid_irregular.obj'))

    artist = NetworkArtist(network, layer='NetworkArtist')

    artist.clear_layer()

    artist.draw_vertices()
    artist.redraw(0.0)

    artist.draw_vertexlabels()
    artist.redraw(1.0)

    artist.draw_edges()
    artist.redraw(1.0)

    artist.draw_edgelabels()
    artist.redraw(1.0)
Пример #3
0
            return True
        return False


# ==============================================================================
# Main
# ==============================================================================

if __name__ == "__main__":

    import compas

    from compas.datastructures import Network
    from compas_rhino.artists.networkartist import NetworkArtist
    from compas_rhino.modifiers.edgemodifier import EdgeModifier

    network = Network.from_obj(compas.get('grid_irregular.obj'))

    artist = NetworkArtist(network)

    artist.clear()
    artist.draw_vertices()
    artist.draw_edges()
    artist.redraw()

    if EdgeModifier.move_edge(network, 0):
        artist.clear()
        artist.draw_vertices()
        artist.draw_edges()
        artist.redraw()
Пример #4
0
from compas.datastructures import Network
from compas_rhino import get_line_coordinates

from compas_rhino.artists.networkartist import NetworkArtist
from compas_rhino.helpers import network_select_vertices
from compas.topology import dijkstra_path
from compas.utilities import pairwise

if __name__ == '__main__':

    crvs = rs.GetObjects("Select network edges", 4)
    lines = get_line_coordinates(crvs)

    network = Network.from_lines(lines)

    artist = NetworkArtist(network, layer='new_lines')
    artist.draw_vertices(color=(255, 0, 0))
    artist.redraw()

    # select vertices
    vertices = network_select_vertices(network, "select a network vertices")

    print(vertices)

    adjacency = {
        key: network.vertex_neighbors(key)
        for key in network.vertices()
    }

    weight = {(u, v): network.edge_length(u, v) for u, v in network.edges()}
    weight.update({(v, u): weight[(u, v)] for u, v in network.edges()})