DocumentNewRoomTag Method |
Creates a new RoomTag referencing a room in the host model or in a Revit link.
Namespace: Autodesk.Revit.CreationAssembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntaxpublic RoomTag NewRoomTag(
LinkElementId roomId,
UV point,
ElementId viewId
)
Public Function NewRoomTag (
roomId As LinkElementId,
point As UV,
viewId As ElementId
) As RoomTag
public:
RoomTag^ NewRoomTag(
LinkElementId^ roomId,
UV^ point,
ElementId^ viewId
)
member NewRoomTag :
roomId : LinkElementId *
point : UV *
viewId : ElementId -> RoomTag
Parameters
- roomId LinkElementId
- The HostOrLinkElementId of the Room.
- point UV
- A 2D point that defines the tag location on the level of the room.
- viewId ElementId
- The id of the view where the tag will be shown. If and the room in not in a Revit link, the view of the room will be used.
Return Value
RoomTag If successful a RoomTag object will be returned, otherwise
.
Exceptions
ExampleRoomTag CreateRoomTag(Autodesk.Revit.DB.Document document, Room room)
{
UV roomTagLocation = new UV(0, 0);
LinkElementId roomId = new LinkElementId(room.Id);
RoomTag roomTag = document.Create.NewRoomTag(roomId, roomTagLocation, ElementId.InvalidElementId);
if (null == roomTag)
{
throw new Exception("Create a new room tag failed.");
}
TaskDialog.Show("Revit","Room tag created successfully.");
return roomTag;
}
Private Function CreateRoomTag(document As Autodesk.Revit.DB.Document, room As Room) As RoomTag
Dim roomTagLocation As New UV(0, 0)
Dim roomId As New LinkElementId(room.Id)
Dim roomTag As RoomTag = document.Create.NewRoomTag(roomId, roomTagLocation, ElementId.InvalidElementId)
If roomTag Is Nothing Then
Throw New Exception("Create a new room tag failed.")
End If
TaskDialog.Show("Revit", "Room tag created successfully.")
Return roomTag
End Function
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also