Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I'm trying to set the custom parameter of a material programmatically. This is my code so far:
foreach (ElementId materialId in f.GetMaterialIds(false))
{
Material material = f.Document.GetElement(materialId) as Material;
Element el = doc.GetElement(elemId);
ParameterSet parameters = el.Parameters;
foreach (Parameter param in parameters)
{
if (param.Definition.Name == "USER_DEFINED_FIELD")
{
switch (param.StorageType)
{
case Autodesk.Revit.DB.StorageType.String:
if (String.IsNullOrWhiteSpace(param.AsString()))
{
param.Set("Hello");
param.SetValueString("Hello");
}
break;
default:
break;
}
}
}
}
Furthermore, I have this code wrapped in a transaction. However, nothing is happening. Any ideas?
Any help is appreciated.
M.Fadel
Solved! Go to Solution.