<?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: Error when saving new part file in API in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-when-saving-new-part-file-in-api/m-p/11424889#M142736</link>
    <description>&lt;P&gt;First think I notice. How are you bringing in "g_inventorApplication" into the sub routine "CreateStandardPart"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have you set the inventor application object earlier?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also I don't think&amp;nbsp; "SaveAsFile" method exists, it&amp;nbsp;should be&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=Document_SaveAs" target="_blank" rel="noopener"&gt;Syntax&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Document.&lt;/SPAN&gt;&lt;STRONG&gt;SaveAs&lt;/STRONG&gt;&lt;SPAN&gt;(&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;I&gt;FileName&lt;/I&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;As String,&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;I&gt;SaveCopyAs&lt;/I&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;As Boolean )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;oDoc.SaveAs(oPath &amp;amp; loc)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 16 Sep 2022 00:34:20 GMT</pubDate>
    <dc:creator>A.Acheson</dc:creator>
    <dc:date>2022-09-16T00:34:20Z</dc:date>
    <item>
      <title>Error when saving new part file in API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-when-saving-new-part-file-in-api/m-p/11424628#M142728</link>
      <description>&lt;P&gt;Any ideas on fixing the error code im getting below when running this portion of code. Im trying to save as the part file i just created to a previously set directory.&amp;nbsp; Here is the line the error being created on and below that is the error im getting.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;oDoc.SaveFileAs(oPath &amp;amp; loc)&lt;/FONT&gt;&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;PRE&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;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is how I am calling out oPath:&lt;/P&gt;&lt;PRE&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;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2022 20:49:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-when-saving-new-part-file-in-api/m-p/11424628#M142728</guid>
      <dc:creator>cstephens58F4Q</dc:creator>
      <dc:date>2022-09-15T20:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: Error when saving new part file in API</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-when-saving-new-part-file-in-api/m-p/11424889#M142736</link>
      <description>&lt;P&gt;First think I notice. How are you bringing in "g_inventorApplication" into the sub routine "CreateStandardPart"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have you set the inventor application object earlier?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also I don't think&amp;nbsp; "SaveAsFile" method exists, it&amp;nbsp;should be&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=Document_SaveAs" target="_blank" rel="noopener"&gt;Syntax&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Document.&lt;/SPAN&gt;&lt;STRONG&gt;SaveAs&lt;/STRONG&gt;&lt;SPAN&gt;(&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;I&gt;FileName&lt;/I&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;As String,&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;&lt;I&gt;SaveCopyAs&lt;/I&gt;&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;As Boolean )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;oDoc.SaveAs(oPath &amp;amp; loc)&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Sep 2022 00:34:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/error-when-saving-new-part-file-in-api/m-p/11424889#M142736</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2022-09-16T00:34:20Z</dc:date>
    </item>
  </channel>
</rss>

