Revit API - 新墙类型 - 如何排列图层?
Revit API - New Wall Type - How to arrange layers?
我正致力于通过 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;
}
请阅读 CompoundStructureLayer and its members 上的标准 Revit API 文档。可能不需要 setlayerIndex
或其他方法来实现您的需要。
辛苦了,好好睡一觉,重读jeremey's link
我只需要在 structure.SetLayers(layers);
之后的正确位置添加 structure.SetNumberOfShellLayers(ShellLayerType.Exterior, 1);
我正致力于通过 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;
}
请阅读 CompoundStructureLayer and its members 上的标准 Revit API 文档。可能不需要 setlayerIndex
或其他方法来实现您的需要。
辛苦了,好好睡一觉,重读jeremey's link
我只需要在 structure.SetLayers(layers);
structure.SetNumberOfShellLayers(ShellLayerType.Exterior, 1);