首页 > 解决方案 > 为 WallType 设置新的复合结构不会更新 CompoundStructureLayers 的 LayerID

问题描述

1)我有一个WallType,需要改变WallType的复合结构。

   private void updateCompoundStructure(WallType wT)
{
  IList<Autodesk.Revit.DB.CompoundStructureLayer> csl = new     List<Autodesk.Revit.DB.CompoundStructureLayer>();

   csl.Add(new Autodesk.Revit.DB.CompoundStructureLayer()
                                {
                                    DeckEmbeddingType = deck,
                                    DeckProfileId = profileId,
                                    Function = structureFunction,
                                    LayerCapFlag = item.LayerCapFlag,
                                    MaterialId = materialId,
                                    Width = item.Thickness
                                });

CompoundStructure cs = CompoundStructure.CreateSimpleCompoundStructure(csl);
if (cs.IsValid(dbDoc, out IDictionary<int, CompoundStructureError> errMap, out IDictionary<int, int> twoLayerErrorMap))
                        {
                            wallType.SetCompoundStructure(cs);
                        }
}

墙型复合结构正确更新

但是,CompoundStructureLayer.LayerId 是只读字段,我们无法为我得到的所有 CompoundStructureLayer 的 LayerId 更新它,就像 0

2)当我阅读复合结构形式的 WallType 时,它​​在第 0 个索引处给出 LayerID 为 0,

在第一个索引为 1

在第二个索引为 2... 等等

有没有办法更新复合结构的layerID?是否有任何解决方法可以实现这一目标。

标签: c#revit-apirevit

解决方案


推荐阅读