Document.NewRoom(Level, UV) Method

DocumentNewRoom(Level, UV) Method

Creates a new room on a level at a specified point.

Namespace: Autodesk.Revit.Creation
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public Room NewRoom(
	Level level,
	UV point
)
Public Function NewRoom ( 
	level As Level,
	point As UV
) As Room
public:
Room^ NewRoom(
	Level^ level, 
	UV^ point
)
member NewRoom : 
        level : Level * 
        point : UV -> Room 

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 .
Exceptions
ExceptionCondition
ArgumentExceptionThrown if the level does not exist in the given document.
Remarks
This method will regenerate the document even in manual regeneration mode.
Example
Room CreateRoom(Autodesk.Revit.DB.Document document, Level level)
{
    // Create a UV structure which determines the room location
   UV roomLocation = new UV(0, 0);

    // Create a new room
    Room room = document.Create.NewRoom(level, roomLocation);
    if (null == room)
    {
        throw new Exception("Create a new room failed.");
    }

    return room;
}
Private Function CreateRoom(document As Autodesk.Revit.DB.Document, level As Level) As Room
    ' Create a UV structure which determines the room location
    Dim roomLocation As New UV(0, 0)

    ' Create a new room
    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

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