<?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: Issue creating a new part file in API in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-creating-a-new-part-file-in-api/m-p/11424301#M142720</link>
    <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10455814"&gt;@cstephens58F4Q&lt;/a&gt;.&amp;nbsp; It looks like you are missing the step where you set a value to your oProjectMgr variable.&amp;nbsp; Try this:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim oProjectMgr As DesignProjectManager = ThisApplication.DesignProjectManager&lt;/LI-CODE&gt;
&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN&gt;&lt;STRONG&gt; ACCEPT SOLUTION &lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;Or, if this helped you, please click (LIKE or KUDOS) &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@7401B55A0A518861312A0F851CD29320/emoticons/1f44d.png" alt=":thumbs_up:" title=":thumbs_up:" /&gt;.&lt;/P&gt;</description>
    <pubDate>Thu, 15 Sep 2022 18:00:15 GMT</pubDate>
    <dc:creator>WCrihfield</dc:creator>
    <dc:date>2022-09-15T18:00:15Z</dc:date>
    <item>
      <title>Issue creating a new part file in API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-creating-a-new-part-file-in-api/m-p/11424284#M142719</link>
      <description>&lt;P&gt;Im sure im overlooking something small but I am trying to get a part file created before I edit it with passed variables. The issue Im having is the line below is giving me the error "Error BC30469 Reference to a non-shared member requires an object reference. "&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim oDoc As PartDocument = &lt;FONT color="#FF0000"&gt;Documents.Add&lt;/FONT&gt;(DocumentTypeEnum.kPartDocumentObject, oTemplatesPath &amp;amp; "standard.ipt", False)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is this full portion of code:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Public Sub CreateStandardPart(x_length As Double, y_length As Double, z_length As Double, loc As String, oPath As String)


        'Create a new part with your desired part template
        Dim oProjectMgr As DesignProjectManager

        Dim oProject As DesignProject
        oProject = oProjectMgr.ActiveDesignProject

        Dim oTemplatesPath As String
        oTemplatesPath = oProject.TemplatesPath

        Dim oDoc As PartDocument = Documents.Add(DocumentTypeEnum.kPartDocumentObject, oTemplatesPath &amp;amp; "standard.ipt", False)

        oDoc.OpenFile()

        oDoc.SaveAs(loc &amp;amp; oPath, True)

        oDoc.Close(False)

    End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Let me know if you have any ideas. Thanks&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2022 17:51:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-creating-a-new-part-file-in-api/m-p/11424284#M142719</guid>
      <dc:creator>cstephens58F4Q</dc:creator>
      <dc:date>2022-09-15T17:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: Issue creating a new part file in API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-creating-a-new-part-file-in-api/m-p/11424301#M142720</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10455814"&gt;@cstephens58F4Q&lt;/a&gt;.&amp;nbsp; It looks like you are missing the step where you set a value to your oProjectMgr variable.&amp;nbsp; Try this:&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim oProjectMgr As DesignProjectManager = ThisApplication.DesignProjectManager&lt;/LI-CODE&gt;
