<?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: Remove addin binding mid session in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/remove-addin-binding-mid-session/m-p/7767030#M52565</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Can understand your feelings towards stale variables but on the other hand when else would you remove a command binding? At OnStartUp when you've only just added it or at OnShutDown when you aren't going to be wanting to press any original commands until next OnStartUp?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I understand there is an AddinCommandBinding.CanExecute event that can be handled I guess in the &lt;SPAN&gt;CanExecuteEventArgs you set the CanExecute to false and the command doesn't execute or appears disabled. So probably there is no need to remove command bindings you just decide when your event handler is going to return CanExecute = false vs CanExecute = true.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Not sure what overriding a command entails but when you create a binding to only change CanExecute you may have to create an implementation of Execute&amp;nbsp;that posts the original intended command.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Never done this, I think command bindings are a can of worms given you don't know what other addins are running and what command bindings they are attempting. Not sure why the feature was ever added to be honest, you can't ever rely on them if your addin is last to load.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 09 Feb 2018 22:37:10 GMT</pubDate>
    <dc:creator>RPTHOMAS108</dc:creator>
    <dc:date>2018-02-09T22:37:10Z</dc:date>
    <item>
      <title>Remove addin binding mid session</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/remove-addin-binding-mid-session/m-p/7766554#M52564</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I'm creating an add-in that restricts the ability to create model in-place elements, however I want the ability to disable or remove the binding mid session is it possible?&lt;BR /&gt;&lt;BR /&gt;The removeaddincommandbinding is only accessible at on start-up and shutdown through the uicontrolledapplication.&lt;BR /&gt;&lt;BR /&gt;I don't fancy holding this in memory for the entire session as I'm sure this isn't healthy or even possible.&lt;BR /&gt;&lt;BR /&gt;Does anyone have any suggestions?&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;&lt;BR /&gt;Kevin&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Fri, 09 Feb 2018 19:25:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/remove-addin-binding-mid-session/m-p/7766554#M52564</guid>
      <dc:creator>kevin_fielding</dc:creator>
      <dc:date>2018-02-09T19:25:06Z</dc:date>
    </item>
    <item>
      <title>Re: Remove addin binding mid session</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/remove-addin-binding-mid-session/m-p/7767030#M52565</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Can understand your feelings towards stale variables but on the other hand when else would you remove a command binding? At OnStartUp when you've only just added it or at OnShutDown when you aren't going to be wanting to press any original commands until next OnStartUp?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I understand there is an AddinCommandBinding.CanExecute event that can be handled I guess in the &lt;SPAN&gt;CanExecuteEventArgs you set the CanExecute to false and the command doesn't execute or appears disabled. So probably there is no need to remove command bindings you just decide when your event handler is going to return CanExecute = false vs CanExecute = true.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Not sure what overriding a command entails but when you create a binding to only change CanExecute you may have to create an implementation of Execute&amp;nbsp;that posts the original intended command.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Never done this, I think command bindings are a can of worms given you don't know what other addins are running and what command bindings they are attempting. Not sure why the feature was ever added to be honest, you can't ever rely on them if your addin is last to load.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2018 22:37:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/remove-addin-binding-mid-session/m-p/7767030#M52565</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2018-02-09T22:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: Remove addin binding mid session</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/remove-addin-binding-mid-session/m-p/7767806#M52566</link>
      <description>&lt;P&gt;Dear Kevin,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your query.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the IExternalCommandAvailability interface to enable and disable a command any time you like, as often as you like:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://www.revitapidocs.com/2018.1/c05acaf4-4cd9-8fd6-db06-44b22ae4f987.htm" target="_blank"&gt;http://www.revitapidocs.com/2018.1/c05acaf4-4cd9-8fd6-db06-44b22ae4f987.htm&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a demonstration showing how to use it to enable ribbon items in zero document state:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="http://thebuildingcoder.typepad.com/blog/2011/02/enable-ribbon-items-in-zero-document-state.html" target="_blank"&gt;http://thebuildingcoder.typepad.com/blog/2011/02/enable-ribbon-items-in-zero-document-state.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jeremy&lt;/P&gt;</description>
      <pubDate>Sat, 10 Feb 2018 12:02:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/remove-addin-binding-mid-session/m-p/7767806#M52566</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-02-10T12:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: Remove addin binding mid session</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/remove-addin-binding-mid-session/m-p/8017294#M52567</link>
      <description>&lt;P&gt;I ended up using the RemoveAddInCommandBinding method and posting the original command.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have an additional question, if I have a Command Binding, and I disabled the external command using &lt;SPAN&gt;IExternalCommandAvailability&lt;/SPAN&gt;, will the original command run, and how would I reactivate the external command afterwards?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2018 07:43:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/remove-addin-binding-mid-session/m-p/8017294#M52567</guid>
      <dc:creator>kevin_fielding</dc:creator>
      <dc:date>2018-05-22T07:43:07Z</dc:date>
    </item>
    <item>
      <title>Re: Remove addin binding mid session</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/remove-addin-binding-mid-session/m-p/8017412#M52568</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Dear Kevin,&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;Thank you for your update.&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 agree with your original scepticism when you say, 'I don't fancy holding this in memory for the entire session as I'm sure this isn't healthy or even possible.'&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 can imagine that you should make sure you are in a valid Revit API context whenever you decide to make the call, e.g., in an external command Execute method.&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 hope and assume that this is the case when you say that you decided to use the RemoveAddInCommandBinding method after all.&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;Looking at the API documentation, I see no way to revert the action of calling RemoveAddInCommandBinding.&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 guess you would have to leave some access path via PostCommand in place to retain the possibility to launch the original command.&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 hope this helps.&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;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>Tue, 22 May 2018 08:35:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/remove-addin-binding-mid-session/m-p/8017412#M52568</guid>
      <dc:creator>jeremytammik</dc:creator>
      <dc:date>2018-05-22T08:35:55Z</dc:date>
    </item>
  </channel>
</rss>

