private void placeTel(ClassRoom clr) { XYZ locR = _ecd.Application.ActiveUIDocument.Selection.PickPoint("Pick a point to place Lamp"); //RevitRoom rr = _doc.GetElement(clr.Identity) as RevitRoom; //XYZ p = ((LocationPoint)rr.Location).Point; //RevitRoom roomAtPoint = _doc.GetRoomAtPoint(p); //if (roomAtPoint.UniqueId != rr.UniqueId) //{ //TaskDialog.Show("ERROR", "Punkt liegt nicht in ausgewählten Raum."); //return; //} if (null != locR) { using (Transaction trans = new Transaction(_doc)) { if (trans.Start("PlaceFamily") == TransactionStatus.Started) { FamilyInstance fi = _doc.Create.NewFamilyInstance(locR, GetFamilySymbolByName(BuiltInCategory.OST_SpecialityEquipment, "Telefon") , StructuralType.NonStructural); trans.Commit(); } } } }
//Ist anders als in den vorherigen Versionen!! private static void update(ClassRoom _clr) { if (_clr != null) { try { bool worked; if (_clr.Id != null) { RevitRoom room = (RevitRoom)_doc.GetElement(_clr.Id); using (Transaction trans = new Transaction(_doc)) { if (trans.Start("Change Room Parameters") == TransactionStatus.Started) { room.Name = _clr.Bez; worked = room.GetParameters(typeofuse).First().Set(idenfifyTyp(_clr)); trans.Commit(); } } } } catch (Exception e) { TaskDialog.Show("RoomInfoUpdater", e.Message); } } else { TaskDialog.Show("RoomInfoUpdater", "Please select a Room!"); } }
//Hier könnte noch Encode Mobiliar stehen! private static string idenfifyTyp(ClassRoom r) { return("2-Büroarbeit"); //if (r is Office) // return "2-Büroarbeit"; //else if (r is Livingroom) // return "1 - Wohnen und Aufenthalt"; //else return "please extend the classdiagram"; }