
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey All,
My goal: Update a families parameter values from the api when shape handles are pulled.
What works: Iupdater class that fires off my custom code when a user manipulates the shape handles on a family
What Doesnt work: updating the parameters of the family.
I have an IUpdater class that is fired only when family instances are changed. See snippet:
UpdaterRegistry.RegisterUpdater(MyFamilyInstance_updaterClass);
ElementClassFilter familyInstancesFilter = new ElementClassFilter(typeof(FamilyInstance));
UpdaterRegistry.AddTrigger(avt_FamilyInstance_updater.GetUpdaterId(), familyInstancesFilter, Element.GetChangeTypeGeometry());
Here is what I have tried and am experiencing a problem with: (this is located in the execute method of the updater class)
ICollection<ElementId> modifiedCollection = data.GetModifiedElementIds();
foreach (ElementId elemId in modifiedCollection) { Element elem = doc.GetElement(elemId); FamilyInstance fi = elem as FamilyInstance; if (fi != null) { FamilySymbol fsb = doc.GetElement(fi.GetTypeId()) as FamilySymbol; if (fsb != null) {
Parameter param = fi.GetParameters("calculated_Depth_of_Box").FirstOrDefault(); param.SetValueString("4");
} }
}
My problem is that it doesnt seem to update the parameter, and it loops infinitely (until revit crashes it) My guess is the reasoning is because im not filtering the modified collection enough. My end goal here is to get the family thats shape handle has been pulled, loop through each of its parameters (or find them, as I have the names stored in a list), and then set a value. (in this example just setting "4" but I have more advanced match being applied that is currently disabled while I figure this out)
Where am I going wrong in my approach here?
Thanks in advance for any help you all can give!
Solved! Go to Solution.