<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: IUpdater, simple example needed in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/iupdater-simple-example-needed/m-p/9891226#M30189</link>
    <description>&lt;P&gt;The first place to go to for simple Revit API samples is the Revit SDK.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That is its one and only purpose.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;One of the samples is&amp;nbsp;DynamicModelUpdate:&amp;nbsp;Dynamic Model Update used to maintain relative position between elements; Move a section marker to maintain relative position with a window.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please install and explore the Revit SDK samples.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 24 Nov 2020 08:08:16 GMT</pubDate>
    <dc:creator>jeremytammik</dc:creator>
    <dc:date>2020-11-24T08:08:16Z</dc:date>
    <item>
      <title>IUpdater, simple example needed</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/iupdater-simple-example-needed/m-p/9890735#M30188</link>
      <description>&lt;P&gt;I don't understand where to place the following code.&amp;nbsp; Reading the comments, the author points to the OnStartup() but I am not sure where 'element' in the element.get_Paramter(BuiltInParameter...) is coming from.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where does this last bit of code go?&amp;nbsp; &lt;A href="https://adndevblog.typepad.com/aec/2016/02/revitapi-how-to-use-dmu-dynamic-model-update-api.html" target="_blank" rel="noopener"&gt;LINK&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any assistance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;var parameter = element.get_Parameter(BuiltInParameter.ROOM_AREA);
UpdaterRegistry.AddTrigger(_updater.GetUpdaterId(), doc, 
    new List&amp;lt;ElementId&amp;gt;() { new ElementId(197280)}, 
    Element.GetChangeTypeParameter(parameter));&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2020 01:42:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/iupdater-simple-example-needed/m-p/9890735#M30188</guid>
      <dc:creator>aclarke</dc:creator>
      <dc:date>2020-11-24T01:42:27Z</dc:date>
    </item>
    <item>
      <title>Re: IUpdater, simple example needed</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/iupdater-simple-example-needed/m-p/9891226#M30189</link>
      <description>&lt;P&gt;The first place to go to for simple Revit API samples is the Revit SDK.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That is its one and only purpose.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;One of the samples is&amp;nbsp;DynamicModelUpdate:&amp;nbsp;Dynamic Model Update used to maintain relative position between elements; Move a section marker to maintain relative position with a window.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please install and explore the Revit SDK samples.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2020 08:08:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/iupdater-simple-example-needed/m-p/9891226#M30189</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2020-11-24T08:08:16Z</dc:date>
    </item>
    <item>
      <title>Re: IUpdater, simple example needed</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/iupdater-simple-example-needed/m-p/9891511#M30190</link>
      <description>&lt;P&gt;Thank you,&amp;nbsp; my first search in the SDK, I did a window explorer search for "Updater" and the only CS file was for a Structural example with some monster code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I notice for all Updater examples use the designation is 'm_'&amp;nbsp; &amp;nbsp;does the m_ have a meaning?&amp;nbsp; or just indicates Updater variables?&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2020 10:05:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/iupdater-simple-example-needed/m-p/9891511#M30190</guid>
      <dc:creator>aclarke</dc:creator>
      <dc:date>2020-11-24T10:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: IUpdater, simple example needed</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/iupdater-simple-example-needed/m-p/9891558#M30191</link>
      <description>&lt;P&gt;The `m_` prefix is a convention used in C++ to mark member variables.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;It is not used in C#.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;Therefore, you can tell that (possibly, probably?) whoever implemented the C# code has little experience in C#. and more experience in C++.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;To tell the truth, I did the same thing when I started with C#.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;By the way, you should almost always ask the Internet such things before bothering other people with it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Look what an Internet search says right out of the box:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://duckduckgo.com/?q=m_+prefix" target="_blank" rel="noopener"&gt;https://duckduckgo.com/?q=m_+prefix&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/13018189/what-does-m-variable-prefix-mean" target="_blank"&gt;https://stackoverflow.com/questions/13018189/what-does-m-variable-prefix-mean&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not that I mind, but it is more efficient for you yourself.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I ask the Internet dozens of things like that every single day, and I would never get anything else done at all if I asked all my questions in discussion forums.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2020 10:28:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/iupdater-simple-example-needed/m-p/9891558#M30191</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2020-11-24T10:28:27Z</dc:date>
    </item>
    <item>
      <title>Re: IUpdater, simple example needed</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/iupdater-simple-example-needed/m-p/9891680#M30192</link>
      <description>&lt;P&gt;Hi Jeremy,&lt;/P&gt;&lt;P&gt;A Forum to me is like a fishing pond, you drop in a line (by asking a question) anchor your pole, while you walk the bank with a second pole looking for the fish (an answer).&amp;nbsp; You answered my question while I researched other items.&amp;nbsp; Time well spent.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm sorry you feel my question is bothersome to others, this makes me feel&amp;nbsp;&lt;SPAN&gt;hesitant&lt;/SPAN&gt;&amp;nbsp;to ask questions not knowing what questions are except-able.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;anyway, thank you very much for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2020 11:19:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/iupdater-simple-example-needed/m-p/9891680#M30192</guid>
      <dc:creator>aclarke</dc:creator>
      <dc:date>2020-11-24T11:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: IUpdater, simple example needed</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/iupdater-simple-example-needed/m-p/9892980#M30193</link>
      <description>&lt;P&gt;Dear Alan,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your appreciation and for picking up and clarifying that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I totally agree with the approach you describe and might do exactly the same myself in that situation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You question did not bother me at all.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;There are some questions that do bother me, where the answer is more obvious, or easily searchable and findable, and I get the impression no effort at all was made before asking.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't want anybody to be &lt;U&gt;too&lt;/U&gt; hesitant asking, &lt;U&gt;and&lt;/U&gt; I do wish everybody would perform conduct some minimal research beforehand, always.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2020 20:25:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/iupdater-simple-example-needed/m-p/9892980#M30193</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2020-11-24T20:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: IUpdater, simple example needed</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/iupdater-simple-example-needed/m-p/9893248#M30194</link>
      <description>&lt;P&gt;Hi Jeremy, I just want to share my solution, with help from a friend.&amp;nbsp; I hope this is simple enough of an example and helpful for others.&amp;nbsp; This is an IExternalCommand example.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using System;
