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
  • 相关阅读:
    UML_状态图
    UML_时序图
    UML_类图
    浅谈依赖注入
    MyEclipse_搭建SSH框架
    AOP:面向切面编程
    工厂模式
    (转)oracle使用expdp、impdp和exp、imp导入导出表及表结构
    oracle exp 和 imp 数据和表结构互相独立导出导入
    oracle 清空当前用户所有对象
  • 原文地址:https://www.cnblogs.com/greatverve/p/revit-api-CompoundStructure.html
Copyright © 2011-2022 走看看