Traverse Assembly & Force all Files to Require Save

This widget could not be displayed.

Traverse Assembly & Force all Files to Require Save

Anonymous
Not applicable
I'm looking for code that will iterate through all the referenced files in an assembly and set a flag that will force the file to require a save.

The workflow (for the user will be)

1 - Open Assembly
2 - Run my Macro
3 - Click "Save" and ALL files will show as requiring a save.

Thanks,

Steve
0 Likes
Reply
330 Views
1 Reply
Reply (1)

Anonymous
Not applicable
This macro sets every part referenced by the active assembly to be "dirty"
which means Inventor thinks it has been modified since it was last opened
and needs to be saved.

Public Sub MakeAllDirty()
' Get the active assembly.
Dim oAsmDoc As AssemblyDocument
Set oAsmDoc = ThisApplication.ActiveDocument

' Iterate over all of the files referenced by the assembly.
Dim oRefDoc As Document
For Each oRefDoc In oAsmDoc.AllReferencedDocuments
' Set the document to be dirty.
oRefDoc.Dirty = True
Next
End Sub

--
Brian Ekins
Autodesk Inventor API
0 Likes