<?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: GetObject(, &amp;quot;Inventor.Application&amp;quot;) vs. Marshal.GetActiveObject(&amp;quot;Inventor.Application&amp;quot;) in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/getobject-quot-inventor-application-quot-vs-marshal/m-p/11935797#M24206</link>
    <description>&lt;P&gt;Hello Devrim,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your detailed information.&lt;/P&gt;&lt;P&gt;It gives me some more insight in this matter.&lt;/P&gt;</description>
    <pubDate>Tue, 02 May 2023 10:25:41 GMT</pubDate>
    <dc:creator>Majjek</dc:creator>
    <dc:date>2023-05-02T10:25:41Z</dc:date>
    <item>
      <title>GetObject(, "Inventor.Application") vs. Marshal.GetActiveObject("Inventor.Application")</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/getobject-quot-inventor-application-quot-vs-marshal/m-p/11935352#M24204</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm just interested, can anyone tell me the difference between the lines below to get an active Inventor application object?&lt;/P&gt;&lt;P&gt;And also is one of them preferred over the other?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;GetObject(, "Inventor.Application")&lt;/P&gt;&lt;P&gt;vs.&lt;/P&gt;&lt;P&gt;Marshal.GetActiveObject("Inventor.Application")&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 06:21:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/getobject-quot-inventor-application-quot-vs-marshal/m-p/11935352#M24204</guid>
      <dc:creator>Majjek</dc:creator>
      <dc:date>2023-05-02T06:21:50Z</dc:date>
    </item>
    <item>
      <title>Re: GetObject(, "Inventor.Application") vs. Marshal.GetActiveObject("Inventor.Application")</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/getobject-quot-inventor-application-quot-vs-marshal/m-p/11935746#M24205</link>
      <description>&lt;P&gt;Hi Majjek,&lt;/P&gt;&lt;P&gt;The answer can be really boring if you are not interested with inner object structure of Windows. We have multiple differences on these two functions and I will write the things I can remember. If there is any missing one, community can complete the rest.&lt;/P&gt;&lt;P&gt;First, GetObject function is on VB library. It does not means we can't use it in another languages but we have to reach VB6 library to use it on C# for example. (As soon as we are in .NET Framework)&lt;/P&gt;&lt;P&gt;GetActiveObject method is on&amp;nbsp;System.Runtime.InteropServices Library. It's also usable for all .NET products.&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Object source:&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;GetObject method returns an object which provided by an ActiveX component.&amp;nbsp;&lt;/P&gt;&lt;P&gt;GetActiveObject gets the object from ROT(Running object table).&lt;/P&gt;&lt;P&gt;Inventor files and object are perfectly working with these two system but for other programs, in theory you can not get their object with GetObject method if they are not okay to reach with ActiveX, and also you can not get the object with GetActiveObject if programs session is not on the Running Object Table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Capability&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;With Marshall class we can get active objects (Marshal.GetActiveObject) and create objects. With GetObject method we can also specify the object we desire to get. For example for a drawing document:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Dim CADObject As Object
Set CADObject = GetObject("C:\CAD\SCHEMA.CAD")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in this scenario we will get the object itself and activate the file also. Windows will look at extension of the file and decide which object it needs to use.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Dim CADObject As Object
Set LayerObject = GetObject("C:\CAD\SCHEMA.CAD!Layer3")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this example as you see we are reaching one of the specific layers of the object. For use it like that you can write ("FILE_PATH!SPECIFICATION")&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Dim MyObject As Object
Set MyObject = GetObject("C:\DRAWINGS\SAMPLE.DRW", "FIGMENT.DRAWING")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In this last scenario, we are also specifying the object type as imaginary drawing viewer app Figment.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At the end there is no differences on performance as soon as we collect garbage. Specially for Marshall Object, its better to collect garbage at the end of the process.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope these answers will be helpful.&lt;/P&gt;&lt;P&gt;Devrim&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 10:04:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/getobject-quot-inventor-application-quot-vs-marshal/m-p/11935746#M24205</guid>
      <dc:creator>Dev_rim</dc:creator>
      <dc:date>2023-05-02T10:04:12Z</dc:date>
    </item>
    <item>
      <title>Re: GetObject(, "Inventor.Application") vs. Marshal.GetActiveObject("Inventor.Application")</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/getobject-quot-inventor-application-quot-vs-marshal/m-p/11935797#M24206</link>
      <description>&lt;P&gt;Hello Devrim,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your detailed information.&lt;/P&gt;&lt;P&gt;It gives me some more insight in this matter.&lt;/P&gt;</description>
      <pubDate>Tue, 02 May 2023 10:25:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/getobject-quot-inventor-application-quot-vs-marshal/m-p/11935797#M24206</guid>
      <dc:creator>Majjek</dc:creator>
      <dc:date>2023-05-02T10:25:41Z</dc:date>
    </item>
    <item>
      <title>Re: GetObject(, "Inventor.Application") vs. Marshal.GetActiveObject("Inventor.Application")</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/getobject-quot-inventor-application-quot-vs-marshal/m-p/13702635#M175834</link>
      <description>&lt;P&gt;Is this a valid workaround to use when ThisApplication isn't available, say in a rule using the straight VB code option in Inventor? It seems to work, but I have no way of knowing if it will always work.&lt;/P&gt;</description>
      <pubDate>Sun, 29 Jun 2025 02:49:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/getobject-quot-inventor-application-quot-vs-marshal/m-p/13702635#M175834</guid>
      <dc:creator>DonStauffer99</dc:creator>
      <dc:date>2025-06-29T02:49:00Z</dc:date>
    </item>
    <item>
      <title>Re: GetObject(, "Inventor.Application") vs. Marshal.GetActiveObject("Inventor.Application")</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/getobject-quot-inventor-application-quot-vs-marshal/m-p/13703586#M175837</link>
      <description>&lt;P&gt;Can you give an example where ThisApplication isn't working?&lt;/P&gt;&lt;P&gt;I'm not really familiar with the Straight VB Code option.&lt;/P&gt;&lt;P&gt;But if you're running code from within Inventor, ThisApplication should always be available as far as I know.&lt;/P&gt;&lt;P&gt;Or if working with Inventor Server/ Design Automation APS, use ThisServer.&lt;/P&gt;</description>
      <pubDate>Mon, 30 Jun 2025 06:05:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/getobject-quot-inventor-application-quot-vs-marshal/m-p/13703586#M175837</guid>
      <dc:creator>Majjek</dc:creator>
      <dc:date>2025-06-30T06:05:21Z</dc:date>
    </item>
    <item>
      <title>Re: GetObject(, "Inventor.Application") vs. Marshal.GetActiveObject("Inventor.Application")</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/getobject-quot-inventor-application-quot-vs-marshal/m-p/13703758#M175841</link>
      <description>&lt;P&gt;If you check Straight VB Code you don't have immediate access to the iLogic functions. Whenever I have a rule with Straight VB Code checked it's usually to be used by other rules. Here's an example of how you can still use the iLogic functions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Rule with Straight VB Code checked:&lt;/P&gt;&lt;LI-CODE lang="visual"&gt;Public Class Example
	Private Property ThisDoc As ICadDoc
	
	Public Sub New(ThisDoc As ICadDoc)
		Me.ThisDoc = ThisDoc
	End Sub
	
	Public Sub ShowFileName()
		' Show the FileName to show the iLogic functions work
		MsgBox(ThisDoc.FileName)
	End Sub
