Community
Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Multiple selection inputs

4 REPLIES 4
Reply
Message 1 of 5
p_krola
170 Views, 4 Replies

Multiple selection inputs

My Add in has two SelectionInputs. I have a problem checking which SelectionInput has been selected. How do I use activeInput ()? 

 

class MySelectHandler : public SelectionEventHandler
{
public:
	void notify(const Ptr<SelectionEventArgs>& eventArgs) override
	{
		if (!eventArgs)
			return;
		Ptr<Selection> selection = eventArgs->selection();
		if (!checkReturn(selection))
			return;


		// Get the value of the property.
		Ptr<SelectionCommandInput> propertyValue = selection->activeInput();


		

 

4 REPLIES 4
Message 2 of 5
Jorge_Jaramillo
in reply to: p_krola

Hi @p_krola ,

 

You can get the ID of the commandInput that fires the event with the id() property like so:

 

selection->activeInput()->id()

 

It returns a string.

 

Regards,
Jorge

 

Message 3 of 5
p_krola
in reply to: Jorge_Jaramillo

The function at SelectionEventHandler generates an error:

_app->log(selection->activeInput()->id());
E0135 class "adsk::core::Selection" has no member "activeInput"

I can get inputId from InputChangedEventHandler, but that doesn't solve my problem. 

Ptr<CommandInput> changedInput = eventArgs->input();
std::string activeInput = changedInput->id();

 

Message 4 of 5
Jorge_Jaramillo
in reply to: p_krola

Hi,

 

I made a mistake in the previous answer.

It is like so:

 

Ptr<SelectionCommandInput> cmdInput = eventArgs->activeInput();
string id = cmdInput->id()

 

 

Lets try it.

 

Regards,
Jorge

Message 5 of 5
BrianEkins
in reply to: p_krola

I also recently ran into this problem. It seems there's a bug with the activeInput property. The workaround I ended up using is to check the hasFocus property of each of the SelectionCommandInput objects on my dialog. The one where this is true is the one that they are using.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report