Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
psaarloos
in reply to: psaarloos

Hi,

 

I've found a solution by adding a reference to the AutoCAD Type Library from within Inventor VBA and accessing the ContainingDWGDocument object. Hoipefully it help somebody else with the same issue.

 

Regards,

Pim

 

Dim odoc As DrawingDocument
Set odoc = ThisApplication.ActiveDocument

Dim acad As AcadDatabase
Set acad = odoc.ContainingDWGDocument

Dim removed As Boolean

On Error Resume Next

Dim acadObj As Object
For Each acadObj In acad.Dictionaries

    If TypeOf acadObj Is AcadDictionary Then
    
            If acadObj.Name = "ACAD_IMAGE_DICT" Then
                
                Dim acadImageDict As AcadDictionary
                Set acadImageDict = acadObj
                
                acadImageDict.Remove "<imagename>"
                removed = True
                 
                Exit For
                 
            End If
            
    End If
    
Next

On Error GoTo 0

If removed Then
    odoc.Update2
    odoc.Save
    ThisApplication.CommandManager.ControlDefinitions("VaultRefresh").Execute
End If

 

Regards,
Pim Saarloos
Product Manager
If my post answers your question, please click the "Accept as Solution" button. Kudos are much appreciated!