get_objects

compas_rhino.utilities.get_objects(name=None, color=None, layer=None, type=None)[source]

Get identifiers of Rhino objects, potentially filtered by name, color, layer, or type.

Parameters
  • name (str, optional)

  • color (tuple or list, optional) – RGB color components in integer format (0-255).

  • layer (str, optional)

  • type (Rhino.DocObjects.ObjectType, optional) – The object type.

Returns

list – The GUIDs of the objects matching the filter parameters.

Examples

import compas_rhino

guids_all = compas_rhino.get_objects()
guids_compas = compas_rhino.get_objects(name='COMPAS.*')
guids_red = compas_rhino.get_objects(color=(255, 0, 0))
guids_points = compas_rhino.get_objects(type=compas_rhino.rs.filter.point)
guids_redpoints = compas_rhino.get_objects(color=(255, 0, 0), type=compas_rhino.rs.filter.point)
guids_all = set(compas_rhino.get_objects())
guids_compas = set(compas_rhino.get_objects(name='COMPAS.*'))
guids_red = set(compas_rhino.get_objects(color=(255, 0, 0)))
guids_points = set(compas_rhino.get_objects(type=compas_rhino.rs.filter.point))
guids_redpoints = set(compas_rhino.get_objects(color=(255, 0, 0), type=compas_rhino.rs.filter.point))

print guids_compas.issubset(guids_all)
print guids_all.issubset(guids_compas)

# True, False

print guids_red.issubset(guids_all)
print guids_points.issubset(guids_all)
print guids_redpoints.issubset(guids_all)

# True, True, True

print guids_redpoints.issubset(guids_points)
print guids_redpoints.issubset(guids_red)
print guids_points.issubset(guids_red)

# True, True, False