Hallo @haraldberger ,
ich habe das mit folgendem Code bei mir realisiert.
Try
' Check active document type is a drawing document
If ThisApplication.ActiveDocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then Exit Sub
' Get active document
Dim oCurDoc As DrawingDocument = ThisApplication.ActiveDocument
' Sketch symbol document
Dim strPath As String = "Y:\Inventor_2021\Konfig\Vorlagen\DIN A4.idw"
' Check file exists
If System.IO.File.Exists(strPath) = False Then : MessageBox.Show("Datei nicht vorhanden","Update Skizzensymbole") : Exit Sub : End If
' Open file
Dim oOldDoc As DrawingDocument = ThisApplication.Documents.Open(strPath, False)
' Iterate through each symbol in the old document
For Each oSD As SketchedSymbolDefinition In oOldDoc.SketchedSymbolDefinitions
' Copy sketched symbols to new document and replace if existing
oSD.CopyTo(oCurDoc, True)
Next
' Close old document without save
oOldDoc.Close(True)
' Iterate through drawing resources browser nodes and collapse expanded ones
Dim oTopNode As BrowserNode = oCurDoc.BrowserPanes.ActivePane.TopNode ' Top node is drawing resources folder
For Each oNode As BrowserNode In oTopNode.BrowserNodes
If oNode.Visible = True And oNode.Expanded = True Then oNode.Expanded = False
Next
' Prompt for completion
MessageBox.Show("Aktualisierung fertig", "Update Skizzensymbole")
Catch Ex As Exception
MessageBox.Show(Ex.Message, "Update Skizzensymbole")
End Try
Muss aber zugeben das Dieser leider nicht von mir kommt. Ich habe das von hier...
https://forums.autodesk.com/t5/inventor-ilogic-api-vba-forum/import-sketched-symbols/m-p/8888169#M99...
Ich hoffe es hilft Dir etwas.