1

我正在通过 Revit API 从头开始​​创建新的墙类型,并且我已经走得很远(在我看来)但是我还有最后一个问题要解决。

如何按照我想要的方式排列墙壁的层次?墙是由核心边界内的所有层创建的,这显然并不理想。我正在尝试将外部的 Finish 1 和 Finish 2 层置于核心边界的任一侧

任何和所有的帮助表示赞赏。

我的墙是这样创建的:

在此处输入图像描述

以下是我一直在查看的资源,但没有找到任何显示如何重新排列图层的内容。

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;
        }


4

2 回答 2

2

经过一番辛劳,好好休息一晚,重读jeremey的链接

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

于 2020-04-16T23:13:59.330 回答
1

请阅读有关CompoundStructureLayer及其成员的标准 Revit API 文档。可能不需要setlayerIndex或替代方法来实现您的需求。

于 2020-04-16T06:29:10.923 回答