Start
[Transaction (TransactionMode. Manual)]
[Regeneration (RegenerationOption. Manual)]
Cmd: IExternalCommand
{
Result Execute (ExternalCommandData upload data, msg, ElementSet elements)
{
UIDocument uiDoc = upload data. Application. ActiveUIDocument;
Document doc = uiDoc. Document;
Transaction ts = Transaction (uiDoc. Document ,);
Ts. Start ();
Wall wall = uiDoc. Document. GetElement (uiDoc. Selection. PickObject (ObjectType. Element,) Wall;
Materials materials = doc. Settings. Materials;
ElementId materialId = materials. get_Item (). Id;
CompoundStructure cs = wall. WallType. GetCompoundStructure ();
CompoundStructureLayer layer = CompoundStructureLayer (/, MaterialFunctionAssignment. Insulation, materialId );
Cs. SetLayer (cs. GetFirstCoreLayerIndex (), layer );
IList <CompoundStructureLayer> listLayer = cs. GetLayers ();
IIdx =;
(CompoundStructureLayer cLayer listLayer)
{
(MaterialFunctionAssignment. Structure = cLayer. Function)
{
;
}
IIdx + =;
}
Cs. SetLayerWidth (iIdx ,/);
Wall. WallType. SetCompoundStructure (cs );
Ts. Commit ();
Result. Succeeded;
}
} Url: http://greatverve.cnblogs.com/p/revit-api-CompoundStructure.html