Example #1
0
        for u,v in mesh.face_halfedges(fkey):
            # add top vertices of face
            x, y, z = vertices_list[key_index_a[u]]
            voussoir_mesh.add_vertex(key_index_a[u],x=x,y=y,z=z)
            
            # add bottom vertices of face
            x, y, z = vertices_list[key_index_b[u]]
            voussoir_mesh.add_vertex(key_index_b[u],x=x,y=y,z=z)
            
            # add interfaces
            face = [key_index_a[v], key_index_a[u], key_index_b[u], key_index_b[v]]
            voussoir_mesh.add_face(face)
  
        # add top and bottom faces
        face_a = [key_index_a[key] for key in mesh.face_vertices(fkey)]
        face_b = [key_index_b[key] for key in mesh.face_vertices(fkey)]
        face_b.reverse()
        voussoir_mesh.add_face(face_a)
        voussoir_mesh.add_face(face_b)
  
        voussoirs_meshes[fkey] = voussoir_mesh
  
    # draw all voussoir meshes
    for fkey, voussoir_mesh in voussoirs_meshes.items():
        # assign voussoir mesh to tessellation mesh
        mesh.set_face_attribute(fkey, 'voussoir', voussoir_mesh.to_data())

    # save tessellation mesh as json
    mesh.to_json('tessellation_mesh.json')
    rs.MessageBox("Great! You just saved a JSON file!")