I'm trying to tag all linked model rooms in the current view. Its weird, it looks line the room tags are there, I've added a selection, and it adds room tags to the selection, however none of them are visible.
Any help really apprectiated.
Public Class TagAllLinkedRoomElementsCmd
Public Function Execute(ByVal commandData As Autodesk.Revit.UI.ExternalCommandData, _
ByRef message As String, ByVal elements As Autodesk.Revit.DB.ElementSet) _
As Autodesk.Revit.UI.Result Implements Autodesk.Revit.UI.IExternalCommand.Execute
Dim activeDBdoc As Document = commandData.Application.ActiveUIDocument.Document
Dim selSelectionElements As Autodesk.Revit.UI.Selection.SelElementSet = commandData.Application.ActiveUIDocument.Selection
Dim objTransation As Transaction = clsRockitTransation.CreateNewTransation("Tag All Linked Room Elements", activeDBdoc)
If objTransation IsNot Nothing Then
Dim RoomTagTypeList As List(Of RoomTagType) = clsRockitElements.GetRoomTagTypes(activeDBdoc)
If RoomTagTypeList.Count > 0 Then
Dim objRoomTagType As RoomTagType = RoomTagTypeList.Item(1)
For Each doc As Document In commandData.Application.Application.Documents
Dim eleDocSpatialElements As List(Of Element) = clsRockitElements.Rockit_GetAllSpatialElements(doc
For Each objElement As Element In eleDocSpatialElements
Dim objRoom As Room = TryCast(objElement, Room)
If objRoom IsNot Nothing Then
Dim locationPoint As LocationPoint = TryCast(objRoom.Location, LocationPoint)
Dim point As New Autodesk.Revit.DB.UV(locationPoint.Point.X, locationPoint.Point.Y)
Dim newTag As RoomTag = activeDBdoc.Create.NewRoomTag(objRoom, point, activeDBdoc.ActiveView)
newTag.RoomTagType = objRoomTagType
'MsgBox(objRoom.Name & " has been tagged...")
Catch ex As Exception
'MsgBox(ex.Message & objRoom.Name)
If you create the tags through the user interface then they are visible, right?
Maybe you could create one and compare it to the ones you created programmatically using the "Revit Lookup" tool that is part of the Revit SDK. That might give you an idea what is wrong with the ones you created programmatically.
I hope this helps.
Autodesk Developer Network
Thank you for the tip, I used the snoopdb tool, but on comparison between the two tags I could not see any difference. I tried to reconsile hosting but they are all OK.
I tried to copy the missing tag to the clipboard. I was thinking if I could copy & paste it, but I recive the following error message. I think it is a bug.
|Selection cannot be copied. Can't Copy to Clipboard because of relationships between Elements||Room Tags : M-RoomTag : Room Tag With Area : id 1497917|
Even if there is a method that I can copy all the rooms from a linked model into the current model I could then tag the rooms.I know I can create spaces but they do not always get created successfully.