Example #1
0
        public static List <Layer> GetLayers(Revit.Elements.WallType wallType)
        {
            Document document = DocumentManager.Instance.CurrentDBDocument;

            var wt = wallType.InternalElement as Autodesk.Revit.DB.WallType;
            CompoundStructure structure = wt.GetCompoundStructure();
            int layerCount     = structure.LayerCount;
            int strMaterialInd = structure.StructuralMaterialIndex;

            List <Layer> layers = new List <Layer>();

            for (int i = 0; i < layerCount; i++)
            {
                layers.Add(new Layer(structure.GetLayerFunction(i).ToString(),
                                     document.GetElement(structure.GetMaterialId(i)) as Autodesk.Revit.DB.Material,
                                     UnitUtils.ConvertFromInternalUnits(structure.GetLayerWidth(i), DisplayUnitType.DUT_MILLIMETERS),
                                     i == strMaterialInd,
                                     structure.IsCoreLayer(i)));
            }

            return(layers);
        }