Message 1 of 4
Register Updater Multiple Documents
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Folks,
I'm really stuck here and can't figure out what I'm doing wrong. I've just figured out the source code I was using (Dynamic Model Update in the SDK) to update my application does not work as I expected it to.
Essentially, I need my application to register in more than one active document at a time. But it seems that even though I include the overload of document at the updaterRegistry, it throws an error saying the application has already been registered in the application.
So am I missing something that will make register to the document level and not the application level?
Thanks in advanced to all.
[Transaction(TransactionMode.Manual)]
//[Regeneration(RegenerationOption.Manual)]
public class AussparungUpdaterApplication : IExternalCommand
{
public Result Execute(ExternalCommandData commandData,
ref string message,
ElementSet elements)
{
UIApplication uiApp = commandData.Application;
Document doc = uiApp.ActiveUIDocument.Document;
//get "ElementZuordnung" parameter(Guid from shared parameters file)
Guid elemZuordId = new Guid("guid here");
//Rule out older or external projects that don't contain identifying parameter for trigger
//Collect generic model types
FilteredElementCollector genModelCollector = new FilteredElementCollector(doc).WhereElementIsElementType().OfCategory(BuiltInCategory.OST_GenericModel);
if (null != genModelCollector)
{
//Check to see if there are any generic model elements in current model
Element eCheck = genModelCollector.ToElements().First() as Element;
if (null != eCheck)
{
if (null != eCheck.get_Parameter(elemZuordId))
{
AussparungUpdater updater = new AussparungUpdater(uiApp.ActiveAddInId, doc);
UpdaterRegistry.RegisterUpdater(updater);
//code here
}
}
}
return Result.Succeeded;
}
}