How to Unregister Updater?

felix.hopmann
Explorer Explorer
1,159 Views
6 Replies
Message 1 of 7

How to Unregister Updater?

felix.hopmann
Explorer
Explorer

I am writing an AddIn which adds a custom View and uses Document-bound Updaters to manage some information in it. These updaters are non-optional as long as there are custom views in the document, however, they aren't needed as soon as all AddIn-created views are deleted.

 

To achieve this, I tried:

 

I only register the updater upon creation of custom views or when I find some upon loading. (This works)

 

Upon saving, I test for AddIn-created views, if there aren't any left, I do

Autodesk.Revit.DB.UpdaterRegistry.UnregisterUpdater(id, doc);

which appears to succeed, as the Updater isn't called anymore and repeating calls to this fail with the message that the updater doesn't exist anymore.

However, if I try to load that document, I get the warning that the Updaters are missing.

 

How can I tell Revit that a previously used Updater won't be needed anymore?

 

EDIT: I know that I could just always register the updater, but this won't help users who don't have my AddIn.
EDIT2: Btw, I'm using Revit2017, if that makes any difference.

0 Likes
1,160 Views
6 Replies
Replies (6)
Message 2 of 7

tshunau
Contributor
Contributor

I believed the only way to do it is actually to detach the model from central and save as a new central file.  Let me know if that works for you

 

Tak Au,

0 Likes
Message 3 of 7

FAIR59
Advisor
Advisor

On registering the Updater you can specify that the updater is Optional.

http://www.revitapidocs.com/2016/edffd44c-2511-c9ee-f330-5cd77414d0e9.htm 

0 Likes
Message 4 of 7

felix.hopmann
Explorer
Explorer

I know that I can do this, and this is what I am currently doing, however, as long as AddIn-created views exist in the document, I want the warning to show up, so, basically, I want to repeatedly switch between optional and non-optional.

 

Meanwhile, I tried updating the IsOptional property of the Updater in the Saving and SavingAs events, unfortunately to no success, the first value set seems to be persistent.

0 Likes
Message 5 of 7

FAIR59
Advisor
Advisor

I suppose you've used UpdaterRegistry.SetIsUpdaterOptional() to change the IsOptional property.

 

0 Likes
Message 6 of 7

felix.hopmann
Explorer
Explorer

Yes. Immediately after creation it works, later apparently it doesn't. However, it doesn't throw errors either.

0 Likes
Message 7 of 7

felix.hopmann
Explorer
Explorer

Seems to be the same issue as in https://forums.autodesk.com/t5/revit-api-forum/unable-to-disable-warning-for-missing-third-party-upd... except for that if it is set upon creation, it works. However, I am always testing with new documents, i.e. on re-creation it might behave like in that other thread.

0 Likes