This should get you going:
public void CreateRoomAndSeperators()
{
Document doc = this.ActiveUIDocument.Document;
View activeView = doc.ActiveView; //You should make sure you're in a Plan View
XYZ pt1 = new XYZ(0, 0, 0);
XYZ pt2 = new XYZ(0, 10, 0);
XYZ pt3 = new XYZ(10, 10, 0);
XYZ pt4 = new XYZ(10, 0, 0);
UV pt5 = new UV(5, 5);
CurveArray curveArray = new CurveArray();
curveArray.Append(Line.CreateBound(pt1, pt2));
curveArray.Append(Line.CreateBound(pt2, pt3));
curveArray.Append(Line.CreateBound(pt3, pt4));
curveArray.Append(Line.CreateBound(pt4, pt1));
using (Transaction trans = new Transaction(doc))
{
trans.Start("Create Room and Boundaries");
ModelCurveArray lines = doc.Create.NewRoomBoundaryLines(activeView.SketchPlane, curveArray, activeView);
Room room = doc.Create.NewRoom(activeView.GenLevel, pt5);
//now modify the "room" Element's Name, Number, etc.
trans.Commit();
}
}
Anthony Tiefenbach
BIM Manager
HuntonBrady Architects