public void Main_CreateWallByRoom(Document revitDoc, UIDocument uidoc, UIApplication uiapp, Application app) { /// 取得所有Room List <Element> ROOMs = RevFind.GetDocRooms(revitDoc); /// 取得所有樓層 List <Level> levels = RevFind.GetLevels(revitDoc); /// 取得所有牆的種類 List <Element> WallTypes = RevFind.GetDocWallTypes(revitDoc); Form_CreateFloorByRoomEdges Form = new Form_CreateFloorByRoomEdges(levels, WallTypes); Form.ShowDialog(); if (Form.DialogResult == System.Windows.Forms.DialogResult.OK) { Reference r = uidoc.Selection.PickObject(ObjectType.Element, "Select a wall"); Element e = uidoc.Document.GetElement(r); Room room = e as Room; List <Room> ROOM = new List <Room>() { room }; //Level level = levels[Form.cmbBaseLevels.SelectedIndex]; WallType WallType = WallTypes[Form.cmbFloorTypes.SelectedIndex] as WallType; Dictionary <string, List <List <LINE> > > Dict_ROOMs = new Dictionary <string, List <List <LINE> > >(); Dictionary <string, List <List <Wall> > > Dict_Walls = new Dictionary <string, List <List <Wall> > >(); RoomAndWallEdgeProcessing(uiapp, app, revitDoc, ROOM, ref Dict_ROOMs, ref Dict_Walls); List <List <List <Curve> > > WallCollection = new List <List <List <Curve> > >(); List <List <Wall> > ClosedWallCollection = new List <List <Wall> >(); foreach (KeyValuePair <string, List <List <Wall> > > item in Dict_Walls) { foreach (List <Wall> WallList in item.Value) { ClosedWallCollection.Add(WallList); //foreach (Wall wall in WallList) //{ // List<List<Curve>> WallEdge = GetWallInformation(uidoc, revitDoc, app, wall, WallType); // WallCollection.Add(WallEdge); //} } } CreateWall(uidoc, revitDoc, app, ClosedWallCollection, WallType); } }
//////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////// Floor_Part //////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// 由房間區域建立樓板 /// </summary> /// <param name="revitDoc"></param> /// <param name="uidoc"></param> /// <param name="uiapp"></param> /// <param name="app"></param> public void Main_CreateByRoom(Document revitDoc, UIDocument uidoc, UIApplication uiapp, Application app) { /// 取得所有Room List <Element> ROOMs = RevFind.GetDocRooms(revitDoc); /// 取得所有樓層 List <Level> levels = RevFind.GetLevels(revitDoc); /// 取得所有板的種類 List <Element> floorTypes = RevFind.GetDocFloorTypes(revitDoc); Form_CreateFloorByRoomEdges Form = new Form_CreateFloorByRoomEdges(levels, floorTypes); Form.ShowDialog(); if (Form.DialogResult == System.Windows.Forms.DialogResult.OK) { double SHIFT = Convert.ToDouble(Form.txtShift.Text) / 304.8; bool IsStructural = Form.chIsStructural.Checked ? true : false; Level level = levels[Form.cmbBaseLevels.SelectedIndex]; FloorType floorType = floorTypes[Form.cmbFloorTypes.SelectedIndex] as FloorType; Dictionary <string, List <List <LINE> > > Region = RoomEdgeProcessing(revitDoc, ROOMs, level); CreateFloor_ByRoom(revitDoc, level, Region, floorType, SHIFT, IsStructural); } }