Hi @konrad.pEGTVF
To Duplicate any Element, you have to follow the below steps,
1. Get the Element you want to duplicate.
2. Duplicate with New Name.
3. Get the Parameter ex. Wall Height or Width.
4. Change the parameter in the duplicated type.
Reference Code:
//Filter Wall Type
WallType wallType = new FilteredElementCollector(doc)
.OfClass(typeof(WallType))
.Where(x => x.Name.Equals("Wall-Fnd_440Blk"))
.First() as WallType;
//Variable
WallType newWallType = null;
//Duplicate Wall Type
using (Transaction createWallType = new Transaction(doc, "Create new Wall Type"))
{
createWallType.Start();
//Duplicate Wall Type
newWallType = wallType.Duplicate("New Automation Wall Type") as WallType;
createWallType.Commit();
}
//Change Wall Width
CompoundStructure structure = newWallType.GetCompoundStructure();
using (Transaction changeWidth=new Transaction(doc,"Change Width"))
{
changeWidth.Start();
structure.SetLayerWidth(0, 500 / 304.8);
//Set Edited Structure to Wall Type.
newWallType.SetCompoundStructure(structure);
changeWidth.Commit();
}
Hope this will Helps 🙂
Mohamed Arshad K
Software Developer (CAD & BIM)