08-13-2018
05:59 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
08-13-2018
05:59 AM
Hi, this is created in vba, switch the commented line to actually delete the occurence
Sub DeleteUnresolvedFiles()
Dim oFile As Inventor.File
Set oFile = ThisApplication.ActiveDocument.File
Dim oDoc As AssemblyDocument
Set oDoc = ThisApplication.ActiveDocument
oDoc.Save
Dim oDocDef As AssemblyComponentDefinition
Set oDocDef = oDoc.ComponentDefinition
Call ProcessReferences(oFile, oDoc, oDocDef)
End Sub
Private Sub ProcessReferences(ByVal oFile As Inventor.File, oDoc As AssemblyDocument, oDocDef As ComponentDefinition)
Dim oFileDescriptor As FileDescriptor
For Each oFileDescriptor In oFile.ReferencedFileDescriptors
If Not oFileDescriptor.ReferenceMissing Then
If Not oFileDescriptor.ReferencedFileType = FileTypeEnum.kForeignFileType Then
Call ProcessReferences(oFileDescriptor.ReferencedFile, oDoc, oDocDef)
End If
Else
Dim oComp As ComponentOccurrence
For Each oComp In oDocDef.Occurrences
If oComp.ReferencedDocumentDescriptor.ReferencedFileDescriptor.FullFileName = oFileDescriptor.FullFileName Then
MsgBox (oFileDescriptor.FullFileName & vbCrLf & oFileDescriptor.RelativeFileName)
'oComp.Delete
End If
Next oComp
End If
Next
End Sub
If you think this answer fullfilled your needs, improved your knowledge or leads to a solution,
please feel free to "kudos"
please feel free to "kudos"