using System.Collections.Generic;
using System.Linq;

namespace _Updater
{

    class Updater01 : IUpdater
    {
        // ----------------------------------------------------------------------------------------
        // | Updater Id |
        // ----------------------------------------------------------------------------------------
        private const string Id = "B7FA01EA-F749-473F-AD7A-4A35A44802B3";

        // ----------------------------------------------------------------------------------------
        // | Constructor |
        // ----------------------------------------------------------------------------------------
        public UpdaterId updater { get; set; }
        public Updater01(Document doc, AddInId addInId)
        {
            updater = new UpdaterId(addInId, new Guid(Id));
            RegisterUpdater(doc);
            RegisterTriggers();
        }

        // ----------------------------------------------------------------------------------------
        // | Register Updater |
        // ----------------------------------------------------------------------------------------
        public void RegisterUpdater(Document doc)
        {
            if (UpdaterRegistry.IsUpdaterRegistered(this.updater, doc))
            {
                UpdaterRegistry.RemoveAllTriggers(this.updater);
                UpdaterRegistry.UnregisterUpdater(this.updater, doc);
            }

            UpdaterRegistry.RegisterUpdater(this, doc);
        }

        // ----------------------------------------------------------------------------------------
        // | Register Trigger | &amp;lt;-- Contains Element Filter
        // ----------------------------------------------------------------------------------------
        public void RegisterTriggers()
        {
            if (this.updater != null &amp;amp;&amp;amp; UpdaterRegistry.IsUpdaterRegistered(this.updater))
            {
                UpdaterRegistry.RemoveAllTriggers(this.updater);
                UpdaterRegistry.AddTrigger(this.updater,
                    new ElementCategoryFilter(BuiltInCategory.OST_Walls), Element.GetChangeTypeAny());
            }

        }

        // ----------------------------------------------------------------------------------------
        // | Execute Method | &amp;lt;-- Stuff to do
        // ----------------------------------------------------------------------------------------
        public void Execute(UpdaterData data)
        {
            Document doc = data.GetDocument();

            List&amp;lt;ElementId&amp;gt; elementIds = data.GetModifiedElementIds().ToList();
            foreach (ElementId id in elementIds)
            {
                Element e = doc.GetElement(id);
                TaskDialog.Show("td", e.Name);
            }
        }

        // ----------------------------------------------------------------------------------------
        // | Updater Members | &amp;lt;-- Extra members
        // ----------------------------------------------------------------------------------------
        public string GetAdditionalInformation()
        {
            return "NA";
        }

        public ChangePriority GetChangePriority()
        {
            return ChangePriority.MEPFixtures;
        }

        public UpdaterId GetUpdaterId()
        {
            return updater;
        }

