DocumentNewRoom(Room, PlanCircuit) Method |
Creates a new room within the confines of a plan circuit, or places an unplaced room within the confines of the plan circuit.
Namespace: Autodesk.Revit.CreationAssembly: RevitAPI (in RevitAPI.dll) Version: 27.0.4.0 (27.0.4.0)
Syntaxpublic Room NewRoom(
Room room,
PlanCircuit circuit
)
Public Function NewRoom (
room As Room,
circuit As PlanCircuit
) As Room
public:
Room^ NewRoom(
Room^ room,
PlanCircuit^ circuit
)
member NewRoom :
room : Room *
circuit : PlanCircuit -> Room Parameters
- room Room
- The room which you want to locate in the circuit. Pass to create a new room.
- circuit PlanCircuit
- The circuit in which you want to locate a room.
Return Value
Room If successful the room is returned, otherwise
.
Exceptions
Remarks This method will regenerate the document even in manual regeneration mode.
ExampleRoom InsertNewRoomInPlanCircuit(Autodesk.Revit.DB.Document document, Level level, Phase newConstructionPhase)
{
Room newScheduleRoom = document.Create.NewRoom(newConstructionPhase);
string newRoomNumber = "101";
string newRoomName = "Class Room 1";
newScheduleRoom.Name = newRoomName;
newScheduleRoom.Number = newRoomNumber;
PlanCircuit planCircuit = null;
PlanTopology planTopology = document.get_PlanTopology(level);
foreach (PlanCircuit circuit in planTopology.Circuits)
{
if (null != circuit)
{
planCircuit = circuit;
break;
}
}
Room newRoom2 = null;
if (null != planCircuit)
{
using (Transaction transaction = new Transaction(document, "Create Room"))
{
if (transaction.Start() == TransactionStatus.Started)
{
newRoom2 = document.Create.NewRoom(newScheduleRoom, planCircuit);
if (null != newRoom2)
{
TaskDialog.Show("Revit", "Room placed in Plan Circuit successfully.");
}
transaction.Commit();
}
}
}
return newRoom2;
}
See Also