Creates a new room on a level at a specified point.
Namespace: Autodesk.Revit.CreationAssembly: RevitAPI (in RevitAPI.dll) Version: 26.4.0.0 (26.4.0.0)
Syntax
C#
public Room NewRoom(
Level level,
UV point
)
Parameters
- level Level
- The level on which the room is to exist.
- point UV
- A 2D point that dictates the location of the room on that specified level.
Return Value
Room If successful the new room will be returned, otherwise
null.
Exceptions
| Exception | Condition |
|---|
| ArgumentException | Thrown if the level does not exist in the given document. |
Remarks
This method will regenerate the document even in manual regeneration mode.
Example
C#
Room CreateRoom(Autodesk.Revit.DB.Document document, Level level)
{
UV roomLocation = new UV(0, 0);
Room room = document.Create.NewRoom(level, roomLocation);
if (null == room)
{
throw new Exception("Create a new room failed.");
}
return room;
}
VB
Private Function CreateRoom(document As Autodesk.Revit.DB.Document, level As Level) As Room
Dim roomLocation As New UV(0, 0)
Dim room As Room = document.Create.NewRoom(level, roomLocation)
If room Is Nothing Then
Throw New Exception("Create a new room failed.")
End If
Return room
End Function
See Also
Reference