GetObject

Prompts the user to pick, or select, a single object.

Syntax

rhinoscriptsyntax.GetObject ( message=None, filter=0, preselect=False, select=False, custom_filter=None, subobjects=False)

rhinoscript.selection.GetObject ( message=None, filter=0, preselect=False, select=False, custom_filter=None, subobjects=False)

Parameters

message

Optional.  String.  A prompt or message.

filter

Optional.  Number.  The type or types of geometry objects (points, curves, surfaces, meshes, etc.) that can be selected.  Object types can be added together to filter several different kinds of geometry.

Value

Description

0

All objects (default)

1

Point

2

Point cloud

4

Curve

8

Surface or single-face brep

16

Polysurface or multiple-face

32

Mesh

256

Light

512

Annotation

4096

Instance or block reference

8192

Text dot object

16384

Grip object

32768

Detail

65536

Hatch

131072

Morph control

134217728

Cage

268435456

Phantom

536870912

Clipping plane

preselect

Optional.  Boolean.  Allow for the selection of pre-selected objects.  If omitted, pre-selected objects are not accepted (False).

select

Optional.  Boolean.  Specifies whether or not the picked objects will remain selected when the function ends.  If omitted, objects that were pre-picked will remain selected and the objects that were post-picked will not be selected.

custom_filter

Optional.  Function. Custom function that takes three inputs; RhinoObject, Geometry, and component index. The function should return True or False to determine if the input object should be selected.

subobjects

Optional.  Boolean.  Allow sub object selection. If True an ObjRef class is returned instead of an identifier. This class can be passed to other functions.

Returns

Guid

The identifier of the picked object if successful.

None

If no object picked

Example

import rhinoscriptsyntax as rs

objectId = rs.GetObject("Pick any object")

if objectId:

    print "Object identifier: ", objectId

 

objectId = rs.GetObject("Pick a curve or surface", rs.filter.curve | rs.filter.surface)

if objectId:

    print "Object identifier: ", objectId

 

Also See

GetCurveObject

GetObjectEx

GetObjects

GetSurfaceObject