09-15-2022
01:49 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
09-15-2022
01:49 PM
Error when saving new part file in API
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. Here is the line the error being created on and below that is the error im getting.
oDoc.SaveFileAs(oPath & loc)
error:
System.MissingMemberException: 'Public member 'SaveFileAs' on type '_DocumentClass' not found.'
Issue area:
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 = " & 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 & "/English/OC Standard.ipt", True)
oDoc.Activate()
oDoc.SaveFileAs(oPath & loc)
End Sub
Here is how I am calling out oPath:
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)