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: 

API for selection filter list?

10 REPLIES 10
Reply
Message 1 of 11
jade.fink
1076 Views, 10 Replies

API for selection filter list?

I'm currently thinking about writing another UI fix add-in to make selection filtering better. The selection priority dialog is awesome, but it doesn't seem to allow resetting the filter to Select All, which you need to do with three quite-precise clicks and which cannot be assigned to a keyboard shortcut. Another use case for this is adding custom selection filter presets such as Profiles to make creating extrusions easier in crowded models.

 

So I was thinking about making such a keyboard shortcut, but I can't seem to find any sort of API to manipulate the user's selection filters. The UserInterface.activeSelections gets all the selections, but it does not appear to expose any sort of functionality to access the selection filters (the ones in Select>Selection Filters).

Tags (1)
10 REPLIES 10
Message 2 of 11
MichaelT_123
in reply to: jade.fink

SelectionCommandInput Object

MichaelT
Message 3 of 11
jade.fink
in reply to: MichaelT_123

It was unclear to me whether this is the same as the selection outside of a command or whether it's only usable in the context of a command and not when just panning around.

 

Can you clarify whether that is the case? If it works globally, I think the documentation needs its first sentence clarified. 

Message 4 of 11
MichaelT_123
in reply to: jade.fink

 

 

Take it slowly ... you seem to still be in the process of learning  UI and API. Just read docs. If the brightness strikes darkness disappears.

 

With Wishes of Success

MichaelT

  

MichaelT
Message 5 of 11
jade.fink
in reply to: MichaelT_123

Now that I've got some time to look at the documentation and understand the API further, my initial suspicion was correct. The SelectionCommandInput does not fix the problem because I want to *globally* set the selection filters on behalf of the user, same as doing it in the menu which there still doesn't seem to be any API for. The SelectionCommandInput API lets the user select something as input for a command, but that's not what I want: I want to change the filters on behalf of the user while not in a command context.

 

By the way, your last message came across as highly condescending.

Message 6 of 11
jkelindberg
in reply to: jade.fink

Hi Lucas,

 

Did you ever get any clarity in your question?

I want to do something similar to what you are describing.

Specifically correct the fantastically ridiculous selection order when entering a sketch. Imagine you have a sketch on a plane going through a solid, Fusion 360 would much, much rather select features on the solid instead of what the user is actually working on; sketch lines, dimensions and geometrical conditions... In order to at all be able to edit the sketch the user would need to do one of three things; adjust the selection filter, activate slicing plane or hide the obstructing bodies. So I would like to make an add-on to automatically change the selection filter and then when the user exits the sketch switch it back.. Because the way it works out-of-the-box is absolutely doing my head in.

 

--johan.

Message 7 of 11
jade.fink
in reply to: jkelindberg

Nope! And I've switched to SolidWorks because my modeling use cases have substantially changed anyway due to school. I still do, however, as suggested on another thread about the limitations of the extensions API, think it would continue to be very funny to write an extension that basically uses game hacking and malware techniques to find and call into the completely undocumented internal APIs for these features (such APIs don't even have debugging symbols so it's extra funny!).

 

Jade

*sigh* I wish I could get references to my previous name erased

Message 8 of 11
KrisKaplan
in reply to: jkelindberg

There isn't currently an explicit API to set the active selection filters. But you can drive the controls for this command to achieve the same.

 

app = adsk.core.Application.get()
ui = app.userInterface
cmd = ui.commandDefinitions.itemById('SelectionFilterCommand')
cmd.controlDefinition.listItems[2].isSelected = True

 

In this example, the CommandDefinition for the selection filters command is accessed by it's Id, and get the third ListItem in it's ListControlDefinition and toggle it's selected state. The third list item in this case is the 'Select All' item.

 

Kris

 



Kris Kaplan
Message 9 of 11
jkelindberg
in reply to: KrisKaplan

Hey thanks @KrisKaplan that'll work! At least until Autodesk decides to change the order in the menu.

 

Would you also happen to have some suggestions on how to tap into the event when the user enters and leaves the sketch environment? I tried to install a command create/execute event handler on

ui.commandDefinitions.itemById('SketchActivate')
# and
ui.commandDefinitions.itemById('SketchStop')

but I'm not getting it to work..

 

--johan.

 

Message 10 of 11
KrisKaplan
in reply to: jkelindberg

Johan,

 

I think I would try listening to the commandTerminated event, and check if the activeProduct is still a Design, and the activeEditObject has gone from a Sketch to not a Sketch.

 

Kris



Kris Kaplan
Message 11 of 11

@KrisKaplan PLEASE make this a separate button so we can assign a shortcut to it and make it happen in a single button press instead of the 3 current clicks needed. I am constantly in need of the Select All option so I can select Joints, Planes, sketch objects, sketch dimensions etc by directly clicking on them instead of via filters, other features or via the Browser. This would be a lifesaver!

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