Revit开发访问墙体结构层信息

来源:互联网 发布:windows是由什么公司 编辑:程序博客网 时间:2024/04/29 08:56


注意:结构层的信息一定要设置,如果显示为按类别,其实是没有设置材质的,就不会返回

        private void ReadWallLayer()
        {
            string info = null;
            Reference wallRef = uidoc.Selection.PickObject(ObjectType.Element);
            Wall wall = doc.GetElement(wallRef) as Wall;
            if(wall!=null)
            {
                CompoundStructure cs = wall.WallType.GetCompoundStructure();
                IList<CompoundStructureLayer> csls = cs.GetLayers();
                foreach(CompoundStructureLayer csl in csls)
                {
                    if (csl.MaterialId != ElementId.InvalidElementId)
                    {
                        Material m = doc.GetElement(csl.MaterialId) as Material;
                        if (m != null)
                        {
                            info += m.Name + "\n";
                        }
                    }
                }
            }
            MessageBox.Show(info);
        }



博主会经常更新一些技术文章,请大家多多关注,多多交流

更多技术交流,请加qq群480950299




1 0