- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All. I am attempting to implement an updater that works off of Views in a document. I'd like to use this to help sync a 2D view with a 3D view, within the currently active document. I have some code that does this via a button click, but I can't figure out the triggering part while rewriting to use Iupdater (to avoid the use of transactions clogging up the undo list).
I am using a win form to deal with the user input aspect:
private void liveSync_Click(object sender, EventArgs e)
{
DialogResult result = liveSync.DialogResult;
if (result == DialogResult.Yes)
//Button clicked twice, avoids it making more than one.
return;
else
try
{
//run and create updater
liveSync.DialogResult = DialogResult.Yes;
// Register view updater with Revit
UpdaterRegistry.RegisterUpdater(updater, doc);
ElementClassFilter viewFilter = new ElementClassFilter(typeof(Autodesk.Revit.DB.View));
// Add trigger, if view via filter.
UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), viewFilter, Element.GetChangeTypeAny());
Autodesk.Revit.UI.TaskDialog.Show("SDS Custom Tools - Common", "Updater is live: " + updater.GetUpdaterId());
}
catch (Exception ex)
{
Autodesk.Revit.UI.TaskDialog.Show("SDS Custom Tools - Common", "Updater Error: " + ex.Message);
}
}
This is what I have got so far for dealing with "switching it on". This returns an error:
[Window Title]
Sync 3D View to Active Plan View - SDS Custom Tools - Common
[Main Instruction]
Updater Error: The input argument "updater" of function Autodesk::Revit::Proxy::DB::UpdaterRegistryProxy::RegisterUpdater or one item in the collection is null at line 101 of file d:\ship\2020_px64\source\revit\revitdbapi\gensrc\apiupdaterregistryproxy.cpp.
Parameter name: updater
[Close]
So I thought, I will need to iterate each view and use the Collection version of the AddTrigger method, thus adding the trigger to every view, firing the updater to do the appropriate checking of views types etc.
Does anyone have some feedback on fixing this? I do fear I may not understand the addTrigger properly as well, if someone could explain this a little better that would be awesome!
George
Solved! Go to Solution.