<?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: How to create a new assembly from ZeroDoc environment in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-create-a-new-assembly-from-zerodoc-environment/m-p/13747323#M176373</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/582192"&gt;@JBerns&lt;/a&gt;&amp;nbsp;, glad you got it figured out. And yeah, I think as yo u have it will work fine, but you could do it like this as well if it's preferred to use what you had in your original code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Curtis_Waguespack_2-1753917002439.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1557272i8770F400CBE1DBFA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Curtis_Waguespack_2-1753917002439.png" alt="Curtis_Waguespack_2-1753917002439.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 30 Jul 2025 23:11:13 GMT</pubDate>
    <dc:creator>Curtis_W</dc:creator>
    <dc:date>2025-07-30T23:11:13Z</dc:date>
    <item>
      <title>How to create a new assembly from ZeroDoc environment</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-create-a-new-assembly-from-zerodoc-environment/m-p/13746786#M176357</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create a new assembly from the ZeroDoc environment by means of an add-in.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the help of&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/105031"&gt;@Curtis_W&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5011186"&gt;@JelteDeJong&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3353726"&gt;@chandra&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5993932"&gt;@ryan.rittenhouse&lt;/a&gt;&amp;nbsp;, and others on the forum, I have a working add-in that adds the ribbon tab, panel, and button to the ZeroDoc ribbon.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JBerns_0-1753891341760.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1557181iA37204F41A2783A6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JBerns_0-1753891341760.png" alt="JBerns_0-1753891341760.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The challenge is getting the button to create the new assembly. &lt;STRONG&gt;I trust this is possible.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have searched many examples for code, but I have not been able to get the pieces of code to work.&lt;/P&gt;&lt;P&gt;Below is a portion of the code. The full VB file for the button is attached.&lt;/P&gt;&lt;LI-CODE lang="general"&gt;    'This is the code that does the real work when your command is executed.
    Sub Run_CommandCode()

        Debugger.Break()
        MsgBox("This command creates a new assembly from the ZeroDoc environment.")

        ' Get the Inventor Application object
        Dim oApp As Inventor.Application
        oApp = ThisApplication ' If running within Inventor (VBA macro)

        Dim invApp As Inventor.Application
        Try
           invApp = GetObject(, "Inventor.Application")
           '            invApp = ThisApplication ' If running within Inventor (VBA macro)
        Catch ex As Exception
           invApp = CreateObject("Inventor.Application")
           invApp.Visible = True
        End Try

        If invApp Is Nothing Then
           System.Windows.Forms.MessageBox.Show("Inventor is not running or could not be launched.", CStr(vbCritical))
           Exit Sub
        End If

        ' Define the document type as an Assembly Document
        Dim oDocType As Inventor.DocumentTypeEnum
        oDocType = Inventor.DocumentTypeEnum.kAssemblyDocumentObject

        ' Get the default template file for an assembly
        ' This will use the default template set in Inventor's options.
        Dim sTemplateFile As String
        sTemplateFile = invApp.FileManager.GetTemplateFile(oDocType)

        ' Create a new assembly document
        Dim oAsmDoc As Inventor.AssemblyDocument
        oAsmDoc = invApp.Documents.Add(oDocType, sTemplateFile, True) ' True makes it visible and active

    End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried code such as the following to get the Inventor Application:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;'Public g_Inventor As Inventor.Application = GetObject(, "Inventor.Application")
'Public Property g_Inventor As Inventor.Application
'Public g_Inventor As Inventor.Application = 'System.Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application")&lt;/LI-CODE&gt;&lt;P&gt;However, none of these lines get the Inventor Application.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to understand the button examples on these posts, but I can't convert C# to VB code.&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-programming-ilogic/getting-inventor-application-object-in-addins/m-p/12441588#M15531" target="_blank" rel="noopener"&gt;Getting inventor application object in addins&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/inventor-programming-ilogic/setting-up-api-in-visual-basic-using-c/m-p/12226076#M19307" target="_blank" rel="noopener"&gt;Setting up api in visual basic using c&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would welcome your suggestions to get the "new assembly" button code working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once this button is working, I plan to expand to a Windows User Form from which the user could select the assembly type to create. The selection will determine which assembly template to use when creating the new assembly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you for your time and attention. I look forward to your replies.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Jerry&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2025 16:14:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-create-a-new-assembly-from-zerodoc-environment/m-p/13746786#M176357</guid>
      <dc:creator>JBerns</dc:creator>
      <dc:date>2025-07-30T16:14:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new assembly from ZeroDoc environment</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-create-a-new-assembly-from-zerodoc-environment/m-p/13746833#M176360</link>
      <description>&lt;P&gt;Ironic - I find the solution after I post to the forum.&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":face_with_rolling_eyes:"&gt;🙄&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I discovered the &lt;EM&gt;StandardAddInServer.vb&lt;/EM&gt; file gets the Inventor application and stores it globally:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Public Module Globals

    ' Inventor application object.
    Public g_inventorApplication As Inventor.Application

    'Unique ID for this add-in.  
    Public Const g_simpleAddInClientID As String = "d49b875a-c5e2-46af-8a59-a071d61d5b72"
    Public Const g_addInClientID As String = "{" &amp;amp; g_simpleAddInClientID &amp;amp; "}"

