selectEntity Internal Validation Error

selectEntity Internal Validation Error

scottmoyse
Mentor Mentor
1,079 Views
4 Replies
Message 1 of 5

selectEntity Internal Validation Error

scottmoyse
Mentor
Mentor

I'm using ui.selectEntity command within a commandExecuteHandler which works well. But if the user hits escape on their keyboard to cancel the command without having selected anything they get the following error:

scottmoyse_0-1591476825993.png

The information and examples in the API documentation for onDestroy is slim to none. 

 

So I'm not sure on how to handle cleaning up after this properly.

 


Scott Moyse
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature


RevOps Strategy Manager at Toolpath. New Zealand based.

Co-founder of the Grumpy Sloth full aluminium billet mechanical keyboard project

0 Likes
1,080 Views
4 Replies
Replies (4)
Message 2 of 5

scottmoyse
Mentor
Mentor

I tried using 

userInterface_var.terminateActiveCommand()

in an onDestroy handler... but that seemed to mess up some of the logic I have running after ui.selectEntities has been called within my command.

 

I've noticed in some of the pre-installed add-ins that derive a CommandTerminatedHandler classe from the ApplicationCommandEventHandler object base class rather than creating an onDestroy class derived from the CommandEventHandler class. But the documentation doesn't really explain what it's intended use case is or practically what the difference between the two are.


Scott Moyse
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature


RevOps Strategy Manager at Toolpath. New Zealand based.

Co-founder of the Grumpy Sloth full aluminium billet mechanical keyboard project

0 Likes
Message 3 of 5

scottmoyse
Mentor
Mentor

The documentation for UserInterface.selectEntity states that the return value is of Type Selection. But that it returns null if the selection was aborted... 

 

@goyals this feels like a bug to me... selectEntity is returning an exception rather than null. 


Scott Moyse
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature


RevOps Strategy Manager at Toolpath. New Zealand based.

Co-founder of the Grumpy Sloth full aluminium billet mechanical keyboard project

0 Likes
Message 4 of 5

BrianEkins
Mentor
Mentor

I know this workflow was never anticipated and as a result, it was never tested.  The selectEntity method was added to the API to use in simple scripts that weren't implementing a command.  If you have a command it was expected that you would be using selection inputs in your command dialog.  I suspect there is some kind of mix-up internally with using this in a command.  It will need some investigation to see if it's possible to fix this without a big change to the internals.  Hopefully, it's something simple and it can be fixed but it may not be simple.

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
0 Likes
Message 5 of 5

scottmoyse
Mentor
Mentor

@BrianEkins I've been wondering if it's something like that. The thing is, I can just as easily use a proper commandInput to collect the required entities. But for these simple commands using the selectEntities method is sweet because it's faster in that it requires half the number of clicks and a lot less mouse movement. 


Scott Moyse
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature


RevOps Strategy Manager at Toolpath. New Zealand based.

Co-founder of the Grumpy Sloth full aluminium billet mechanical keyboard project