Message 1 of 17
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
I'm still not quite sure if i get this right. Using a Dynamic Model Update, the GetAddedElementIds() function retrieves added parameters, or added elements?
I mean, when i'm using GetAddedElementIds(), i'm waiting for a parameter to be added to the element, or i'm waiting for the user to draw a new element?
I'm trying to set a parameter's value for newly drawn elements.
This is my code:
foreach (ElementId id in data.GetAddedElementIds())//.GetModifiedElementIds()) { Element elem = doc.GetElement(id);
ParameterSet parameters = elem.Parameters;
foreach (Parameter param in parameters)
{
if (param.Definition.Name == "TEST")
{
switch (param.StorageType)
{
case Autodesk.Revit.DB.StorageType.String:
if (!String.IsNullOrWhiteSpace(param.AsString()))
{
param.SetValueString(elem.UniqueId.ToString());
param.Set(elem.UniqueId.ToString());
}
break;
}
}
} }
Note: I'm able to set the value if i use GetModifiedElementIds() and just try to modify an exiting element's parameter.
Any help is appreciated.
M.Fadel
Solved! Go to Solution.