miki969696

revit api 内置族类型 walltype

复制墙类型

Wall wall = RevitDoc.GetElement(new ElementId(185521)) as Wall;
WallType wallType = wall.WallType;
ElementType duplicatedWallType = wallType.Duplicate(wallType.Name + " (duplicated)");

复合结构的compoundlayer

 Reference refe1 = commandData.Application.ActiveUIDocument.Selection.PickObject(ObjectType.Element);


 ElementId id3 = new ElementId(339288);


 Wall wall = doc.GetElement(id3) as Wall;

 CompoundStructure cs1 = wall.WallType.GetCompoundStructure();


 IList<CompoundStructureLayer> lstLayers = cs1.GetLayers();
 //foreach (CompoundStructureLayer layer in lstLayers)
 //{
 //    string layerInfo = $"层名称: {layer.Function}, 层厚度: {layer.Width * 304.8} mm+{layer.LayerId}"; // 转换为毫米显示
 //    TaskDialog.Show("墙类型复合结构层信息", layerInfo);
 //}


 //int ii9 = cs.GetFirstCoreLayerIndex();
 //TaskDialog.Show("提示", "第一个核心层索引11:" + ii9.ToString());

 //int ii8 = cs.GetLastCoreLayerIndex();
 //TaskDialog.Show("提示", "第二个核心层索引22:" + ii8.ToString());

 
 //int ui8 = cs.GetCoreBoundaryLayerIndex(ShellLayerType.Interior);
 //TaskDialog.Show("提示", "核心内层边界索引:" + ui8.ToString());


 //int ui88 = cs.GetCoreBoundaryLayerIndex(ShellLayerType.Exterior);
 //TaskDialog.Show("提示", "核心外层边界索引:" + ui88.ToString());

 Transaction ts = new Transaction(doc, "BIM");


 ts.Start();


 CompoundStructureLayer layer = new CompoundStructureLayer(300 / 304.8, MaterialFunctionAssignment.Structure, material.Id);

 CompoundStructureLayer layer1 = new CompoundStructureLayer(200 / 304.8, MaterialFunctionAssignment.Structure, material.Id);

 CompoundStructureLayer layer2 = new CompoundStructureLayer(100 / 304.8, MaterialFunctionAssignment.Structure, material.Id);

 IList<CompoundStructureLayer> il1 = new List<CompoundStructureLayer> { layer, layer1, layer2 };

 cs.SetLayers(il1);



cs.DeleteLayer(0);
cs.SetNumberOfShellLayers(ShellLayerType.Exterior, 1);
cs.SetLayerFunction(0, MaterialFunctionAssignment.Finish1);
cs.GetLayers()[0].Width = 50 / 304.8;
               


 wall.WallType.SetCompoundStructure(cs);

 ts.Commit();

 

posted on 2025-10-31 01:27  盛书伟  阅读(0)  评论(0)    收藏  举报

导航