Autodesk.Revit.DB.Structure.StructuralSectionsServiceData 是 Revit 结构模型中的结构截面服务数据类,用于存储和管理结构截面数据。
// 获取所有结构截面
StructuralSectionsServiceData sectionData = doc.GetElement(e.GetTypeId()) as StructuralSectionsServiceData;
if (sectionData == null) return;
List<SectArchetype> archetypes = sectionData.Archetypes;
// 创建新的结构截面
Transaction trans = new Transaction(doc);
trans.Start("Create New Section");
SectArchetype archetype = archetypes.FirstOrDefault(x => x.Name == "W Shapes");
StructuralSectionGeometry geometry = SectionProfileGenerator.CreateHollowProfile(3.0, 3.0, 0.25, 0.1, 0.1, 0.13, 0.02, 0.02, 0.02, 0.02);
StructuralSection section = StructuralSection.Create(doc, sectionData.MaterialLibraryId, "My W Shape", geometry, archetype.Id);
trans.Commit();