        public string GetUpdaterName()
        {
            return "Updater01";
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace _Updater
{
    [Transaction(TransactionMode.Manual)]
    [Regeneration(RegenerationOption.Manual)]
    class Command : IExternalCommand
    {
        public Result Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            Document doc = commandData.Application.ActiveUIDocument.Document;
            AddInId activeId = commandData.Application.ActiveAddInId;

            Updater01 updater01 = new Updater01(doc, activeId);

            return Result.Succeeded;
        }
    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Nov 2020 22:02:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/iupdater-simple-example-needed/m-p/9893248#M30194</guid>
      <dc:creator>aclarke</dc:creator>
      <dc:date>2020-11-24T22:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: IUpdater, simple example needed</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/iupdater-simple-example-needed/m-p/9894699#M30195</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thank you for sharing this nice simple DMU sample.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I integrated it into The Building Coder samples release 2021.0.150.10:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://github.com/jeremytammik/the_building_coder_samples/releases/tag/2021.0.150.10" target="_blank"&gt;https://github.com/jeremytammik/the_building_coder_samples/releases/tag/2021.0.150.10&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here is the diff to the previous release:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://github.com/jeremytammik/the_building_coder_samples/compare/2021.0.150.9...2021.0.150.10" target="_blank"&gt;https://github.com/jeremytammik/the_building_coder_samples/compare/2021.0.150.9...2021.0.150.10&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;In doing so, I noticed that already include a nice simple DMU sample in the module CmdElevationWatcher that reacts to elevation view creation and compares using the DocumentChanged event versus DMU to track that happening&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;A href="https://thebuildingcoder.typepad.com/blog/2012/06/documentchanged-versus-dynamic-model-updater.html" target="_blank"&gt;https://thebuildingcoder.typepad.com/blog/2012/06/documentchanged-versus-dynamic-model-updater.html&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Here is my slightly modified version of your code:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;  [Transaction( TransactionMode.Manual )]
  class CmdSimpleUpdaterExample : IExternalCommand
  {
    class SimpleUpdater : IUpdater
    {
      const string Id = "d42d28af-d2cd-4f07-8873-e7cfb61903d8";

      UpdaterId _updater_id { get; set; }

      public SimpleUpdater( 
        Document doc, 
        AddInId addInId )
      {
        _updater_id = new UpdaterId( 
          addInId, new Guid( Id ) );

        RegisterUpdater( doc );
        RegisterTriggers();
      }

      public void RegisterUpdater( Document doc )
      {
        if( UpdaterRegistry.IsUpdaterRegistered( 
          _updater_id, doc ) )
        {
          UpdaterRegistry.RemoveAllTriggers( _updater_id );
          UpdaterRegistry.UnregisterUpdater( _updater_id, doc );
        }
        UpdaterRegistry.RegisterUpdater( this, doc );
      }

      public void RegisterTriggers()
      {
        if( null != _updater_id 
          &amp;amp;&amp;amp; UpdaterRegistry.IsUpdaterRegistered( 
            _updater_id ) )
        {
          UpdaterRegistry.RemoveAllTriggers( _updater_id );
          UpdaterRegistry.AddTrigger( _updater_id,
            new ElementCategoryFilter( BuiltInCategory.OST_Walls ), 
            Element.GetChangeTypeAny() );
        }
      }

      public void Execute( UpdaterData data )
      {
        Document doc = data.GetDocument();

        ICollection&amp;lt;ElementId&amp;gt; ids 
          = data.GetModifiedElementIds();

        IEnumerable&amp;lt;string&amp;gt; names 
          = ids.Select&amp;lt;ElementId, string&amp;gt;( 
            id =&amp;gt; doc.GetElement( id ).Name );

        TaskDialog.Show( "Simple Updater", 
          string.Join&amp;lt;string&amp;gt;( ",", names ) );
      }

      public string GetAdditionalInformation()
      {
        return "NA";
      }

      public ChangePriority GetChangePriority()
      {
        return ChangePriority.MEPFixtures;
      }

      public UpdaterId GetUpdaterId()
      {
        return _updater_id;
      }

      public string GetUpdaterName()
      {
        return "SimpleUpdater";
      }
    }

    public Result Execute( 
      ExternalCommandData commandData, 
      ref string message,
      ElementSet elements )
    {
      UIApplication uiapp = commandData.Application;
      Document doc = uiapp.ActiveUIDocument.Document;
      AddInId addInId = uiapp.ActiveAddInId;

      SimpleUpdater su = new SimpleUpdater( doc, addInId );

      return Result.Succeeded;
    }
  }&lt;/LI-CODE&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Jeremy&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2020 13:25:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/iupdater-simple-example-needed/m-p/9894699#M30195</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2020-11-25T13:25:48Z</dc:date>
    </item>
  </channel>
</rss>

