GetObject
The GetObject class is the tool commands use to interactively select objects.
Inheritance Hierarchy
System.Object
Rhino.Input.Custom.GetBaseClass
Rhino.Input.Custom.GetObject
Namespace: Rhino.Input.Custom
Assembly: RhinoCommon (in RhinoCommon.dll)
Syntax
public class GetObject : GetBaseClass
The GetObject type exposes the following members.
Constructors
Name
Description
Public Method
Code Example
GetObject
Initializes a new instance of the GetObject class
Properties
Name
Description
Public Property
AlreadySelectedObjectSelect
Allow selecting objects that are already selected. By default, GetObjects() disallows selection of objects that are already selected to avoid putting the same object in the selection set more than once. Calling EnableAlreadySelectedObjectSelect = true overrides that restriction and allows selected objects to be selected and returned by GetObjects. This is useful because, coupled with the return immediately mode of GetObjects(1, -1), it is possible to select a selected object to deselect when the selected objects are being managed outside GetObjects() as in the case of CRhinoPolyEdge::GetEdge().
Public Property
BottomObjectPreference
By default, if a call to Input is permitted to select different parts of the same object, like a polysurface, a surface and an edge, then the top-most object is preferred. (polysurface beats face beats edge). If you want the bottom most object to be preferred, then call EnableBottomObjectPreference = true before calling GetObjects().
Public Property
ChooseOneQuestion
By default, if a call to Input is permitted to select different parts of the same object, like a polysurface and an edge of that polysurface, then the top-most object is automatically selected. If you want the choose-one-object mechanism to include pop up in these cases, then call EnableChooseOneQuestion = true before calling GetObjects().
Public Property
Code Example
DeselectAllBeforePostSelect
true if pre-selected input will be deselected before post-selection begins when no pre-selected input is valid.
Public Property
Code Example
GeometryAttributeFilter
The geometry attribute filter provides a secondary filter that can be used to restrict which objects can be selected. Control of the type of geometry (points, curves, surfaces, meshes, etc.) is provided by GetObject.SetGeometryFilter. The geometry attribute filter is used to require the selected geometry to have certain attributes (open, closed, etc.). The default attribute filter permits selection of all types of geometry.
Public Property
Code Example
GeometryFilter
The geometry type filter controls which types of geometry (points, curves, surfaces, meshes, etc.) can be selected. The default geometry type filter permits selection of all types of geometry. NOTE: the filter can be a bitwise combination of multiple ObjectTypes.
Public Property
Code Example
GroupSelect
By default, groups are ignored in GetObject. If you want your call to GetObjects() to select every object in a group that has any objects selected, then enable group selection.
Public Property
InactiveDetailPickEnabled
By default, objects in inactive details are not permitted to be picked. In a few rare cases this is used (ex. picking circles during DimRadius)
Public Property
ObjectCount
Gets the number of objects that were selected.
Public Property
ObjectsWerePreselected
Public Property
Code Example
OneByOnePostSelect
In one-by-one post selection, the user is forced to select objects by post picking them one at a time.
Public Property
ProxyBrepFromSubD
If a subd (or a subd component) cannot be selected, but a brep (or brep component) can be selected, then automatically create and use a proxy brep.
Public Property
Code Example
ReferenceObjectSelect
By default, reference objects can be selected. If you do not want to be able to select reference objects, then call EnableReferenceObjectSelect=false.
Public Property
SerialNumber
Each instance of GetObject has a unique runtime serial number that is used to identify object selection events associated with that instance.
Public Property
Code Example
SubObjectSelect
By default, GetObject.Input will permit a user to select sub-objects (like a curve in a b-rep or a curve in a group). If you only want the user to select “top” level objects, then call EnableSubObjectSelect = false.
Methods
Name
Description
Public Method
AcceptColor
If you want to allow the user to be able to type in a color r,g,b or name during GetPoint.Get(), GetObject::GetObjects(), etc., then call AcceptColor(true) before calling GetPoint()/GetObject(). If the user chooses to type in a color, then the result code GetResult.Color is returned and you can use RhinoGet.Color() to get the value of the color. If the get accepts points, then the user will not be able to type in r,g,b colors but will be able to type color names.
(Inherited from GetBaseClass.)
Public Method
AcceptCustomMessage
(Inherited from GetBaseClass.)
Public Method
AcceptEnterWhenDone
There are instances of RhinoGet that prompt with “Press Enter when Done.” yet do not call AcceptNothing(). On the Mac, these instances need an additional call to AcceptEnterWhenDone() so the GetPointOptions dialog can correctly enable the Done button.
(Inherited from GetBaseClass.)
Public Method
Code Example
AcceptNothing
If you want to allow the user to be able to press enter in order to skip selecting a something in GetPoint.Get(), GetObject::GetObjects(), etc., then call AcceptNothing( true ) beforehand.
(Inherited from GetBaseClass.)
Public Method
AcceptNumber
If you want to allow the user to be able to type in a number during GetPoint.Get(), GetObject::GetObjects(), etc., then call AcceptNumber() beforehand. If the user chooses to type in a number, then the result code GetResult.Number is returned and you can use RhinoGet.Number() to get the value of the number. If you are using GetPoint and you want “0” to return (0,0,0) instead of the number zero, then set acceptZero = false.
(Inherited from GetBaseClass.)
Public Method
AcceptPoint
If you want to allow the user to be able to type in a point then call AcceptPoint(true) before calling GetPoint()/GetObject(). If the user chooses to type in a number, then the result code GetResult.Point is returned and you can use RhinoGet.Point() to get the value of the point.
(Inherited from GetBaseClass.)
Public Method
AcceptString
If you want to allow the user to be able to type in a string during GetPoint.Get(), GetObject::GetObjects(), etc., then call AcceptString(true) before calling GetPoint()/GetObject(). If the user chooses to type in a string, then the result code GetResult.String is returned and you can use RhinoGet.String() to get the value of the string.
(Inherited from GetBaseClass.)
Public Method
AcceptUndo
If you want to allow the user to have an ‘undo’ option in GetPoint.Get(), GetObject.GetObjects(), etc., then call AcceptUndo(true) beforehand.
(Inherited from GetBaseClass.)
Public Method
Static Member
ActiveGetObject
Get the currently running GetObject for a given document
Public Method
AddOption(LocalizeStringPair)
Adds a command line option.
(Inherited from GetBaseClass.)
Public Method
Code Example
AddOption(String)
Adds a command line option.
(Inherited from GetBaseClass.)
Public Method
AddOption(LocalizeStringPair, LocalizeStringPair)
Adds a command line option.
(Inherited from GetBaseClass.)
Public Method
AddOption(String, String)
Adds a command line option.
(Inherited from GetBaseClass.)
Public Method
AddOption(LocalizeStringPair, LocalizeStringPair, Boolean)
Adds a command line option.
(Inherited from GetBaseClass.)
Public Method
AddOption(String, String, Boolean)
Adds a command line option.
(Inherited from GetBaseClass.)
Public Method
AddOptionColor(LocalizeStringPair, OptionColor.)
Add a command line option to get colors and automatically save the value.
(Inherited from GetBaseClass.)
Public Method
AddOptionColor(String, OptionColor.)
Add a command line option to get colors and automatically save the value.
(Inherited from GetBaseClass.)
Public Method
AddOptionColor(LocalizeStringPair, OptionColor., String)
Add a command line option to get colors and automatically save the value.
(Inherited from GetBaseClass.)
Public Method
AddOptionColor(String, OptionColor., String)
Add a command line option to get colors and automatically save the value.
(Inherited from GetBaseClass.)
Public Method
Code Example
AddOptionDouble(LocalizeStringPair, OptionDouble.)
Adds a command line option to get numbers and automatically save the value.
(Inherited from GetBaseClass.)
Public Method
Code Example
AddOptionDouble(String, OptionDouble.)
Adds a command line option to get numbers and automatically save the value.
(Inherited from GetBaseClass.)
Public Method
AddOptionDouble(LocalizeStringPair, OptionDouble., String)
Adds a command line option to get numbers and automatically saves the value.
(Inherited from GetBaseClass.)
Public Method
AddOptionDouble(String, OptionDouble., String)
Adds a command line option to get numbers and automatically save the value.
(Inherited from GetBaseClass.)
Public Method
AddOptionEnumList.T.(String, T)
Adds a choice of enumerated values as list option
(Inherited from GetBaseClass.)
Public Method
AddOptionEnumList.T.(String, T, .T.)
Adds a choice of enumerated values as list option. Allows to include only some enumerated values.
(Inherited from GetBaseClass.)
Public Method
AddOptionEnumSelectionList.T.
Adds a list of enumerated values as option list. Use enumSelection[go.Option.CurrentListOptionIndex] to retrieve selection.
(Inherited from GetBaseClass.)
Public Method
Code Example
AddOptionInteger(LocalizeStringPair, OptionInteger.)
Adds a command line option to get integers and automatically save the value.
(Inherited from GetBaseClass.)
Public Method
Code Example
AddOptionInteger(String, OptionInteger.)
Adds a command line option to get integers and automatically save the value.
(Inherited from GetBaseClass.)
Public Method
AddOptionInteger(LocalizeStringPair, OptionInteger., String)
Adds a command line option to get integers and automatically save the value.
(Inherited from GetBaseClass.)
Public Method
AddOptionInteger(String, OptionInteger., String)
Adds a command line option to get integers and automatically save the value.
(Inherited from GetBaseClass.)
Public Method
Code Example
AddOptionList(LocalizeStringPair, IEnumerable.LocalizeStringPair., Int32)
Adds a command line list option.
(Inherited from GetBaseClass.)
Public Method
Code Example
AddOptionList(String, IEnumerable.String., Int32)
Adds a command line list option.
(Inherited from GetBaseClass.)
Public Method
Code Example
AddOptionToggle(LocalizeStringPair, OptionToggle.)
Adds a command line option to toggle a setting.
(Inherited from GetBaseClass.)
Public Method
Code Example
AddOptionToggle(String, OptionToggle.)
Adds a command line option to toggle a setting.
(Inherited from GetBaseClass.)
Public Method
AppendToPickList
Public Method
Code Example
ClearCommandOptions
Clear all command options.
(Inherited from GetBaseClass.)
Public Method
ClearDefault
Clears any defaults set using SetDefaultPoint, SetDefaultNumber, SetDefaultString, or SetCommandPromptDefault.
(Inherited from GetBaseClass.)
Public Method
ClearObjects
Clear possible special object drawing
Public Method
Color
Gets a color if Get*() returns GetResult.Color.
(Inherited from GetBaseClass.)
Public Method
Code Example
CommandResult
Helper method for getting command result value from getter results.
(Inherited from GetBaseClass.)
Public Method
CustomGeometryFilter
Checks geometry to see if it can be selected. Override to provide fancy filtering.
Public Method
CustomMessage
(Inherited from GetBaseClass.)
Public Method
DisablePreSelect
Public Method
Dispose.
(Inherited from GetBaseClass.)
Protected Method
Dispose(Boolean)
(Inherited from GetBaseClass.)
Public Method
EnableClearObjectsOnEntry
By default the picked object list is cleared when GetObject.GetObjects() is called. If you are reusing a GetObject class and do not want the existing object list cleared when you call Input, then call EnableClearObjectsOnEntry(false) before calling GetObjects().
Public Method
EnableHighlight
By default, any object post-pick selected by GetObjects() is highlighted. If you want to post-pick objects and not have them automatically highlight, then call EnableHighlight = false.
Public Method
EnableIgnoreGrips
By default, post selection will select objects with grips on. If you do not want to be able to post select objects with grips on, then call EnableIgnoreGrips = false. The ability to preselect an object with grips on is determined by the value returned by the virtual RhinoObject.IsSelectableWithGripsOn.
Public Method
EnablePostSelect
Control the availability of post selection in GetObjects.
Public Method
EnablePreSelect
Control the pre-selection behavior GetObjects.
Public Method
EnablePressEnterWhenDonePrompt
By default, when GetObject.GetObjects is called with minimumNumber > 0 and maximumNumber = 0, the command prompt automatically includes “Press Enter when done” after the user has selected at least minimumNumber of objects. If you want to prohibit the addition of the “Press Enter when done”, then call EnablePressEnterWhenDonePrompt = false;
Public Method
EnableSelPrevious
By default, any object selected during a command becomes part of the “previous selection set” and can be reselected by the SelPrev command. If you need to select objects but do not want them to be selected by a subsequent call to SelPrev, then call EnableSelPrev = false.
Public Method
EnableTransparentCommands
Control the availability of transparent commands during the get.
(Inherited from GetBaseClass.)
Public Method
EnableUnselectObjectsOnExit
By default any objects in the object list are unselected when GetObject.GetObjects() exits with any return code besides Object. If you want to leave the objects selected when non-object input is returned, then call EnableUnselectObjectsOnExit(false) before calling GetObjects().
Public Method
Equals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected Method
Finalize
(Inherited from GetBaseClass.)
Public Method
Get
Call to select a single object.
Public Method
GetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public Method
Code Example
GetMultiple
Call to select objects.
Public Method
GetSelectedEnumValue.T.
Returns the selected enumerated value. Use this in combination with
AddOptionEnumList.T.(String, T)
.This must be called directly after having called a Get method, and having obtained a Option value.
(Inherited from GetBaseClass.)
Public Method
GetSelectedEnumValueFromSelectionList.T.
Returns the selected enumerated value by looking at the list of values from which to select. Use this in combination with
AddOptionEnumSelectionList.T.(String, IEnumerable.T., Int32)
(Inherited from GetBaseClass.)
Public Method
GetType
Gets the Type of the current instance.
(Inherited from Object.)
Public Method
GotDefault
Returns true if user pressed Enter to accept a default point, number, or string set using SetDefaultPoint, SetDefaultNumber, or SetDefaultString.
(Inherited from GetBaseClass.)
Public Method
Line2d
Returns two points defining the location in the view window of the 2d line selected in GetPoint::Get2dLine().
(0,0) = upper left corner of window.
(Inherited from GetBaseClass.)
Protected Method
MemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public Method
Code Example
Number
Gets a number if GetPoint.Get(), GetObject.GetObjects(), etc., returns GetResult.Number.
(Inherited from GetBaseClass.)
Public Method
Code Example
Object
Public Method
Objects
Public Method
Option
(Inherited from GetBaseClass.)
Public Method
OptionIndex
(Inherited from GetBaseClass.)
Public Method
PassesGeometryAttributeFilter
Checks geometry to see if it passes the basic GeometryAttributeFilter.
Public Method
PickRectangle
If the get was a GetObjects() and the mouse was used to select the objects, then the returned rectangle has left < right and top < bottom. This rectangle is the Windows GDI screen coordinates of the picking rectangle. RhinoViewport.GetPickXform( pick_rect, pick_xform ) will calculate the picking transformation that was used. In all other cases, left=right=top=bottom=0;
(Inherited from GetBaseClass.)
Public Method
Code Example
Point
Gets a point if Get*() returns GetResult.Point.
(Inherited from GetBaseClass.)
Public Method
Point2d
Returns location in view of point in selected in GetPoint::Get() or GetPoint::Get2dPoint(). (0,0) = upper left corner of window.
(Inherited from GetBaseClass.)
Public Method
Rectangle2d
Returns the location in the view of the 2d rectangle selected in GetPoint::Get2dRectangle(). rect.left < rect.right and rect.top < rect.bottom (0,0) = upper left corner of window.
(Inherited from GetBaseClass.)
Public Method
Result
Returns result of the Get*() call.
(Inherited from GetBaseClass.)
Public Method
Code Example
SetCommandPrompt
Sets prompt message that appears in the command prompt window.
(Inherited from GetBaseClass.)
Public Method
Code Example
SetCommandPromptDefault
Sets message that describes what default value will be used if the user presses enter. This description appears in angle brackets <> in the command prompt window. You do not need to provide a default value description unless you explicitly enable AcceptNothing.
(Inherited from GetBaseClass.)
Public Method
Code Example
SetCustomGeometryFilter
Set filter callback function that will be called by the CustomGeometryFilter
Public Method
SetDefaultColor
Sets a color as default value that will be returned if the user presses ENTER key during the get.
(Inherited from GetBaseClass.)
Public Method
SetDefaultInteger
Sets a number as default value that will be returned if the user presses ENTER key during the get.
(Inherited from GetBaseClass.)
Public Method
SetDefaultNumber
Sets a number as default value that will be returned if the user presses ENTER key during the get.
(Inherited from GetBaseClass.)
Public Method
SetDefaultPoint
Sets a point as default value that will be returned if the user presses the ENTER key during the get.
(Inherited from GetBaseClass.)
Public Method
Code Example
SetDefaultString
Sets a string as default value that will be returned if the user presses ENTER key during the get.
(Inherited from GetBaseClass.)
Public Method
SetOptionVaries
Sets a command line option value to print “Varies” instead of the regular value.
(Inherited from GetBaseClass.)
Public Method
SetPressEnterWhenDonePrompt
The default prompt when EnablePressEnterWhenDonePrompt is enabled is “Press Enter when done”. Use this function to specify a different string to be appended.
Public Method
SetWaitDuration
Sets the wait duration (in milliseconds) of the getter. If the duration passes without the user making a decision, the GetResult.Timeout code is returned.
(Inherited from GetBaseClass.)
Public Method
Code Example
StringResult
Gets a string if GetPoint.Get(), GetObject.GetObjects(), etc., returns GetResult.String.
(Inherited from GetBaseClass.)
Public Method
ToString
Returns a string that represents the current object.
(Inherited from Object.)
Public Method
Vector
Gets a direction if Get*() returns GetResult.Point (Set by some digitizers, but in general it’s (0,0,0).
(Inherited from GetBaseClass.)
Public Method
Code Example
View
Gets a view the user clicked in during GetPoint.Get(), GetObject.GetObjects(), etc.
(Inherited from GetBaseClass.)
Examples
GetObject go = new GetObject(); go.GetObjects(1,0); if( go.CommandResult() != Command.Result.Success ) … use canceled or some other type of input was provided int object_count = go.ObjectCount(); for( int i=0; i<object_count; i++ ) { ObjectReference objref = go.Object(i); ON_Geometry geo = objref.Geometry(); … }