<?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 How to use this ThisDoc.Document in vb.net in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-use-this-thisdoc-document-in-vb-net/m-p/5846565#M58986</link>
    <description>&lt;P&gt;Hey&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im trying to make my frist add-in that have to run, when i save *.ipt.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;It works when I save &amp;nbsp;.ipt file as active document.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when I save the .ipt file from .idw and .iam, the add-in is not runing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In iLogic I can solve it by using oDoc = ThisDoc.Document, but how does it work in vb.net?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 06 Oct 2015 08:30:03 GMT</pubDate>
    <dc:creator>RasmusBredal</dc:creator>
    <dc:date>2015-10-06T08:30:03Z</dc:date>
    <item>
      <title>How to use this ThisDoc.Document in vb.net</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-use-this-thisdoc-document-in-vb-net/m-p/5846565#M58986</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Im trying to make my frist add-in that have to run, when i save *.ipt.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;It works when I save &amp;nbsp;.ipt file as active document.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when I save the .ipt file from .idw and .iam, the add-in is not runing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In iLogic I can solve it by using oDoc = ThisDoc.Document, but how does it work in vb.net?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Oct 2015 08:30:03 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-use-this-thisdoc-document-in-vb-net/m-p/5846565#M58986</guid>
      <dc:creator>RasmusBredal</dc:creator>
      <dc:date>2015-10-06T08:30:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to use this ThisDoc.Document in vb.net</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-use-this-thisdoc-document-in-vb-net/m-p/5846585#M58987</link>
      <description>&lt;P&gt;Hi, this could do it:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dim oDoc As Document
oDoc = ThisApplication.ActiveDocument&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Oct 2015 08:41:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-use-this-thisdoc-document-in-vb-net/m-p/5846585#M58987</guid>
      <dc:creator>Owner2229</dc:creator>
      <dc:date>2015-10-06T08:41:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to use this ThisDoc.Document in vb.net</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-use-this-thisdoc-document-in-vb-net/m-p/5847103#M58993</link>
      <description>&lt;P&gt;Sorry but I&amp;nbsp;can not translate that to my code..&amp;nbsp;&lt;img id="smileyindifferent" class="emoticon emoticon-smileyindifferent" src="https://forums.autodesk.com/i/smilies/16x16_smiley-indifferent.png" alt="Smiley Indifferent" title="Smiley Indifferent" /&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;This code work when I save the part, but i´t wont run when I save the part from idw.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code in modifyde from:&amp;nbsp;&lt;A title="Sheet Metal Extents Add-In" href="http://modthemachine.typepad.com/my_weblog/2012/05/sheet-metal-extents-add-in-update.html" target="_self"&gt;Sheet Metal Extents Add-In&lt;/A&gt;&lt;/P&gt;&lt;PRE&gt;        Private Sub m_appEvents_OnSaveDocument(ByVal DocumentObject As Inventor._Document, ByVal BeforeOrAfter As Inventor.EventTimingEnum, ByVal Context As Inventor.NameValueMap, ByRef HandlingCode As Inventor.HandlingCodeEnum) Handles m_appEvents.OnSaveDocument
            If BeforeOrAfter = EventTimingEnum.kBefore Then
                &lt;BR /&gt;                Dim inventorAppType As Type = System.Type.GetTypeFromProgID("Inventor.Application")
                Dim _InvApplication As Inventor.Application = CType(System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application"), Application)
                Dim oPartDoc As PartDocument&lt;BR /&gt;
                oPartDoc = CType(_InvApplication.ActiveDocument, Inventor.PartDocument)
                ' Make sure the document is a sheet metal document.&lt;BR /&gt;
                If oPartDoc.SubType &amp;lt;&amp;gt; "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}" Then
                    MsgBox("A sheet metal document must be open.")
                    Exit Sub
                Else
                    MsgBox("A sheet metal has been save")
                End If
            End If
        End Sub&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Oct 2015 13:40:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-use-this-thisdoc-document-in-vb-net/m-p/5847103#M58993</guid>
      <dc:creator>RasmusBredal</dc:creator>
      <dc:date>2015-10-06T13:40:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to use this ThisDoc.Document in vb.net</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-use-this-thisdoc-document-in-vb-net/m-p/5847129#M58994</link>
      <description>Yes, because you are trying to turn the idw into a part document, which will obviously throw an error</description>
      <pubDate>Tue, 06 Oct 2015 13:49:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-use-this-thisdoc-document-in-vb-net/m-p/5847129#M58994</guid>
      <dc:creator>MechMachineMan</dc:creator>
      <dc:date>2015-10-06T13:49:09Z</dc:date>
    </item>
    <item>
      <title>Betreff: How to use this ThisDoc.Document in vb.net</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-use-this-thisdoc-document-in-vb-net/m-p/5848577#M59006</link>
      <description>Hi, you should work with the DocumentObject you get from the Sub instead of the ActiveDocument. Then your code also runs when you push the save button in an assembly. As it is right now you code only runs on the assembly itself and ignores its chldren (assumed you have an assembly open).</description>
      <pubDate>Wed, 07 Oct 2015 06:45:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-use-this-thisdoc-document-in-vb-net/m-p/5848577#M59006</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2015-10-07T06:45:26Z</dc:date>
    </item>
  </channel>
</rss>

