我正在通过 Revit API 从头开始创建新的墙类型,并且我已经走得很远(在我看来)但是我还有最后一个问题要解决。
如何按照我想要的方式排列墙壁的层次?墙是由核心边界内的所有层创建的,这显然并不理想。我正在尝试将外部的 Finish 1 和 Finish 2 层置于核心边界的任一侧
任何和所有的帮助表示赞赏。
我的墙是这样创建的:
以下是我一直在查看的资源,但没有找到任何显示如何重新排列图层的内容。
https://thebuildingcoder.typepad.com/blog/2009/06/core-structural-layer.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;
}