objects

import compas
from compas.datastructures import Mesh
from compas_rhino.objects import MeshObject

mesh = Mesh.from_off(compas.get('tubemesh.off'))

meshobject = MeshObject(mesh, name='MeshObject', layer='COMPAS::MeshObject')
meshobject.draw()

vertices = meshobject.select_vertices()

if vertices and meshobject.modify_vertices(vertices):
    meshobject.draw()

NetworkObject

class compas_rhino.objects.NetworkObject(network, scene=None, name=None, layer=None, visible=True, settings=None)[source]

Class for representing COMPAS networkes in Rhino.

Parameters
  • network (compas.datastructures.Network) – A network data structure.

  • scene (compas.scenes.Scene, optional) – A scene object.

  • name (str, optional) – The name of the object.

  • layer (str, optional) – The layer for drawing.

  • visible (bool, optional) – Toggle for the visibility of the object.

  • settings (dict, optional) – A dictionary of settings.

clear()[source]

Clear all previously created Rhino objects.

draw()[source]

Draw the object representing the network.

modify_edges(edges, names=None)

Update the attributes of the edges of a network.

Parameters
  • network (compas.datastructures.Network) – A network object.

  • edges (list) – The identifiers of the edges to update.

  • names (list, optional) – The names of the atrtibutes to update. Default is to update all attributes.

Returns

boolTrue if the update was successful. False otherwise.

modify_nodes(nodes, names=None)

Update the attributes of the nodes of a network.

Parameters
  • network (compas.datastructures.Network) – A network object.

  • nodes (list) – The identifiers of the nodes to update.

  • names (list, optional) – The names of the atrtibutes to update. Default is to update all attributes.

Returns

boolTrue if the update was successful. False otherwise.

select_edges()[source]

Select edges of the network.

Returns

list – A list of edge identifiers.

select_nodes()[source]

Select nodes of the network.

Returns

list – A list of node identifiers.


MeshObject

class compas_rhino.objects.MeshObject(mesh, scene=None, name=None, layer=None, visible=True, settings=None)[source]

Class for representing COMPAS meshes in Rhino.

Parameters
  • mesh (compas.datastructures.Mesh) – A mesh data structure.

  • scene (compas.scenes.Scene, optional) – A scene object.

  • name (str, optional) – The name of the object.

  • layer (str, optional) – The layer for drawing.

  • visible (bool, optional) – Toggle for the visibility of the object.

  • settings (dict, optional) – A dictionary of settings.

clear()[source]

Clear all Rhino objects associated with this object.

draw()[source]

Draw the object representing the mesh.

modify_edges(edges, names=None)

Update the attributes of the edges of a mesh.

Parameters
  • mesh (compas.datastructures.Mesh) – A mesh object.

  • edges (list) – The edges to update.

  • names (list, optional) – The names of the atrtibutes to update. Default is to update all attributes.

Returns

boolTrue if the update was successful. False otherwise.

modify_faces(faces, names=None)

Update the attributes of the faces of a mesh.

Parameters
  • mesh (compas.datastructures.Mesh)

  • faces (list of int)

  • names (list, optional) – The names of the atrtibutes to update. Default is to update all attributes.

Returns

boolTrue if the update was successful. False otherwise.

modify_vertices(vertices, names=None)

Update the attributes of selected vertices of a given datastructure.

Parameters
  • mesh (compas.datastructures.Datastructure) – The data structure.

  • vertices (list) – The vertices of the vertices of which the attributes should be updated.

  • names (list, optional) – The names of the attributes that should be updated. Default is to update all available attributes.

Returns

bool – True if the attributes were successfully updated. False otherwise.

select_edges(message='Select edges.')[source]

Select edges of the mesh.

Returns

list – A list of edge identifiers.

select_faces(message='Select faces.')[source]

Select faces of the mesh.

Returns

list – A list of face identifiers.

select_vertices(message='Select vertices.')[source]

Select vertices of the mesh.

Returns

list – A list of vertex identifiers.


VolMeshObject

class compas_rhino.objects.VolMeshObject(volmesh, scene=None, name=None, layer=None, visible=True, settings=None)[source]

Class for representing COMPAS volmeshes in Rhino.

Parameters
  • volmesh (compas.datastructures.VolMesh) – A volmesh data structure.

  • scene (compas.scenes.Scene, optional) – A scene object.

  • name (str, optional) – The name of the object.

  • layer (str, optional) – The layer for drawing.

  • visible (bool, optional) – Toggle for the visibility of the object.

  • settings (dict, optional) – A dictionary of settings.

clear()[source]

Clear all objects previously drawn by this artist.

draw()[source]

Draw the volmesh using the visualisation settings.

modify_edges(edges, names=None)

Update the attributes of the edges of a mesh.

Parameters
  • mesh (compas.datastructures.Mesh) – A mesh object.

  • edges (list) – The edges to update.

  • names (list, optional) – The names of the atrtibutes to update. Default is to update all attributes.

Returns

boolTrue if the update was successful. False otherwise.

modify_faces(faces, names=None)

Update the attributes of the faces of a mesh.

Parameters
  • mesh (compas.datastructures.Mesh)

  • faces (list of int)

  • names (list, optional) – The names of the atrtibutes to update. Default is to update all attributes.

Returns

boolTrue if the update was successful. False otherwise.

modify_vertices(vertices, names=None)

Update the attributes of selected vertices of a given datastructure.

Parameters
  • mesh (compas.datastructures.Datastructure) – The data structure.

  • vertices (list) – The vertices of the vertices of which the attributes should be updated.

  • names (list, optional) – The names of the attributes that should be updated. Default is to update all available attributes.

Returns

bool – True if the attributes were successfully updated. False otherwise.

select_edges(message='Select edges.')[source]

Select edges of the volmesh.

Returns

list – A list of edge identifiers.

select_faces(message='Select faces.')[source]

Select faces of the volmesh.

Returns

list – A list of face identifiers.

select_vertices(message='Select vertices.')[source]

Select vertices of the volmesh.

Returns

list – A list of vertex identifiers.


Selecting

network_select_node

Select a single node of a network.

network_select_nodes

Select multiple nodes of a network.

network_select_edge

Select a single edge of a network.

network_select_edges

Select multiple edges of a network.

mesh_select_vertex

Select a single vertex of a mesh.

mesh_select_vertices

Select multiple vertices of a mesh.

mesh_select_face

Select a single face of a mesh.

mesh_select_faces

Select multiple faces of a mesh.

mesh_select_edge

Select a single edge of a mesh.

mesh_select_edges

Select multiple edges of a mesh.

Modifying

network_update_attributes

Update the attributes of a network.

network_update_node_attributes

Update the attributes of the nodes of a network.

network_update_edge_attributes

Update the attributes of the edges of a network.

network_move_node

Move on node of the network.

mesh_update_attributes

Update the attributes of a mesh.

mesh_update_vertex_attributes

Update the attributes of selected vertices of a given datastructure.

mesh_update_face_attributes

Update the attributes of the faces of a mesh.

mesh_update_edge_attributes

Update the attributes of the edges of a mesh.

mesh_move_vertex

Move on vertex of the mesh.

mesh_move_vertices

Move on vertices of the mesh.

mesh_move_face

Move a face of the mesh to a different location and update the data structure.

Inspecting