from compas.datastructures import Mesh

from compas_rhino.artists.meshartist import MeshArtist
from compas_rhino.helpers import mesh_select_face

if __name__ == '__main__':

    # get mesh from json
    mesh = Mesh.from_json('tessellation_mesh.json')

    # draw tessellation mesh
    artist = MeshArtist(mesh, layer='tessellation_mesh')
    artist.draw_edges()
    artist.draw_facelabels()
    artist.redraw()

    # select a face
    fkey = mesh_select_face(mesh, message='Select face.')

    artist.clear_facelabels()

    # find neighboring faces
    fkeys = list(mesh.face_neighbors(fkey)) + [fkey]
    for fkey in fkeys:
        # get voussoir meshes stored as face attribute
        data = mesh.get_face_attribute(fkey, 'voussoir')
        voussoir_mesh = Mesh.from_data(data)
        # draw neighboring voussoir mesh
        artist = MeshArtist(voussoir_mesh, layer='voussoir_meshes')
        artist.draw_faces(join_faces=True)
예제 #2
0
    from compas.datastructures.mesh import Mesh
    from compas.geometry.elements import Polyhedron

    from compas_rhino.artists.meshartist import MeshArtist

    poly = Polyhedron.generate(12)

    mesh = Mesh.from_vertices_and_faces(poly.vertices, poly.faces)

    artist = MeshArtist(mesh, layer='MeshArtist')

    artist.clear_layer()

    artist.draw_vertices()
    artist.redraw()
    time.sleep(2.0)

    artist.draw_faces()
    artist.redraw()
    time.sleep(2.0)

    artist.draw_edges()
    artist.redraw()
    time.sleep(2.0)

    artist.draw_vertexlabels()
    artist.draw_facelabels()
    artist.draw_edgelabels()

    # artist.redraw()