Bundle Context: Selection?

Hi guys, I am doing a tools and I would like it will only work when we select at least one element.

I know about Bundle Context: Selection but the problem here is that it only works if the element I select is an element in Revit, I would like it will work with a link element too.

So do you know is there any ways to work as the same as Bundle Context: selection but include link elements too?

I’m assuming you mean an element inside of a link and not the link instance itself… I’m not aware of a way to do this using context but it might be possible. Not sure if all the available options are fully documented on notion site.

Why do you want to use active selection and not windowed selection? You can create a selection filter on a PickObjects to select only the correct category from links.

I only disable buttons when they are only relevant on floorplans or when no project is opened, and use selection filters for elements.

Hi @jpitts

I am creating a script like shortcut “bx” in Revit to create 3D view. It works for both Link Element and Revit Element, I would like my script works as the same as the way shortcut “bx” works, so I don’t would like to use method PickObjects here.

The script should be able to perform the task required, it’s just the ability to grey out and disable the button that isn’t working, correct?

I think the issue is tabbing into the link to select an element gets you a Reference to the Element in the link, not the Element itself. So not sure if context would work for this as currently configured.

You could always have the button be available but just exit if you attempt to run without a valid selection made. Or ask to make a selection with PickObjects if nothing selected.

If the length of the list of selected element ids = 0, then exit script

the script is working well now, I am just curious about whether I can disable it when there is no selection (include link and model elements)

I understand your idea but that is not the way I would like to do it, anyway thank you for your solution