How to delete non-existing reference in Inventor DWG

How to delete non-existing reference in Inventor DWG

psaarloos
Collaborator Collaborator
2,203 Views
7 Replies
Message 1 of 8

How to delete non-existing reference in Inventor DWG

psaarloos
Collaborator
Collaborator

Hi,

 

I am having a problem with Inventor DWG files. After moving to Vault they seem to have a reference to a bitmap. I found an older posting in the Vault forums which highlights the issue.

 

https://forums.autodesk.com/t5/vault-general-discussion/fix-this-stupid-problem-reference-to-non-exi...

 

How can I remove this reference with the Inventor API? Using the AutoCAD API is not an option. Or is there any other fix possible?

 

Regards,

Pim

Regards,
Pim Saarloos
Product Manager
If my post answers your question, please click the "Accept as Solution" button. Kudos are much appreciated!
0 Likes
Accepted solutions (1)
2,204 Views
7 Replies
Replies (7)
Message 2 of 8

KarelC
Enthusiast
Enthusiast

Hi,
for this problem I use my inventor macro (seven years old). I tryed it only for idw. You can try it for dwg.

 

Sub Vymaz_ExtRef()
Dim oDoc As Inventor.Document
Dim ref As Inventor.ReferencedOLEFileDescriptor
Dim i As Integer
Dim names As String
'get external references:
Set oDoc = ThisApplication.ActiveDocument
names = ""
i = 1
For Each ref In oDoc.ReferencedOLEFileDescriptors
names = names & Chr(10) & Chr(13) & ref.DisplayName & " = " & ref.FullFileName
ref.Delete
i = i + 1
Next
MsgBox ("References:" & names)
End Sub

___________________________________________________________
Dell Precision T3620
Inventor 2019, Autocad Mechanical 2019, Vaul Basic 2019
0 Likes
Message 3 of 8

psaarloos
Collaborator
Collaborator

Hi,

 

Thanks for your reply. I looked at the ReferencedOLEFileDesscriptors, but the collection is empty. Still the reference is shown when I try to check in the file in to Vault. Because the file doesn't really exist it blocks me from checking in the file.

 

The weird thing is that the XRef Manager in AutoCAD is showing the bitmap as unreferenced and I can remove the reference there. Therefore I added a reference to the AutoCAD Type Library in Inventor VBA allowing me to set a reference to the ContainingDWGDocument property of the DrawingDocument. In the AcadDatabase however, I am unable to find the XRef.

 

Hope there it's possible to programmatically remove the reference, because I have a lot of drawing documents which needs to be checked in to Vault.

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

Curtis_Waguespack
Consultant
Consultant

 

Hi psaarloos,

 

I'm not sure about using the API, but aan you use this break link tool as shown in this image?

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

Autodesk Inventor Remove Image Link.PNG

EESignature

0 Likes
Message 5 of 8

psaarloos
Collaborator
Collaborator

Hi,

 

Thank you very much for your suggestion. Unfortunately the 'Links' command is disabled (probably because it can't find link). Another weird thing though; Design Assistent is complaining about the missing reference as well. As far as I know Design Assistent is using Inventor Apprentice, but can't find the reference to the bitmap in the ApprenticeServerDocument either...

 

NonExistingLink.png

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

psaarloos
Collaborator
Collaborator
Accepted solution

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!
Message 7 of 8

info
Explorer
Explorer

Hi,

 

Try to open dwg in Autocad type xref command and detach missing link.

 

Message 8 of 8

slmiller6Y5FH
Explorer
Explorer

Having the same issue. This worked.

0 Likes