Hello everyone,
I'm trying to to implement an Updater in my code since documentChanged has some limitations regarding setting parameter values (in documentChanged they are read-only).
Everything is great! And i was able to register it using OnStartup(). However, i need to get all the elements in the document.
As i understand, the updater needs a trigger to get the change type (AddTrigger(UpdaterID, Document, IColllection(ElementId), ChangeType)) this overloaded function is what interests me. But how can i get the collection from the document while inside the OnStartup() function:
This is my function:
public Result OnStartup(UIControlledApplication application)
{
FilteredElementCollector collector = new FilteredElementCollector(doc);
collector.WherePasses(new LogicalOrFilter(new ElementIsElementTypeFilter(false), new ElementIsElementTypeFilter(true)));
ICollection<ElementId> allLoads = collector.ToElementIds();
if (null == _updater)
{
_updater = new WatcherUpdater(
application.ActiveAddInId);
UpdaterRegistry.RegisterUpdater(_updater);
UpdaterRegistry.AddTrigger(
_updater.GetUpdaterId(),doc, allLoads,
Element.GetChangeTypeAny());
}
else
{
UpdaterRegistry.UnregisterUpdater(
_updater.GetUpdaterId());
_updater = null;
}
return Result.Succeeded;
}
As you can see, i scratched doc, this is what's i can't get implement. How can i get the document from UIControlledApplication?
I even tried to add the trigger (AddTrigger(UpdaterID, Document, IColllection(ElementId), ChangeType)) in my Execute function. I tried searching a lot but i can't find anything. I even tried implementing an Idling event in which i can get the collection. But still not working.
Any thoughts are appreciated.
Thanks,
M. Fadel
No experience in the Revit API. Maybe your question is better suited for the Revit API Forum.
Louis
Please mention Revit version, especially when uploading Revit files.
Can't find what you're looking for? Ask the community or share your knowledge.