zoukankan      html  css  js  c++  java
  • Revit API修改保温层厚度

    start
    [Transaction(TransactionMode.Manual)]
    [Regeneration(RegenerationOption.Manual)]
    public class cmd : IExternalCommand
    {
        public Result Execute(ExternalCommandData cmdData, ref string msg, ElementSet elements)
        {
            UIDocument uiDoc = cmdData.Application.ActiveUIDocument;
            Document doc = uiDoc.Document;
            Selection selection = uiDoc.Selection;

            Transaction ts = new Transaction(doc, this.ToString());
            ts.Start();
            //
            Reference refWall = selection.PickObject(ObjectType.Element, "选择墙:");
            Wall wall = doc.GetElement(refWall) as Wall;
            WallType wallType = wall.WallType;
            CompoundStructure cs = wallType.GetCompoundStructure();
            bool bHas = false;//是否拥有保温层
            int iWidth = 100;//要设置的保温层厚度
            IList<CompoundStructureLayer> layers = cs.GetLayers();//找到所有层
            foreach (CompoundStructureLayer layer in layers)
            {
                if (layer.Function == MaterialFunctionAssignment.Insulation)//判断保温层
                {
                    bHas = true;
                    layer.Width = iWidth / 304.8;
                }
            }
            if (!bHas)//没有保温层则创建
            {
                CompoundStructureLayer newLayer = new CompoundStructureLayer();
                newLayer.Function = MaterialFunctionAssignment.Insulation;
                newLayer.Width = iWidth / 304.8;
                //layers.Add(newLayer);
                layers.Insert(0, newLayer);
            }
            cs.SetLayers(layers);
            wallType.SetCompoundStructure(cs);
            //
            ts.Commit();

            return Result.Succeeded;
        }
    }
    url:http://greatverve.cnblogs.com/p/revit-api-CompoundStructureLayer.html
  • 相关阅读:
    STM32-M0中断优先级介绍
    source insight之quicker.em宏的使用
    LORA---关于LORA的30个常见问题解答
    【原创】Mac上编译Hadoop1.0.3出现的一些问题
    Mac中下载JDK手动更新出现“只支持10.7.3以上的系统版本”问题解决方案
    【Java基础】Java内部类
    【Java基础】Java类及成员和修饰符的关系
    【Java基础】Java接口的总结
    【Java基础】抽象类和抽象方法的总结
    【Java基础】Java中的多态
  • 原文地址:https://www.cnblogs.com/greatverve/p/revit-api-CompoundStructureLayer.html
Copyright © 2011-2022 走看看