&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just needed to reference the module name in the call to the object:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;        If Globals.g_inventorApplication Is Nothing Then
            System.Windows.Forms.MessageBox.Show("Inventor is not running or could not be launched.", CStr(vbCritical))
            Exit Sub
        End If

        ' Define the document type as an Assembly Document
        Dim oDocType As Inventor.DocumentTypeEnum
        oDocType = Inventor.DocumentTypeEnum.kAssemblyDocumentObject

        ' Get the default template file for an assembly
        ' This will use the default template set in Inventor's options.
        Dim sTemplateFile As String
        sTemplateFile = Globals.g_inventorApplication.FileManager.GetTemplateFile(oDocType)

        ' Create a new assembly document
        Dim oAsmDoc As Inventor.AssemblyDocument
        oAsmDoc = Globals.g_inventorApplication.Documents.Add(oDocType, sTemplateFile, True) ' True makes it visible and active&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is this best practice?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The button is working to create a new assembly from the ZeroDoc environment. Yeah!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope this can help others developing add-ins.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jerry&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2025 16:47:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-create-a-new-assembly-from-zerodoc-environment/m-p/13746833#M176360</guid>
      <dc:creator>JBerns</dc:creator>
      <dc:date>2025-07-30T16:47:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new assembly from ZeroDoc environment</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-create-a-new-assembly-from-zerodoc-environment/m-p/13747323#M176373</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/582192"&gt;@JBerns&lt;/a&gt;&amp;nbsp;, glad you got it figured out. And yeah, I think as yo u have it will work fine, but you could do it like this as well if it's preferred to use what you had in your original code.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Curtis_Waguespack_2-1753917002439.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1557272i8770F400CBE1DBFA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Curtis_Waguespack_2-1753917002439.png" alt="Curtis_Waguespack_2-1753917002439.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2025 23:11:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-create-a-new-assembly-from-zerodoc-environment/m-p/13747323#M176373</guid>
      <dc:creator>Curtis_W</dc:creator>
      <dc:date>2025-07-30T23:11:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new assembly from ZeroDoc environment</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-create-a-new-assembly-from-zerodoc-environment/m-p/13748710#M176393</link>
      <description>&lt;P&gt;Thanks, Curtis. That is easier to read.&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jul 2025 17:44:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-create-a-new-assembly-from-zerodoc-environment/m-p/13748710#M176393</guid>
      <dc:creator>JBerns</dc:creator>
      <dc:date>2025-07-31T17:44:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new assembly from ZeroDoc environment</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-create-a-new-assembly-from-zerodoc-environment/m-p/13750062#M176405</link>
      <description>&lt;P&gt;What is meant by "zero doc environment"?&lt;/P&gt;</description>
      <pubDate>Fri, 01 Aug 2025 14:27:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-create-a-new-assembly-from-zerodoc-environment/m-p/13750062#M176405</guid>
      <dc:creator>chris</dc:creator>
      <dc:date>2025-08-01T14:27:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a new assembly from ZeroDoc environment</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-create-a-new-assembly-from-zerodoc-environment/m-p/13750104#M176408</link>
      <description>&lt;P&gt;All Inventor documents (part, assembly, etc.) are closed. Optionally, Home screen could be open.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Aug 2025 14:50:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/how-to-create-a-new-assembly-from-zerodoc-environment/m-p/13750104#M176408</guid>
      <dc:creator>JBerns</dc:creator>
      <dc:date>2025-08-01T14:50:20Z</dc:date>
    </item>
  </channel>
</rss>

