Beispiel #1
0
import os
from compas_assembly.datastructures import Assembly
from compas_assembly.rhino import AssemblyArtist

try:
    HERE = os.path.dirname(__file__)
except NameError:
    HERE = os.getcwd()

DATA = os.path.join(HERE, '../../../data')
FILE = os.path.join(DATA, 'stack.json')

# ==============================================================================
# Load assembly from file
# ==============================================================================

assembly = Assembly.from_json(FILE)

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

artist = AssemblyArtist(assembly, layer="Wall")
artist.clear_layer()
artist.draw_blocks()
artist.draw_interfaces()
artist.draw_resultants(scale=0.05)
artist.color_interfaces(mode=1)
artist.redraw()
Beispiel #2
0
    {str(key): assembly.blocks[key].to_data()
     for key in assembly.blocks}
}

data = proxy.compute_interface_forces_xfunc(data,
                                            backend='CVX',
                                            solver='CPLEX')

assembly.data = data['assembly']
assembly.blocks = {
    int(key): Block.from_data(data['blocks'][key])
    for key in data['blocks']
}

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

artist = AssemblyArtist(assembly, layer="Arch")
artist.clear_layer()
artist.draw_blocks()
# artist.draw_edges()
artist.draw_nodes(color={
    key: (255, 0, 0)
    for key in assembly.nodes_where({'is_support': True})
})
artist.draw_interfaces()
artist.draw_resultants()
artist.color_interfaces(mode=1)
artist.redraw()