&lt;P&gt;If this solved your problem, or answered your question, please click &lt;SPAN&gt;&lt;STRONG&gt; ACCEPT SOLUTION &lt;/STRONG&gt;&lt;/SPAN&gt;.&lt;BR /&gt;Or, if this helped you, please click (LIKE or KUDOS) &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@7401B55A0A518861312A0F851CD29320/emoticons/1f44d.png" alt=":thumbs_up:" title=":thumbs_up:" /&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2022 18:00:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-creating-a-new-part-file-in-api/m-p/11424301#M142720</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-09-15T18:00:15Z</dc:date>
    </item>
    <item>
      <title>Re: Issue creating a new part file in API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-creating-a-new-part-file-in-api/m-p/11424389#M142722</link>
      <description>&lt;P&gt;Thanks for the quick anwser I knew it was something simple I overlooked&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2022 18:41:27 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-creating-a-new-part-file-in-api/m-p/11424389#M142722</guid>
      <dc:creator>cstephens58F4Q</dc:creator>
      <dc:date>2022-09-15T18:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: Issue creating a new part file in API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-creating-a-new-part-file-in-api/m-p/11424605#M142727</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp;again on this section of code. Any reason you could see why I would be getting the attached error in this line of code:&amp;nbsp;oDoc.SaveFileAs(oPath &amp;amp; loc)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;error:&lt;/P&gt;&lt;P&gt;System.MissingMemberException: 'Public member 'SaveFileAs' on type '_DocumentClass' not found.'&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Issue area:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;    Public Sub CreateStandardPart(x_length As Double, y_length As Double, z_length As Double, loc As String, oPath As String)

        MsgBox("here with x length = " &amp;amp; x_length)


        'Create a new part with your desired part template
        'Dim oApp As Class = g_inventorApplication

        Dim oProjectMgr As DesignProjectManager = g_inventorApplication.DesignProjectManager

        Dim oProject As DesignProject
        oProject = oProjectMgr.ActiveDesignProject

        Dim oTemplatesPath As String
        oTemplatesPath = oProject.TemplatesPath

        Dim oDoc As PartDocument = g_inventorApplication.Documents.Add(DocumentTypeEnum.kPartDocumentObject, oTemplatesPath &amp;amp; "/English/OC Standard.ipt", True)

        oDoc.Activate()

        oDoc.SaveFileAs(oPath &amp;amp; loc)



    End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is how I am calling out oPath:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;SaveFileDialog1.Filter = "Assembly|*.iam"
        SaveFileDialog1.InitialDirectory = "C:\Temp"
        SaveFileDialog1.Title = "Save Melter Model"
        SaveFileDialog1.ShowDialog()

        If SaveFileDialog1.FileName IsNot "" Then

            SaveFileDialog1.OpenFile()

            oFile = SaveFileDialog1.FileName




        End If

        '''''
        ''Sets directory for future use
        '''''

        Dim oPath_ As String = oFile

        Dim oPat As Integer = InStrRev(oPath_, "\")

        Dim oPath As String = Mid(oPath_, 1, oPat)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2022 20:36:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-creating-a-new-part-file-in-api/m-p/11424605#M142727</guid>
      <dc:creator>cstephens58F4Q</dc:creator>
      <dc:date>2022-09-15T20:36:47Z</dc:date>
    </item>
    <item>
      <title>Re: Issue creating a new part file in API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-creating-a-new-part-file-in-api/m-p/11424632#M142729</link>
      <description>&lt;P&gt;Try this instead:&lt;BR /&gt;Inventor help link &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=PartDocument_SaveAs" target="_blank" rel="noopener"&gt;here.&lt;/A&gt;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;oDoc.SaveAs(oPath &amp;amp; loc, False)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2022 20:52:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-creating-a-new-part-file-in-api/m-p/11424632#M142729</guid>
      <dc:creator>tyler.warner</dc:creator>
      <dc:date>2022-09-15T20:52:30Z</dc:date>
    </item>
    <item>
      <title>Re: Issue creating a new part file in API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-creating-a-new-part-file-in-api/m-p/11424648#M142730</link>
      <description>&lt;P&gt;Yeah tried that same error&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2022 20:57:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-creating-a-new-part-file-in-api/m-p/11424648#M142730</guid>
      <dc:creator>cstephens58F4Q</dc:creator>
      <dc:date>2022-09-15T20:57:56Z</dc:date>
    </item>
    <item>
      <title>Re: Issue creating a new part file in API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-creating-a-new-part-file-in-api/m-p/11424787#M142735</link>
      <description>&lt;P&gt;Try this one &amp;amp; see if you're still getting the error. I changed the name &amp;amp; path variables slightly because I wasn't sure what was being entered into the Sub. This will overwrite the file in the specified folder if it already exists, so you'd have to write a check if you don't want that to be the case.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Public Sub CreateStandardPart(x_length As Double, y_length As Double, z_length As Double, loc As String, oPath As String)

    MsgBox("here with x length = " &amp;amp; x_length)

    Dim oFileName As String = "Save Melter Model.ipt"
    Dim oFilePath As String = "C:\Temp\"

    'Create a new part with your desired part template
    'Dim oApp As Class = g_inventorApplication

    Dim oProjectMgr As DesignProjectManager = g_inventorApplication.DesignProjectManager

    Dim oProject As DesignProject = oProjectMgr.ActiveDesignProject

    Dim oTemplatesPath As String = oProject.TemplatesPath

    Dim oDoc As PartDocument = g_inventorApplication.Documents.Add(DocumentTypeEnum.kPartDocumentObject, oTemplatesPath &amp;amp; "/English/OC Standard.ipt", True)

    Try
        oDoc.SaveAs(oFilePath + oFileName, False)

    Catch ex As Exception
        MsgBox("Copy didn't work!.... see error message below:" &amp;amp; vbNewLine &amp;amp; ex.Message)
        Exit Sub
    End Try

End Sub&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 12:36:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/issue-creating-a-new-part-file-in-api/m-p/11424787#M142735</guid>
      <dc:creator>tyler.warner</dc:creator>
      <dc:date>2022-09-16T12:36:15Z</dc:date>
    </item>
  </channel>
</rss>

