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)[source]
Update the attributes of the edges.
- Parameters
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
bool –
True
if the update was successful.False
otherwise.
- modify_nodes(nodes, names=None)[source]
Update the attributes of the nodes.
- Parameters
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
bool –
True
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)[source]
Update the attributes of the edges.
- Parameters
edges (list) – The edges to update.
names (list, optional) – The names of the atrtibutes to update. Default is to update all attributes.
- Returns
bool –
True
if the update was successful.False
otherwise.
- modify_faces(faces, names=None)[source]
Update the attributes of selected faces.
- Parameters
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.
- modify_vertices(vertices, names=None)[source]
Update the attributes of selected vertices.
- Parameters
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)[source]
Update the attributes of the edges.
- Parameters
edges (list) – The edges to update.
names (list, optional) – The names of the atrtibutes to update. Default is to update all attributes.
- Returns
bool –
True
if the update was successful.False
otherwise.
- modify_faces(faces, names=None)[source]
Update the attributes of selected faces.
- Parameters
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.
- modify_vertices(vertices, names=None)[source]
Update the attributes of selected vertices.
- Parameters
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.