Exemplo n.º 1
0
def create_cablenet_from_json(settings):
    folder = settings["file.dir"] or HERE
    filepath = compas_rhino.select_file(folder=folder, filter="json")
    if not filepath:
        return
    cablenet = Cablenet.from_json(filepath)
    return cablenet
Exemplo n.º 2
0
def RunCommand(is_interactive):
    if "FoFin" not in sc.sticky:
        raise Exception("Initialise the plugin first!")

    settings = sc.sticky["FoFin"]['settings']

    filepath = compas_rhino.browse_for_file()
    if not filepath:
        return

    if not filepath.endswith('.json'):
        return

    cablenet = Cablenet.from_json(filepath)

    sc.sticky["FoFin"]["cablenet"] = cablenet

    artist = CablenetArtist(cablenet, layer=settings['layer'])
    artist.clear_layer()
    artist.draw_mesh()
    artist.draw_vertices()
    artist.draw_edges()
    artist.redraw()
Exemplo n.º 3
0
from compas_fofin.datastructures import Cablenet
from compas_fofin.analysis import mesh_materialize_cables

from compas_plotters import MeshPlotter

# ==============================================================================
# Create a cablenet
# ==============================================================================

HERE = os.path.dirname(__file__)
FILE_I = os.path.join(HERE, 'hypar.json')
FILE_O = os.path.join(HERE, 'hypar_materialized.json')
FILE_P = os.path.join(HERE, 'hypar_materialized.png')

cablenet = Cablenet.from_json(FILE_I)

# ==============================================================================
# Materialize
# ==============================================================================

mesh_materialize_cables(cablenet)

# ==============================================================================
# Visualize
# ==============================================================================

edges = list(cablenet.edges_where({'is_edge': True}))

stress = [cablenet.stress(key) for key in edges]
cmap = Colormap(stress, 'rgb')