10-19-2023
07:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
10-19-2023
07:14 AM
Hi, looks like you used wrong format of filename written into SaveAs function. It must be the full file name, including directory name, file name and extension, not just name of new assembly. I would recommend using Inventor.FileDialog to avoid such mistakes.
Dim oFileDlg As Inventor.FileDialog = Nothing
InventorVb.Application.CreateFileDialog(oFileDlg)
oFileDlg.CancelError = False
oFileDlg.MultiSelectEnabled = False
oFileDlg.Filter = "IAM file (*.iam)|*.iam"
oFileDlg.DialogTitle = "Save assembly as"
oFileDlg.InitialDirectory = IO.Path.GetDirectoryName(ThisApplication.ActiveDocument.FullFileName)
oFileDlg.ShowSave()
If oFileDlg.FileName <> "" Then
newFileName = oFileDlg.FileName
Else
Exit Sub
End If
Dim originalAssembly As AssemblyDocument
originalAssembly = ThisApplication.ActiveDocument
originalAssembly.SaveAs(newFileName, True)