GetObjectEx

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

Syntax

rhinoscriptsyntax.GetObjectEx (message=None, filter=0, preselect=False, select=False, objects=None)

rhinoscript.selection.GetObjectEx (message=None, filter=0, preselect=False, select=False, objects=None)

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.

objects

Optional.  List.  A list of Guids identifying the objects that are allowed to be selected.

Returns

Tuple

A tuple of selection information if successful. The tuple will contain the following information:

Element

Description

0

Guid. The identifier of the object.

1

Boolean. True if the object was pre-selected, otherwise False.

2

Number. The selection method:     

0: selected by non-mouse method (SelAll, etc.).

1: selected by mouse click on the object.

2: selected by being inside of a mouse window.

3: selected by intersecting a mouse crossing window.

3

Point3d. The selection point. This value is valid only if the object was not pre-selected and it was selected by clicking the mouse on the curve.

4

String. The name of the view in which the selection was made.

None

If no object picked

Example

import rhinoscriptsyntax as rs

obj = rs.GetObjectEx("Select object", 0, True)

if obj:

    print "Object id = ", obj[0]

    print "Object was preselected = ", obj[1]

    if obj[2]==0:

        print "Selection method = 0 (non-mouse)"

    elif obj[2]==1:

        print "Selection method = 1 (mouse)"

        print "Pick point = ", obj[3]

    elif obj[2]==2:

        print "Selection method = 2 (window)"

    elif obj[2]==3:

        print "Selection method = 3 (crossing)"

    print "Active view = ", obj[4]

Also See

GetCurveObject

GetObject

GetObjects

GetObjectsEx

GetSurfaceObject