Intermediate API Update Releases

I recently mentioned the availability of the

Revit 2012 Update Release 2
and
my surprise that some people prefer not to update, which gave rise to a couple of vehement

comments
.

I myself seldom ran into issues with incompatibilities between intermediate releases, but now one affecting the API cropped up:

Question: Using the IUpdater interface, I can do the following with the Revit 2012 API:


  ElementId paramId = new ElementId(
    BuiltInParameter.ROOM_NUMBER );
 
  UpdaterRegistry.AddTrigger(
    GetUpdaterId(), elementFilter,
    Element.GetChangeTypeParameter( paramId ) );

The above works for Revit 2012.

In the Revit 2011 API, however, the Element.GetChangeTypeParameter is not overloaded to take the above paramId.
Is there an equivalent way of achieving the same thing with the Revit 2011 API?
I am unable to find a single example for this in the Revit Help, online, or anywhere.

Answer: Although this method overload was not provided in the initial release of Revit 2011, it was added by the

web update 2
.

I am not aware of any reason not to update, although some users never do, possibly due to concerns that regressions will halt their current workflow, or just the amount of time it takes to deploy the new version.

As a developer selling your add-in, you need to be conscious of this.
If you do require functionality from a later update release in your application, you should make

appropriate version checks
.

This is also one reason why we avoid significant API additions in intermediate update releases, as it becomes more difficult for developers and users of these applications to manage.


Comments

3 responses to “Intermediate API Update Releases”

  1. Jeremy,
    I have the following code for a Revit add-in I am working on (for 2011 and 2012):
    ElementId ep = new ElementId(BuiltInParameter.VIEWPORT_DETAIL_NUMBER);
    UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), filter, Element.GetChangeTypeParameter(ep));
    It seems to work just fine compiling with the 2011 API. The only difference I can see between the code example you have is the “updater.GetUpdaterId()” vs. “GetUpdaterId()” in your code.
    I am just a novice of sorts, so I don’t know if that really made the difference or if it was just a more updated version of the 2011 API?
    Hope that helps. It was just fresh in my mind and I wanted to contribute my 2 cents.
    Nick

  2. Sorry, I didn’t read far enough into your post (for the answer).. whoops! I appreciate the link to the version check (so I can make sure everyone is using the updated version of 2011 for my add-in).

  3. Tim Fells Avatar
    Tim Fells

    Jeremy –
    Your code registers an Updater to respond to a change in a built-in parameter, whose ElementId is independent of the Document in which it exists. Since an Updater is not associated with a particular Document when it is registered, and does not know the Document until its Execute method is invoked, is there any way to get an Updater to respond to a change in a custom parameter? GetChangeTypeAny() does not appear to work with text parameters (per the documentation). Is it possible to add a ChangeType to the Updater when a Document opens (ie. after the Updater is already registered)?

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading