<?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: Context Menu - Experiments and first Observations in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/13361099#M812</link>
    <description>&lt;P&gt;Thanks Jeremy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Happy to provide my plugins at some point - just need some time to finish Drafter for revit 2026.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. It is rather enough. As mentioned before, I'm going to code myself some "settings". It will allow user to choose which ones they are using. Still, right now it fails without style and creates confusion &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; No way to check if it is going to happen, so it is hard to even warn a user about it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. Don't really see a good reason to keep it this way. Below the print screen with my external Command (part of my free plugin Extra). It registers nicely in the last commands and at the same time you can run it via last used command. First things which it does is to prompt user to select something (or it checks currently selected elements if there are some)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JulianWandzilak_0-1741554101468.jpeg" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1475545i901605732455A046/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JulianWandzilak_0-1741554101468.jpeg" alt="JulianWandzilak_0-1741554101468.jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;link to the animation presenting it:&lt;/P&gt;&lt;P&gt;&lt;A title="Link to my web page with a short gif animation " href="https://w7k.pl/tools/extra/#measure-outside-perimeter-of-selected-regions" target="_blank" rel="noopener"&gt;Link to my web page with a short gif animation &lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 09 Mar 2025 21:06:30 GMT</pubDate>
    <dc:creator>Julian.Wandzilak</dc:creator>
    <dc:date>2025-03-09T21:06:30Z</dc:date>
    <item>
      <title>Context Menu - Experiments and first Observations</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/13349107#M808</link>
      <description>&lt;P&gt;I've been recently playing a lot with context menus and managed to create some interesting problems.&lt;/P&gt;&lt;P&gt;Here they are:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Command started from context menu doesn’t save itself in the list of recently used commands:&lt;OL&gt;&lt;LI&gt;It won't be shown on the list of recent commands.&lt;/LI&gt;&lt;LI&gt;You won’t be able to repeat them with “repeat the last command”. Revit will run the previous command instead.&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JulianWandzilak_0-1741005716305.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1473174i9D4AE831FF80CDF7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JulianWandzilak_0-1741005716305.png" alt="JulianWandzilak_0-1741005716305.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;It is super annoying especially that we want to be able to use these commands often and start them quickly (which is the main reason to use context menu vs normal buttons) &amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;/LI&gt;&lt;LI&gt;There is a maximum number of register commands. After hitting some magical number (I didn’t count them, but the number is probably somewhere close to 150), Revit will allow you to create more of them but will block us from using them. They will be greyed out as in the picture below - I learn about it by a fluke after spending an hour trying to find out why commands for one of my tools are grayed out.&amp;nbsp;&lt;BR /&gt;One thing to keep in mind is that you share this number between all loaded add-ins.&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JulianWandzilak_1-1741005716308.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1473175iA1D54A3AB8090EA7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JulianWandzilak_1-1741005716308.png" alt="JulianWandzilak_1-1741005716308.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Mar 2025 12:53:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/13349107#M808</guid>
      <dc:creator>Julian.Wandzilak</dc:creator>
      <dc:date>2025-03-03T12:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: Context Menu - Experiments and first Observations</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/13349345#M809</link>
      <description>&lt;P&gt;Oh dear. That sounds a bit irritating. Thank you very much for documenting and sharing this! I guess I can understand (or imagine, at least) the Revit developers' point of view. Problem is, whenever you provide a customisation possibility, somebody will find a completely unexpected use case for it which hits limits that you never imagined would be reached or relevant. Anyway, &lt;A href="https://autodesk.slack.com/archives/C0SR6NAP8/p1741012628822899" target="_blank"&gt;I shared your findings with them&lt;/A&gt;. Let's wait and see what they say.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Mar 2025 14:40:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/13349345#M809</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2025-03-03T14:40:20Z</dc:date>
    </item>
    <item>
      <title>Re: Context Menu - Experiments and first Observations</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/13350008#M810</link>
      <description>&lt;P&gt;Learning by breaking... My favourite method. And now I have to figure out a way of making some settings for my users to personalize their choice of items in context menu. More learning &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;To be fair, I have 240+ commands across all my tools now, so I am probably the only one who was able to hit this problem. The context menus are glorious and such a big present from devs so naturally it would be great to be somehow responsible for making them even better.&lt;/P&gt;</description>
      <pubDate>Mon, 03 Mar 2025 20:03:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/13350008#M810</guid>
      <dc:creator>Julian.Wandzilak</dc:creator>
      <dc:date>2025-03-03T20:03:31Z</dc:date>
    </item>
    <item>
      <title>Re: Context Menu - Experiments and first Observations</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/13355178#M811</link>
      <description>&lt;P&gt;Initial discussion of this:&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Sounds like a it should be filed if there's a reproducible case.&lt;BR /&gt;2. 150 is a lot of content for the context menu. Please remember that it is a shared space and Revit design does not put everything you can do in the entire Ribbon/other UI into the context menu, only the commands we believe will be the most needed. That being said, I wonder if we can clarify this limitation and perhaps fail better than showing a non-usable button. &lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;Not adding context menu commands to the list of recent commands is the same for internal commands. Maybe, to avoid commands that may depend on selection and therefore may be not repeatable. This doesn't work perfectly though...&amp;nbsp;There's an additional complication for external context menu commands because we clear the commands before building a new menu&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;External context menu commands are assigned temporary ids.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;There's a debug warning if too many commands are created. That needs to surface to the plugin developer.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW, our current estimate is that no more than 200 external context menu commands are possible, it seems.&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Mar 2025 00:59:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/13355178#M811</guid>
      <dc:creator>jeremy_tammik</dc:creator>
      <dc:date>2025-03-06T00:59:50Z</dc:date>
    </item>
    <item>
      <title>Re: Context Menu - Experiments and first Observations</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/13361099#M812</link>
      <description>&lt;P&gt;Thanks Jeremy,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. Happy to provide my plugins at some point - just need some time to finish Drafter for revit 2026.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. It is rather enough. As mentioned before, I'm going to code myself some "settings". It will allow user to choose which ones they are using. Still, right now it fails without style and creates confusion &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; No way to check if it is going to happen, so it is hard to even warn a user about it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. Don't really see a good reason to keep it this way. Below the print screen with my external Command (part of my free plugin Extra). It registers nicely in the last commands and at the same time you can run it via last used command. First things which it does is to prompt user to select something (or it checks currently selected elements if there are some)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JulianWandzilak_0-1741554101468.jpeg" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1475545i901605732455A046/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JulianWandzilak_0-1741554101468.jpeg" alt="JulianWandzilak_0-1741554101468.jpeg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;link to the animation presenting it:&lt;/P&gt;&lt;P&gt;&lt;A title="Link to my web page with a short gif animation " href="https://w7k.pl/tools/extra/#measure-outside-perimeter-of-selected-regions" target="_blank" rel="noopener"&gt;Link to my web page with a short gif animation &lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 09 Mar 2025 21:06:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/13361099#M812</guid>
      <dc:creator>Julian.Wandzilak</dc:creator>
      <dc:date>2025-03-09T21:06:30Z</dc:date>
    </item>
    <item>
      <title>Re: Context Menu - Experiments and first Observations</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/13365893#M813</link>
      <description>&lt;P&gt;Not entirely sure, but I know there are some oddities with commands (Shortcut keys / Visibility) if the commands are not loaded on the Ribbon.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'd also say that the availability component of the Context menu could probably be helpful here as I can't imagine ALL of those are useful on / in every view.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;menuItem.SetAvailabilityClassName(typeof(TAvailability).FullName)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 12 Mar 2025 04:33:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/13365893#M813</guid>
      <dc:creator>Sean_Page</dc:creator>
      <dc:date>2025-03-12T04:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: Context Menu - Experiments and first Observations</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/13385827#M814</link>
      <description>&lt;P&gt;Thanks &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3064449"&gt;@Sean_Page&lt;/a&gt; for this suggestion, I managed to implement it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A quick question, right now it grays out the command - Have you found out a way of hiding it completely? Also, in case of having all the options grayed out, we should be able to hide SubMenuItems, but I haven't seen anything allowing it.&lt;/P&gt;</description>
      <pubDate>Sun, 23 Mar 2025 15:46:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/13385827#M814</guid>
      <dc:creator>Julian.Wandzilak</dc:creator>
      <dc:date>2025-03-23T15:46:18Z</dc:date>
    </item>
    <item>
      <title>Re: Context Menu - Experiments and first Observations</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/13385833#M815</link>
      <description>&lt;P&gt;Since the menus are initiated on Context (click) then you have to provide logic with each call to show (add) calls to the menu.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example here is a method that check current selection and if they are of a certain category the menu option is added.&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;if(CheckReferences(BuiltInCategory.OST_Rooms) || CheckReferences(BuiltInCategory.OST_Areas))
                    {
                        menu.AddSubMenu("Spaces", SpacesSubMenu);
                        menu.AddSeparator();
                    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 23 Mar 2025 16:00:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/13385833#M815</guid>
      <dc:creator>Sean_Page</dc:creator>
      <dc:date>2025-03-23T16:00:53Z</dc:date>
    </item>
    <item>
      <title>Re: Context Menu - Experiments and first Observations</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/14092176#M85479</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3064449"&gt;@Sean_Page&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;Since the menus are initiated on Context (click) then you have to provide logic with each call to show (add) calls to the menu.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example here is a method that check current selection and if they are of a certain category the menu option is added.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;LI-CODE lang="csharp"&gt;if(CheckReferences(BuiltInCategory.OST_Rooms) || CheckReferences(BuiltInCategory.OST_Areas))
                    {
                        menu.AddSubMenu("Spaces", SpacesSubMenu);
                        menu.AddSeparator();
                    }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3064449"&gt;@Sean_Page&lt;/a&gt;, I know that this is over a year old but I'm just now trying to create a dynamic menu builder for the first time and this is one of the very few posts that I can find that talk about this subject, and you seem to have a handle on it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My question to you, if you choose to accept it &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; , is this: How are you passing the current selection set (or otherwise acquiring it) into your CheckReferences() function? Since the&amp;nbsp;IContextMenuCreator Class implementation, nor the&amp;nbsp;BuildContextMenu function within it contain the CommandData that I'm usually working with in an&amp;nbsp;IExternalCommand Class, I'm at a complete loss as to how to acquire the selection set from within my menu creation class.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My apologies if this seems like a dumb question but I am not a professional developer by any means, I just try to code a few of the pieces that are missing for myself and my co-workers and I can't seem to wrap my head around this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Gary&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2026 18:29:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/14092176#M85479</guid>
      <dc:creator>GaryOrrMBI</dc:creator>
      <dc:date>2026-04-15T18:29:36Z</dc:date>
    </item>
    <item>
      <title>Re: Context Menu - Experiments and first Observations</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/14092197#M85480</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4987019"&gt;@GaryOrrMBI&lt;/a&gt;, probably a simpler solution than you expect, but I am just using a global reference to the UIApplication that I store.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From there, it just like any other selection check:&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;//UIApp here is my global property that is set early during app start
UIApp.ActiveUIDocument.Selection.GetReferences()&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 15 Apr 2026 18:38:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/14092197#M85480</guid>
      <dc:creator>Sean_Page</dc:creator>
      <dc:date>2026-04-15T18:38:07Z</dc:date>
    </item>
    <item>
      <title>Re: Context Menu - Experiments and first Observations</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/14092363#M85481</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3064449"&gt;@Sean_Page&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;Thank you for the timely response.&lt;/P&gt;&lt;P&gt;You may be giving me too much credit. I may be over my head here.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in my&amp;nbsp;IExternalApplication implementation I have my&amp;nbsp;OnStartup function. That function has access to the UIControlledApplication Object.&lt;/P&gt;&lt;P&gt;In the OnStartUp function I build my Menu Panel and all the different buttons and such. This is also where I need to add the RegisterContextMenu call (I believe).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That calls my&amp;nbsp;IContextMenuCreator Class. In the&amp;nbsp;BuildContextMenu function within that Class is where I'm trying to add my conditional check to decide if a given menu item will be added. As of this point the only access that I have to Revit is the afore mentioned UIControlledApplication object which does not have access to the UIApplication object.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm lost as to how to gain access to the UIApplication object and all of the downstream objects.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This stuff was much more straight forward in AutoCAD...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I may just have to stick with creating another button or two &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks again for your assistance.&lt;/P&gt;&lt;P&gt;-G&lt;/P&gt;</description>
      <pubDate>Wed, 15 Apr 2026 20:34:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/14092363#M85481</guid>
      <dc:creator>GaryOrrMBI</dc:creator>
      <dc:date>2026-04-15T20:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: Context Menu - Experiments and first Observations</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/14093352#M85485</link>
      <description>&lt;P&gt;Ok, here is a rundown of how I do it:&lt;BR /&gt;&lt;BR /&gt;OnStartup:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;application.Idling += new EventHandler&amp;lt;IdlingEventArgs&amp;gt;(Application_Idling);
RegisterContextMenu(application)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Register the Context Menu, also in the App or same class as OnStartup:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;private static void RegisterContextMenu(UIControlledApplication application)
{
    application.RegisterContextMenu("RDG", new CreateContextMenu());
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Use an Application Idling event to get the UIApplication:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;private void Application_Idling(object sender, IdlingEventArgs args)
{
    uiApp = sender as UIApplication;
    Global.UIApp = uiApp; //This is how you can store this to a app property
    AppParams.application.Idling -= Application_Idling;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2026 12:11:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/14093352#M85485</guid>
      <dc:creator>Sean_Page</dc:creator>
      <dc:date>2026-04-16T12:11:28Z</dc:date>
    </item>
    <item>
      <title>Re: Context Menu - Experiments and first Observations</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/14093388#M85486</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3064449"&gt;@Sean_Page&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I have been resisting event handlers (shadowy concerns over overhead and possibly setting myself up for unexpected continuous loop scenarios if not done correctly) so I hadn't looked into them too deeply, but I was just digging into that very thing, both as a possibility to solve my current dilemma as well as considering some updaters for some of my background data driven functions, when the notification arrived with your response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had simply never imagined an event handler that removed itself as soon as it got done setting up the app wide variable.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for that pointer and clear process example. This gets me one step closer to understanding what I'm doing &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-G&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2026 12:32:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/14093388#M85486</guid>
      <dc:creator>GaryOrrMBI</dc:creator>
      <dc:date>2026-04-16T12:32:55Z</dc:date>
    </item>
    <item>
      <title>Re: Context Menu - Experiments and first Observations</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/14093479#M85487</link>
      <description>&lt;P&gt;Yes, there can be real concerns with events if something within your subscription fires the event again, but there are a lot of great uses for them, and the events get raised whether you are listening or not, so not too much more overhead unless you are doing a lot of work when the event happens.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While the example I posted was a simplified version of how I am using that idling event, I hope it answers what you asked!&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;PS: You will also see in the event that you will need a Global or at least a class property for the UIControlledApplication to unsubscribe from the idling event.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2026 13:24:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/14093479#M85487</guid>
      <dc:creator>Sean_Page</dc:creator>
      <dc:date>2026-04-16T13:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: Context Menu - Experiments and first Observations</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/14094124#M85492</link>
      <description>&lt;DIV&gt;&lt;P&gt;&lt;FONT size="4"&gt;I solved this problem in a different way. I’m not entirely sure how correct it is, but it seems to work well.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="4"&gt;So, in OnApplicationInitialized()&amp;nbsp;while registeringContextMenu Im creating my new contextMenu with UIApplication:&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;void OnApplicationInitialized(object sender, ApplicationInitializedEventArgs e)
{
    var app = sender as Autodesk.Revit.ApplicationServices.Application;
    var uiapp = new UIApplication(app);
    var rvtApp = uiapp.Application;

#if RELEASE2025 || RELEASE2026
    uiapp.RegisterContextMenu("W7K_Drafter", new W7k_DrafterContextMenu(uiapp));
#endif
}&lt;/LI-CODE&gt;&lt;DIV&gt;&lt;FONT size="4"&gt;To do it I created a simple constructor. It allows an easy access to UIApplication each time the menu is created. And from there it is easy to check selection or query active&amp;nbsp;Document:&amp;nbsp;&amp;nbsp;&lt;/FONT&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;internal class W7k_DrafterContextMenu : IContextMenuCreator
{
    private UIApplication UiApp;

    internal W7k_DrafterContextMenu(UIApplication uiApp)
    {
        UiApp = uiApp;
    }

    public void BuildContextMenu(ContextMenu menu)
    {
        ICollection&amp;lt;ElementId&amp;gt; elemIds =
            UiApp.ActiveUIDocument.Selection.GetElementIds();

        Document doc = UiApp.ActiveUIDocument.Document;

        ...&lt;/LI-CODE&gt;&lt;DIV&gt;&lt;FONT size="4"&gt;I hope this helps. And as always, I’m happy to be corrected if I’m doing something fundamentally wrong.&lt;/FONT&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2026 21:17:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/14094124#M85492</guid>
      <dc:creator>Julian.Wandzilak</dc:creator>
      <dc:date>2026-04-16T21:17:48Z</dc:date>
    </item>
    <item>
      <title>Re: Context Menu - Experiments and first Observations</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/14094143#M85493</link>
      <description>&lt;P&gt;I think this is a great way of approaching it. I just use a Global because I have it scattered all over the App for different things and it just makes it consistent for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for sharing &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2060060"&gt;@Julian.Wandzilak&lt;/a&gt;!&lt;/P&gt;</description>
      <pubDate>Thu, 16 Apr 2026 21:36:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/14094143#M85493</guid>
      <dc:creator>Sean_Page</dc:creator>
      <dc:date>2026-04-16T21:36:42Z</dc:date>
    </item>
    <item>
      <title>Re: Context Menu - Experiments and first Observations</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/14094920#M85498</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2060060"&gt;@Julian.Wandzilak&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;This gives me something else to look into (as soon as I can get back to it, I had to shift back into Model Technician and do some actual chargeable work &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; ).&lt;/P&gt;&lt;P&gt;My limited knowledge says that this is happening when launching your interface, a dockable pane or some such? As of now, my tools are more limited in scope as they usually just sit there in a tool panel until a user clicks a button, then they go to work, then they shut back down and get out of the way. But it is something to look into in the future.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many Thanks for the additional thoughts/direction,&lt;/P&gt;&lt;P&gt;-G&lt;/P&gt;</description>
      <pubDate>Fri, 17 Apr 2026 12:36:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/context-menu-experiments-and-first-observations/m-p/14094920#M85498</guid>
      <dc:creator>GaryOrrMBI</dc:creator>
      <dc:date>2026-04-17T12:36:24Z</dc:date>
    </item>
  </channel>
</rss>

