<?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: OnDocumentChange event not firing in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/ondocumentchange-event-not-firing/m-p/4485795#M128029</link>
    <description>&lt;P&gt;Try always setting the "Embed Interop Types = False" for the Inventor reference. This fixes the issue in my case:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/64393i43C1171698FB127F/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="img.png" title="img.png" align="middle" /&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 04 Oct 2013 07:54:51 GMT</pubDate>
    <dc:creator>philippe.leefsma</dc:creator>
    <dc:date>2013-10-04T07:54:51Z</dc:date>
    <item>
      <title>OnDocumentChange event not firing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ondocumentchange-event-not-firing/m-p/4477313#M128022</link>
      <description>&lt;P&gt;I can't figure out what I've got wrong here, I'm trying to create a handler for the OnDocumentChange Application event.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;private Inventor.Application m_inventorApplication;&lt;BR /&gt;Inventor.ApplicationEvents appEvents = null;&lt;/P&gt;&lt;P&gt;public StandardAddInServer()&lt;BR /&gt;{&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)&lt;BR /&gt;{&lt;BR /&gt;// Initialize AddIn members.&lt;BR /&gt;m_inventorApplication = addInSiteObject.Application;&lt;BR /&gt;appEvents = m_inventorApplication.ApplicationEvents;&lt;BR /&gt;appEvents.OnDocumentChange += appEvents_OnDocumentChange;&lt;BR /&gt;appEvents.OnSaveDocument += appEvents_OnSaveDocument;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;void appEvents_OnSaveDocument(_Document DocumentObject, EventTimingEnum BeforeOrAfter, NameValueMap Context, out HandlingCodeEnum HandlingCode)&lt;BR /&gt;{&lt;BR /&gt;MessageBox.Show("On Save");&lt;BR /&gt;HandlingCode = Inventor.HandlingCodeEnum.kEventNotHandled;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;void appEvents_OnDocumentChange(Inventor._Document DocumentObject, Inventor.EventTimingEnum BeforeOrAfter, Inventor.CommandTypesEnum ReasonsForChange, Inventor.NameValueMap Context, out Inventor.HandlingCodeEnum HandlingCode)&lt;BR /&gt;{&lt;BR /&gt;MessageBox.Show("On Document Change");&lt;BR /&gt;HandlingCode = Inventor.HandlingCodeEnum.kEventNotHandled;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My OnSaveDocument handler works just fine but the OnDocumentChange will not fire. I've been using the even watcher and have been using other handlers but cannot seem to get this one to work. Any ideas would be&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;appreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2013 21:27:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ondocumentchange-event-not-firing/m-p/4477313#M128022</guid>
      <dc:creator>ajcampbell</dc:creator>
      <dc:date>2013-10-01T21:27:30Z</dc:date>
    </item>
    <item>
      <title>Re: OnDocumentChange event not firing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ondocumentchange-event-not-firing/m-p/4482505#M128023</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So far I do not reproduce the behavior on my side. Those events are fired properly. Which version of Inventor are you running? What's the behavior with the EventWatcher, is OnDocumentChange visible with that tool?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm attachine the addin I used to test, just in case you missed something in your project.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Philippe.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2013 08:39:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ondocumentchange-event-not-firing/m-p/4482505#M128023</guid>
      <dc:creator>philippe.leefsma</dc:creator>
      <dc:date>2013-10-03T08:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: OnDocumentChange event not firing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ondocumentchange-event-not-firing/m-p/4483925#M128025</link>
      <description>i also have this problem on Inventor 2014 sp1</description>
      <pubDate>Thu, 03 Oct 2013 15:21:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ondocumentchange-event-not-firing/m-p/4483925#M128025</guid>
      <dc:creator>maxstels</dc:creator>
      <dc:date>2013-10-03T15:21:51Z</dc:date>
    </item>
    <item>
      <title>Re: OnDocumentChange event not firing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ondocumentchange-event-not-firing/m-p/4484887#M128026</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thanks&amp;nbsp;Philippe,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So here's the situation. We use Inventor 2013 and I have been writing all my addi-ins using Visual Studio 2012 express since that was the version I was already familiar with. I installed the Inventor SDK wizard using the method listed here&amp;nbsp;&lt;A target="_blank" href="https://forums.autodesk.com/t5/Autodesk-Inventor-Customization/Autodesk-Inventor-Wizards-for-Microsoft-Visual-Studio-2012/m-p/3634414/highlight/true#M40346"&gt;http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/Autodesk-Inventor-Wizards-for-Microsoft-Visual-Studio-2012/m-p/3634414/highlight/true#M40346&lt;/A&gt;. When I didn't have some of the new methods available I posted here and found that I was referencing the inventor interop version 16.0.0.0 instead of 17.0.0.0. I deleted that reference added a new one to version 17 from the program files folder and everything seemed to be working fine. Every time I started a new addin I would need to change my reference but other than that there seemed to be no difference, until this issue.&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;When I got the file from you I initially opened it in VS2012, built it and ran it and it worked, just as expected. So I started a new project with the wizard, pasted your code, changed my reference, and it would not work. Only the onsave event was firing. So I installed a version of VS2010, installed the add-in wizard, new project works great. I checked the path of the reference that was working and saw it was not in the program files folder, but in a windows assembly folder, so I tried again in 2012 with the new reference with no luck. I am always targeting .net version 4.0 so I think all of my code will work fine in VS2010 but I would prefer to use 2012 since I am using it for some other development. Is there some other reason why add-ins written in 2010 would be different than ones written in 2012? Or is there some other template that I can use to write in 2012? Thanks again for all your help, if nothing else think I can just use 2010 and it will get me there.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Cheers-&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Andy&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2013 21:17:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ondocumentchange-event-not-firing/m-p/4484887#M128026</guid>
      <dc:creator>ajcampbell</dc:creator>
      <dc:date>2013-10-03T21:17:41Z</dc:date>
    </item>
    <item>
      <title>Re: OnDocumentChange event not firing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ondocumentchange-event-not-firing/m-p/4484907#M128027</link>
      <description>&lt;P&gt;I just moved the template file from my VS2010 templates to my VS2012 templates and it worked. I attached it in case anyone else is having trouble with this. You still need to change path for the maifest post build event to from&amp;nbsp;&amp;nbsp;"%VS&lt;FONT color="#FF0000"&gt;10&lt;/FONT&gt;0COMNTOOLS%vsvars32" to&amp;nbsp;&amp;nbsp;"%VS&lt;FONT color="#FF0000"&gt;11&lt;/FONT&gt;0COMNTOOLS%vsvars32" before you build.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Oct 2013 21:40:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ondocumentchange-event-not-firing/m-p/4484907#M128027</guid>
      <dc:creator>ajcampbell</dc:creator>
      <dc:date>2013-10-03T21:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: OnDocumentChange event not firing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ondocumentchange-event-not-firing/m-p/4485583#M128028</link>
      <description>&lt;P&gt;i send this issue &amp;nbsp;&amp;nbsp;&lt;STRONG&gt;Case 08824333 to&lt;/STRONG&gt;&amp;nbsp;Support&lt;STRONG&gt; ADN,&amp;nbsp;&lt;/STRONG&gt;my project in to vb.net use Visual Studio 2012&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 06:17:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ondocumentchange-event-not-firing/m-p/4485583#M128028</guid>
      <dc:creator>maxstels</dc:creator>
      <dc:date>2013-10-04T06:17:08Z</dc:date>
    </item>
    <item>
      <title>Re: OnDocumentChange event not firing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ondocumentchange-event-not-firing/m-p/4485795#M128029</link>
      <description>&lt;P&gt;Try always setting the "Embed Interop Types = False" for the Inventor reference. This fixes the issue in my case:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/64393i43C1171698FB127F/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="img.png" title="img.png" align="middle" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 07:54:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ondocumentchange-event-not-firing/m-p/4485795#M128029</guid>
      <dc:creator>philippe.leefsma</dc:creator>
      <dc:date>2013-10-04T07:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: OnDocumentChange event not firing</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/ondocumentchange-event-not-firing/m-p/4487663#M128030</link>
      <description>&lt;P&gt;This does it, Thanks!&lt;/P&gt;&lt;P&gt;Changing to the non-embedded interop does require some extra casting (no dynamic variables), but my event handlers will all trigger now. In googling why this worked I did run across this from Mod the Machine&amp;nbsp;&lt;A target="_blank" href="http://modthemachine.typepad.com/my_weblog/2012/07/set-embed-interop-types-to-false-to-avoid-problems-with-events.html"&gt;http://modthemachine.typepad.com/my_weblog/2012/07/set-embed-interop-types-to-false-to-avoid-problems-with-events.html&lt;/A&gt;&amp;nbsp;for future reference.&lt;/P&gt;&lt;P&gt;Thanks again for your help Philippe&lt;/P&gt;</description>
      <pubDate>Fri, 04 Oct 2013 14:00:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/ondocumentchange-event-not-firing/m-p/4487663#M128030</guid>
      <dc:creator>ajcampbell</dc:creator>
      <dc:date>2013-10-04T14:00:59Z</dc:date>
    </item>
  </channel>
</rss>

