Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import compas
import rhinoscriptsyntax as rs
from compas.datastructures import VolMesh
def draw_volmesh(mesh, layer=None, draw_cells=True):
if layer:
vkeys = sorted(list(mesh.vertices()), key=int)
vertices = [mesh.vertex_coordinates(vk) for vk in vkeys]
if draw_cells:
meshes = []
for ckey in mesh.cell:
faces = [mesh.halfface_vertices(fk, ordered=True) for fk in mesh.cell_halffaces(ckey)]
meshes.append(rs.AddMesh(vertices, faces))
return meshes
faces = []
for fk in mesh.halfface:
face = mesh.halfface_vertices(fk, ordered=True)
mesh = rs.AddMesh(vertices, faces)
return mesh
if __name__ == '__main__':
volmesh = VolMesh.from_obj(compas.get('boxes.obj'))
draw_volmesh(volmesh, layer='Default', draw_cells=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.