def test_volmesh_data(): # if not os.path.exists("temp"): # os.mkdir("temp") vmesh1 = VolMesh.from_obj(compas.get('boxes.obj')) data1 = vmesh1.to_data() # vmesh1.to_json('temp/vmesh1.json') # vmesh1.from_json('temp/vmesh1.json') # vmesh1.validate_data() # vmesh1.validate_json() data1_ = vmesh1.to_data() assert data1 == data1_ vmesh2 = VolMesh.from_data(data1_) # vmesh2.validate_data() # vmesh2.validate_json() data2 = vmesh2.to_data() # vmesh2.to_json('temp/vmesh2.json') # vmesh2.from_json('temp/vmesh2.json') data2_ = vmesh2.to_data() assert data2 == data2_ assert data1 == data2
def clear(self): self.clear_vertices() self.clear_faces() self.clear_edges() # ============================================================================== # Main # ============================================================================== if __name__ == "__main__": import compas from compas.datastructures import VolMesh volmesh = VolMesh.from_obj(compas.get('boxes.obj')) artist = VolMeshArtist(volmesh, layer='VolMeshArtist') # artist.clear_layer() artist.draw_vertices() artist.draw_vertexlabels() # artist.clear_vertexlabels() artist.draw_edges() artist.draw_edgelabels() # artist.clear_edgelabels()