Adding RoomTag to Selected Viewports

Adding RoomTag to Selected Viewports

invisibleotis
Community Visitor Community Visitor
426 Views
2 Replies
Message 1 of 3

Adding RoomTag to Selected Viewports

invisibleotis
Community Visitor
Community Visitor

My girlfriend (architect) asked me (software developer) to write a small add-in for her.  This is her goal:

 

I have a sheet with multiple interior elevations.  Presently, I have to activate each elevation in order to place a room tag.  I would like to be able to highlight/select multiple elevations and tag them without activating each view.

 

I was able to find some easily understable code segments to do the following:

- Get all of the rooms in a document, and tag them

- Get a list of selected elements

 

When I did get a list of selected elements using the UIDocument's Selection property, it returned all Viewport objects.  For instance, if I selected 3 of the interior elevations, I would get a list of 3 Viewports.  

 

I couldn't seem to find a way to list the rooms specific to those viewports selected, in order to be able to tag them.  

0 Likes
427 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable

You must realy love your girlfriend in order to program an add-in for her in Revit 🙂 🙂 🙂

 

Take a look at this post : http://forums.autodesk.com/t5/revit-api/retrieving-views-associated-with-an-element-id/m-p/5846070#M...

 

As you can read you can never be sure the selected rooms are actually visible in certain elevations. Further more, you have to do something with the room visiblitiy settings aswell, because by default room tags aren't shown in elevations and sections.

 

Hope this helps,

0 Likes
Message 3 of 3

invisibleotis
Community Visitor
Community Visitor

Haha yeah, we'll consider it earning some bonus points.  Thanks so much for your reply!

 

So I understand the concept of what you are saying, and see how that can be a problem.  Do you think there is a solution to be had by activating each selected view programmatically, tagging the rooms while activated, and then deactivate?  Or do I run into the same theorical problems?  It would take a little longer presumably but at least could be done in a bulk action instead of multiple click-and-wait's that she has to perform currently.

 

Again, I appreciate the help coming up to speed on this.

0 Likes