08-13-2018
05:39 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
08-13-2018
05:39 AM
From this page: http://help.autodesk.com/view/INVNTOR/2019/ENU/?guid=GUID-0123304B-EC33-4430-B4F1-CBF225CB5B8F
comes this example iLogic Rule (Adapted slightly, because at the page above the code was VBA):
Public Sub Main()
Dim oFile As File = ThisApplication.ActiveDocument.File
Call ProcessReferences(oFile)
End Sub
Private Sub ProcessReferences ( ByVal oFile As File )
Dim oFileDescriptor As FileDescriptor
For Each oFileDescriptor In oFile.ReferencedFileDescriptors
Debug.Print oFileDescriptor.FullFileName
If Not oFileDescriptor.ReferenceMissing Then
' Since the ReferenceMissing has returned False, the ReferencedFile will return a File
' Recurse unless this is a foreign file reference
If Not oFileDescriptor.ReferencedFileType = kForeignFileType Then
Call ProcessReferences(oFileDescriptor.ReferencedFile)
End If
End If
Next
End SubIn theory you could use the same approach with a simple modification, instead of just checking whether the "oFileDescriptor.ReferenceMissing", you could do this:
If oFileDescriptor.ReferencedDocument = nothing then 'delete oFileDescriptor End If
Of course, I have to ask why you want to delete unresolved references at all? Since in doing so, it will likely mean you'll end up with broken Assemblies and referencing drawings. Is it a dataset you inherited/don't have the time/money to fix?
----------------------------------------------------------------
Alex Fielder
Inventor Expert
https://github.com/alexfielder/
LinkedIn - Github Inventor Extension Server - Bonkers polygon iLogic thing
Top ten iLogic Tips - API Shortcut In Google Chrome - Assembly Extrusion Example
Alex Fielder
Inventor Expert
https://github.com/alexfielder/
LinkedIn - Github Inventor Extension Server - Bonkers polygon iLogic thing
Top ten iLogic Tips - API Shortcut In Google Chrome - Assembly Extrusion Example