Prompts the user to pick, or select, a single object.
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)
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.
|
||||||||||||||||||||||||||||||||||||||
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. |
Guid |
The identifier of the picked object if successful. |
None |
If no object picked |
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