Exemplo n.º 1
0
 def draw_vertex_labels(self, **kwattr):
     artist = VolMeshArtist(self)
     artist.draw_vertexlabels(**kwattr)
Exemplo n.º 2
0
if __name__ == "__main__":

    import compas

    from compas.datastructures import VolMesh
    from compas_rhino.artists import VolMeshArtist

    volmesh = VolMesh.from_obj(compas.get('boxes.obj'))

    artist = VolMeshArtist(volmesh, layer='VolMeshArtist')

    artist.clear_layer()

    artist.draw_vertices()
    artist.redraw(0.0)

    artist.draw_vertexlabels()
    artist.redraw(1.0)

    artist.draw_faces()
    artist.redraw(1.0)

    artist.draw_facelabels()
    artist.redraw(1.0)

    artist.draw_edges()
    artist.redraw(1.0)

    artist.draw_edgelabels()
    artist.redraw(1.0)
width = dual_volmesh.bounding_box()[1][0] - dual_volmesh.bounding_box()[0][0]
for vkey in dual_volmesh.vertices():
    x = dual_volmesh.vertex_attribute(vkey, 'x')
    dual_volmesh.vertex_attribute(vkey, 'x', x + width * offset)

# ------------------------------------------------------------------------------
# 3. visualise diagrams
# ------------------------------------------------------------------------------
force_artist = VolMeshArtist(volmesh)
form_artist = VolMeshArtist(dual_volmesh)

# draw volmesh cell labels and dual_volmesh vertex labels
cell_c_dict = get_index_colordict(list(volmesh.cells()))

# draw volmesh
force_artist.draw_edges()
force_artist.draw_celllabels(color=cell_c_dict)

# draw dual volmesh
form_artist.draw_faces()
form_artist.draw_vertexlabels(color=cell_c_dict)

# draw directed volmesh halffaces and directed dual_volmesh edges
uv_c_dict = get_index_colordict(list(dual_volmesh.edges()))

face_normal_scale = 1.0
draw_directed_hf_and_uv(volmesh,
                        dual_volmesh,
                        uv_color=uv_c_dict,
                        scale=face_normal_scale)