Revit API-新墙类型-如何布置图层?

问题描述 投票:1回答:2

我正在通过Revit API从头开始创建新的墙类型,尽管我已经走了很远,但是我还有最后一个问题要解决。

如何按照我想要的方式布置墙的各层?墙的创建是在核心边界内使用所有图层,这显然是不理想的。我正在尝试将外部的Finish 1和Finish 2层放置到核心边界的任一侧

感谢您提供所有帮助。

我的墙是这样创建的:

enter image description here

这里是我一直在寻找的资源,但没有找到任何显示如何重新排列图层的资源。

https://thebuildingcoder.typepad.com/blog/2009/06/core-structural-layer.html

https://thebuildingcoder.typepad.com/blog/2013/08/setting-the-compound-structure-core-and-shell-layers.html

https://thebuildingcoder.typepad.com/blog/2012/03/updating-wall-compound-layer-structure.html 可能是最有用的信息,但我没有找到“ setlayerIndex”命令]

以下是我的代码:代码

using (Transaction tx = new Transaction(doc))
            {
                tx.Start("ButtonName");
                newWallType = firstWallType.Duplicate("New Wall") as WallType;
                ElementId oldLayerMaterialId = firstWallType.GetCompoundStructure().GetLayers()[0].MaterialId;
                MaterialFunctionAssignment oldLayerFunction = firstWallType.GetCompoundStructure().GetLayers()[0].Function;
                MaterialFunctionAssignment newLayerFuncion = MaterialFunctionAssignment.Finish1;
                Debug.Print("newLayerFuncion: " + newLayerFuncion)


                CompoundStructureLayer newLayer = new CompoundStructureLayer(.25, newLayerFuncion, oldLayerMaterialId);
                CompoundStructureLayer newLayer2 = new CompoundStructureLayer(.5, MaterialFunctionAssignment.Finish2, oldLayerMaterialId);

                CompoundStructure structure = newWallType.GetCompoundStructure();

                IList<CompoundStructureLayer> layers = structure.GetLayers();


                layers.Add(newLayer);
                layers.Add(newLayer2);
                structure.SetLayers(layers);

                newWallType.SetCompoundStructure(structure);

                tx.Commit();
            }

            return Result.Succeeded;
        }


c# revit-api revit revitpythonshell pyrevit
2个回答
1
投票

请阅读CompoundStructureLayerits members上的标准Revit API文档。可能不需要setlayerIndex或其他方式来实现您所需要的。


0
投票

辛苦劳作后,睡个好觉,然后重新阅读jeremey's link

我只需要在structure.SetNumberOfShellLayers(ShellLayerType.Exterior, 1);之后的正确位置添加structure.SetLayers(layers);

© www.soinside.com 2019 - 2024. All rights reserved.