SelectionCommandInput Object

Derived from: CommandInput Object


Provides a command input to get a selection from the user.

Defined in namespace "adsk::core" and the header file is <Core/UserInterface/SelectionCommandInput.h>.


Name Description
addSelection Adds the selection to the list of selections associated with this input. This method is not valid within the commandCreated event but must be used later in the command lifetime. If you want to pre-populate the selection when the command is starting, you can use this method in the activate method of the Command. It's also valid to use in other events once the command is running, such as the validateInputs event.
addSelectionFilter Adds an additional filter to the existing filter list.
classType Static function that all classes support that returns the type of the class as a string. The returned string matches the string returned by the objectType property. For example if you have a reference to an object and you want to check if it's a SketchLine you can use myObject.objectType == fusion.SketchLine.classType().
clearSelection Clears the current selection so no entities are in the selection.
clearSelectionFilter Clears the list of selection filters.
deleteMe Deletes this Command input.
getSelectionLimits Get the limits currently defined for this input.
selection Returns the selection at the specified index.
setSelectionLimits Defines the limits for the number of selections associated with this input. A maximum value of 0 indicates that there is no maximum.


Name Description
commandInputs Gets the CommandInputs class of the parent, which can be a Command, GroupCommandInput or TabCommandInput.
commandPrompt Gets or sets the tooltip shown next to the cursor.
hasFocus Gets and sets if this selection input has focus with respect to other selection inputs on the command dialog. Only one selection input on a dialog can have focus at a time so setting hasFocus to true will remove the focus from the selection input that previously had focus. When a selection input has focus, any user selections will be added to that selection input and the selection rules associated with that selection input will apply.
id Gets the unique identifier for this input in the command's CommandInputs.
isEnabled Gets or sets if this input is currently enabled or disabled for user interaction.
isFullWidth Gets or sets if this input fills the entire width of the dialog. If true, the name is ignored and the input control will fill the entire width of the command dialog. The default value for this property in a new command input if false, or not to fill the width. This property does not apply to GroupCommandInputs or TabCommandInputs.
isValid Indicates if this object is still valid, i.e. hasn't been deleted or some other action done to invalidate the reference.
isVisible Gets or sets if this input will be visible to the user.
name Gets the user visible name of this input.
objectType This property is supported by all objects in the API and returns a string that contains the full name (namespace::objecttype) describing the type of the object.

It's often useful to use this in combination with the classType method to see if an object is a certain type. For example: if obj.objectType == adsk.core.Point3D.classType():
parentCommand Gets the parent Command.
parentCommandInput Gets the parent CommandInput if this commandInput is the child of a TabCommandInput or GroupCommandInput. Returns null if there is no parent.
selectionCount Gets the current number of selections the user has made for this input.
selectionFilters Gets or sets the list of selection filters. The valid list of selection filters can be found here: Selection Filters.
toolClipFilename Gets or sets the full filename of the image file (PNG) used for the tool clip. The tooltip is always shown but as the user hovers over the control it will progressively display the tool clip and description text.
tooltip Gets or sets the base tooltip string. This is always shown for commands. If the tooltip description and/or tool clip are also specified then the tooltip will progressively display more information as the user hovers the mouse over the control.
tooltipDescription Gets or sets additional text to display progressively along with the tooltip. The text for the description can contain some basic HTML formatting tags to format the tags. For example the br tag can be used to create multiple paragraphs. The tooltip is always shown but as the user hovers over the control it will progressively display the tool clip and description text.

Accessed From

CommandInputs.addSelectionInput, SelectionEvent.activeInput, SelectionEventArgs.activeInput


Name Description
Command Inputs API Sample

Creates a command dialog that demonstrates all of the available command inputs.

To use the sample, create a new Python or C++ script and copy and paste this code, replacing the default code. You also need to unpack this zip file which contains a resource folder into the same folder where the source code file (.py or .cpp) is.

Selection Events API Sample The sample demos how to use selection events of a command.


Introduced in version August 2014