- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a few little sheet maintenance and setup tools in an add in, and I'm trying to streamline them a bit by letting the user select a sheet and then run the addin so that the selected sheet becomes the default sheet for the add in logic. But the UI seems to not want to let me do this. I select a sheet in the Project Browser, and then go to the ribbon which will not respond (this is a general problem, not specific to the addin). So instead I open the sheet, and verify that the properties window shows the sheet (I believe this means that the sheet is selected, but perhaps this is my error?). I then run the addin, which has in the IExternalCommand Execute function:
UIApplication uiapp = commandData.Application; UIDocument uidoc = uiapp.ActiveUIDocument; Application app = uiapp.Application; Document doc = uidoc.Document; Selection selection = uidoc.Selection; ICollection<ElementId> sIds = selection.GetElementIds();
But sIds is empty. I'm not sure exactly what the problem is but could it be related to the fact that I can't run the addin directly after selecting a sheet in the ProjectBrowser (and seeing it highlighted) due the unresponsive ribbon. Or is it that a ViewSheet cannot be part of the selection set accessed by the API?
Even more ideally from a work flow standpoint would be the ability to right-click a sheet in the project browser and have a hook to the addin Execute Method in the context menu, but I have not seen (or if I have understood) how that might be accomplished.
Solved! Go to Solution.