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;

            Transaction ts = new Transaction(uiDoc.Document, "http://revit.5d6d.com");
            ts.Start();

            Wall wall = uiDoc.Document.GetElement(uiDoc.Selection.PickObject(ObjectType.Element, "wall")) as Wall;
            //取得一种材质
            Materials materials = doc.Settings.Materials;
            ElementId materialId = materials.get_Item("隔热层/保温层 - 空心填充").Id;
            //得到墙结果
            CompoundStructure cs = wall.WallType.GetCompoundStructure();
            //ElementId matId = Material.Create(doc, "MyMaterial");//创建材质
            
    //创建保温层(厚度,功能,材质)
            CompoundStructureLayer layer = new CompoundStructureLayer(100 / 304.8, MaterialFunctionAssignment.Insulation, materialId);
            cs.SetLayer(cs.GetFirstCoreLayerIndex(), layer);
            //修改墙体厚度
            IList<CompoundStructureLayer> listLayer = cs.GetLayers();
            int iIdx = 0;
            foreach (CompoundStructureLayer cLayer in listLayer)
            {
                if (MaterialFunctionAssignment.Structure == cLayer.Function)
                {
                    break;
                }
                iIdx += 1;
            }
            cs.SetLayerWidth(iIdx, 400 / 304.8);
            //调用更新
            wall.WallType.SetCompoundStructure(cs);

            ts.Commit();

            return Result.Succeeded;
        }
    }
    url:http://greatverve.cnblogs.com/p/revit-api-CompoundStructure.html
  • 相关阅读:
    lhgdialogv3.13 使用点滴
    CheckBoxList 取值 及选中相关用法
    repeater 及 gridview 中绑定短日期
    数据库中日期大小的判断
    父子不同窗口间刷新传值
    子级Repeater获取父级Repeater绑定项的值
    vs.net 2010 web 项目中使用 webservice
    web打印实现方案 Lodop6.034 使用方法总结
    用 showModalDialog 方法回传数据到父页中去
    vs.net2010中使用 Ajax Control Toolkit
  • 原文地址:https://www.cnblogs.com/greatverve/p/revit-api-CompoundStructure.html
Copyright © 2011-2022 走看看