End Class&lt;/LI-CODE&gt;&lt;P&gt;Rule that uses the other rule:&lt;/P&gt;&lt;LI-CODE lang="visual"&gt;AddVbRule "Straight VB Rule"
Dim oExample As New Example(ThisDoc)
	oExample.ShowFileName&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 30 Jun 2025 08:19:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/getobject-quot-inventor-application-quot-vs-marshal/m-p/13703758#M175841</guid>
      <dc:creator>mathijs_stevensNMV4V</dc:creator>
      <dc:date>2025-06-30T08:19:43Z</dc:date>
    </item>
    <item>
      <title>Re: GetObject(, "Inventor.Application") vs. Marshal.GetActiveObject("Inventor.Application")</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/getobject-quot-inventor-application-quot-vs-marshal/m-p/13704254#M175851</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4999859"&gt;@DonStauffer99&lt;/a&gt;.&amp;nbsp; When your codes are in iLogic rules, you should pretty much never use GetObject or Marchal.GetActiveObject method to get the active/running instance of Inventor.&amp;nbsp; That should only be used from resources like an external EXE type program (or maybe an Inventor add-in, but I doubt even then).&amp;nbsp; As&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/15061099"&gt;@mathijs_stevensNMV4V&lt;/a&gt;&amp;nbsp;pointed out, there are ways to 'pass' that object reference to the externally referenced iLogic rule which is using that 'Straight VB Code' option, from the 'regular' rule that is referencing it.&lt;/P&gt;
&lt;P&gt;The two most common ways to do this are:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Your externally referenced code resource can have a 'Public Property' that the 'calling/referencing' rule can access, and set the value of.&lt;/LI&gt;
&lt;LI&gt;Your&amp;nbsp;externally referenced code resource can have methods which ask for those iLogic '&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=4ccb78b0-c35c-4d38-943a-854117da6ced" target="_blank" rel="noopener"&gt;Rule Objects&lt;/A&gt;' to be supplied to them, as an 'input parameter' when they are called by the 'regular' rule.
&lt;UL&gt;
&lt;LI&gt;The most common iLogic 'Rule Object' to supply to an external resource is the&amp;nbsp;&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=05d9c5e8-452e-3474-8a81-2006b7aa69ac" target="_blank" rel="noopener"&gt;ILowLevelSupport Interface&lt;/A&gt;, which is represented by the 'iLogicVb' rule object.&amp;nbsp; From that rule object, we can access many of the other uniquely iLogic objects.&amp;nbsp; Additionally, from that object, we an use its&amp;nbsp;&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=63b55983-c5ab-dbf4-5fc7-2abb6ada54c1" target="_blank" rel="noopener"&gt;CreateObjectProvider&lt;/A&gt;&amp;nbsp;method, which asks us for a Document object, then gives an &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=1edcd6a4-f9bb-3553-e8d8-0f3da13dc8a6" target="_blank" rel="noopener"&gt;IStandardObjectProvider Interface&lt;/A&gt;, which we can use to access most of the other 'Rule Objects'...and all the resulting rule objects will be associated with that supplied Document object.&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Mon, 30 Jun 2025 14:19:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/getobject-quot-inventor-application-quot-vs-marshal/m-p/13704254#M175851</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2025-06-30T14:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: GetObject(, "Inventor.Application") vs. Marshal.GetActiveObject("Inventor.Application")</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/getobject-quot-inventor-application-quot-vs-marshal/m-p/13705201#M175858</link>
      <description>&lt;P&gt;I pretty much knew that. I just was wondering because a line or two is a lot simpler, if it works.&lt;/P&gt;</description>
      <pubDate>Tue, 01 Jul 2025 05:18:32 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/getobject-quot-inventor-application-quot-vs-marshal/m-p/13705201#M175858</guid>
      <dc:creator>DonStauffer99</dc:creator>
      <dc:date>2025-07-01T05:18:32Z</dc:date>
    </item>
  </channel>
</rss>

