def RunCommand(is_interactive):
    try:
        if 'compas_assembly' not in sc.sticky:
            raise Exception('Initialise the Assembly plugin first!')

        settings = sc.sticky['compas_assembly']['settings']

        guids = compas_rhino.select_surfaces()

        assembly = Assembly()
        assembly.add_blocks_from_polysurfaces(guids)
        assembly.draw(settings)

        sc.sticky['compas_assembly']['assembly'] = assembly

    except Exception as error:
        print(error)
        print(traceback.format_exc())
Exemple #2
0
import compas_rhino
from compas_rhino.artists import BoxArtist, MeshArtist
from compas_rhino.geometry import RhinoSurface

# ==============================================================================
# Paths
# ==============================================================================

HERE = os.path.dirname(__file__)
FILE = os.path.join(HERE, 'data', 'blocks.json')

# ==============================================================================
# Blocks and Blanks
# ==============================================================================

guids = compas_rhino.select_surfaces()

blocks = []

world = Frame.worldXY()

for guid in guids:
    surface = RhinoSurface.from_guid(guid)
    block = surface.to_compas()
    block.name = str(guid)

    bottom = sorted(
        block.faces(),
        key=lambda face: dot_vectors(block.face_normal(face), [0, 0, -1]))[-1]

    plane = block.face_centroid(bottom), block.face_normal(bottom)
Exemple #3
0
import os

import compas
import compas_rhino
from compas_rhino.geometry import RhinoSurface
from compas_rhino.artists import MeshArtist


def filterfunc(face):
    return True


FILE = os.path.join(os.path.dirname(__file__), 'armadillo_meshes.json')

guids = []
for guid in compas_rhino.select_surfaces():
    if compas_rhino.rs.IsPolysurface(guid):
        guids.append(guid)

meshes = []
for guid in guids:
    surf = RhinoSurface.from_guid(guid)
    mesh = surf.to_compas(facefilter=filterfunc)
    meshes.append(mesh)

compas.json_dump(meshes, FILE)

compas_rhino.clear_layers(['Armadillo'])

for mesh in meshes:
    artist = MeshArtist(mesh, layer="Armadillo::Meshes")