How can find a way to determine if any legacy 'in document' materials / styles exist.
We want to purge those that exist.
I tried using sheetmetal style.StyleLocation but it does not report correctly that I can see.
In inventor editing the sheet metal style shows only two options. Local Style or All Styles.
Style.StyleLocation offers three options. Local, Library, or Both.
This is very confusing.
We just want to present engineering with a list of files that need to be purged of old local materials.
Currently we are using a style library on our LAN.
Hi,
You mean "legacy" from Inventor's point of view - i.e. materials before it moved to the new material library?
Could you provide a minimal, non-confidential document that has the legacy material you are trying to purge?
Cheers,
All of the legacy materials inside the files are identical as those in the Network library. The difference is they all reside inside the document.
So basically there is no way to tell based on the material name.
I don't think uploading a sample would help.
It would be nice to be able to differentiate between local and library materials not just for sheet metal but standard parts as well.
We have a massive set of historical Inventor documents.
Our folders containing Inventor documents per customer work order number about 12000 folders per year.
All of our jobs are custom creations. We throw nothing away.
Hi,
I'm still not sure what you mean by legacy.
My understanding is that whatever material you use in the document must reside inside the document. If a material is not used then you should be able to delete it.
Is this what you are looking for?
VBA code:
Sub PurgeDocumentMaterials() Dim doc As PartDocument Set doc = ThisApplication.ActiveDocument Dim docAssets As Assets Set docAssets = doc.Assets ' Keep running this until there is nothing to delete ' Probably because dependency some assets become ' unused when something else gets deleted Dim nothingToDelete As Boolean Do nothingToDelete = True Dim docAsset As Asset For Each docAsset In docAssets Debug.Print docAsset.name + "/" + docAsset.DisplayName If Not docAsset.IsUsed Then Debug.Print "-> Purging " + docAsset.name Call docAsset.Delete nothingToDelete = False End If Next Loop While Not nothingToDelete End Sub
Cheers,