Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to determine if any old 'In document'materials / styles exist?

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
230 Views, 3 Replies

How to determine if any old 'In document'materials / styles exist?

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.

 

3 REPLIES 3
Message 2 of 4
adam.nagy
in reply to: Anonymous

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,



Adam Nagy
Autodesk Platform Services
Message 3 of 4
Anonymous
in reply to: adam.nagy

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.

 

 

Message 4 of 4
adam.nagy
in reply to: Anonymous

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,



Adam Nagy
Autodesk Platform Services

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report