Material.Create
Description:
Creates a new material.
Creates a new material.
-
documentThe document in which to create the material.
-
nameThe name of the new material.
//Create the material
ElementId materialId = Material.Create(document, "My Material");
Material material = document.GetElement(materialId) as Material;
//Create a new property set that can be used by this material
StructuralAsset strucAsset = new StructuralAsset("My Property Set", StructuralAssetClass.Concrete);
strucAsset.Behavior = StructuralBehavior.Isotropic;
strucAsset.Density = 232.0;
//Assign the property set to the material.
PropertySetElement pse = PropertySetElement.Create(document, strucAsset);
material.SetMaterialAspectByPropertySet(MaterialAspect.Structural, pse.Id);
-
name cannot include prohibited characters. -or- The given value for name is already in use as a material element name.
-
A non-optional argument was NULL