Hi,
the the VDS show after the save up, because he will set the requestet properties. I unload now first the DS , show me an Savedialog, and restart the addon. I dont know, how i get the Inventor standard save dialog. Her is my code:
Imports System.Windows.Forms
Dim unloadDS As Inventor.ControlDefinition = ThisApplication.CommandManager.ControlDefinitions.Item("VaultUnloadDataStandard")
unloadDS.Execute2(True)
Try
' Aktives Dokument holen
Dim doc As Inventor.Document = ThisDoc.Document
' Standardwerte vorbereiten
Dim filter As String = "Alle Dateien (*.*)|*.*"
Dim defaultExt As String = "ipt"
' Dokumenttyp auswerten
Select Case doc.DocumentType
Case Inventor.DocumentTypeEnum.kPartDocumentObject
filter = "Teil (*.ipt)|*.ipt|Alle Dateien (*.*)|*.*"
defaultExt = "ipt"
Case Inventor.DocumentTypeEnum.kAssemblyDocumentObject
filter = "Baugruppe (*.iam)|*.iam|Alle Dateien (*.*)|*.*"
defaultExt = "iam"
Case Inventor.DocumentTypeEnum.kDrawingDocumentObject
filter = "Zeichnung (*.idw)|*.idw|Zeichnung (*.dwg)|*.dwg|Alle Dateien (*.*)|*.*"
defaultExt = "idw"
Case Else
' Für Sonderfälle (Präsentation, etc.)
filter = "Alle Dateien (*.*)|*.*"
defaultExt = "ipt"
End Select
' SaveFileDialog erzeugen
Dim dlg As New SaveFileDialog()
dlg.Title = "Speichern unter"
dlg.Filter = filter
dlg.DefaultExt = defaultExt
dlg.FileName = IO.Path.GetFileName(doc.FullFileName)
dlg.AddExtension = True
dlg.OverwritePrompt = True
dlg.RestoreDirectory = True
' Dialog anzeigen
If dlg.ShowDialog() = DialogResult.OK Then
Dim targetPath As String = dlg.FileName
Try
' SaveAs mit Wechsel auf neuen Namen
doc.SaveAs(targetPath, True)
' MessageBox.Show("Datei gespeichert: " & targetPath, "Erfolg", MessageBoxButtons.OK, MessageBoxIcon.Information)
Catch ex As Exception
MessageBox.Show("Speichern fehlgeschlagen: " & ex.Message, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End If
Catch ex As Exception
MessageBox.Show("Fehler in der Regel: " & ex.Message, "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
Dim loadDS As Inventor.ControlDefinition = ThisApplication.CommandManager.ControlDefinitions.Item("VaultLoadDataStandard")
loadDS.Execute2(True)
--------------------------------------
Daniel Loew
Application Engineer
Inventor | AutoCAD / M | Vault | Fusion 360
Kudos are greatly appreciated. Everyone likes a thumbs up!
Please Accept As Solution if this resolves your issue, to help others benefit and locate it.