/// <summary> /// get all the wall types for curtain wall and all the view plans from the active document /// </summary> private void InitializeData() { // get all the wall types WallTypeSet wallTypes = m_document.WallTypes; foreach (WallType type in wallTypes) { // just get all the curtain wall type if (WallKind.Curtain == type.Kind) { m_wallTypes.Add(type); } } // sort them alphabetically WallTypeComparer wallComp = new WallTypeComparer(); m_wallTypes.Sort(wallComp); // get all the ViewPlans m_views = SkipTemplateViews(GetElements <Autodesk.Revit.DB.View>()); // sort them alphabetically ViewComparer viewComp = new ViewComparer(); m_views.Sort(viewComp); // get one of the mullion types MullionTypeSet mullTypes = m_document.MullionTypes; foreach (MullionType type in mullTypes) { if (null != type) { BuiltInParameter bip = BuiltInParameter.ALL_MODEL_FAMILY_NAME; Parameter para = type.get_Parameter(bip); if (null != para) { string name = para.AsString().ToLower(); if (name.StartsWith("circular mullion")) { m_gridGeometry.MullionType = type; } } } } }
/// <summary> /// Get the levels and wall types from revit and insert into the lists /// </summary> private void InitializeListData() { // Assert the lists have been constructed if (null == m_wallTypeList || null == m_levelList) { throw new Exception("necessary data members don't initialize."); } // Get all wall types from revit Document document = m_commandData.Application.ActiveUIDocument.Document; WallTypeSet typeSet = document.WallTypes; foreach (WallType type in typeSet) { m_wallTypeList.Add(type); } // Sort the wall type list by the name property WallTypeComparer comparer = new WallTypeComparer(); m_wallTypeList.Sort(comparer); // Get all levels from revit FilteredElementIterator iter = (new FilteredElementCollector(document)).OfClass(typeof(Level)).GetElementIterator(); iter.Reset(); while (iter.MoveNext()) { Level level = iter.Current as Level; if (null == level) { continue; } m_levelList.Add(level); } }