Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
matthew.claxton
562 Views, 3 Replies

Clean-Up of Sheet Metal Styles / Unfold Methods / Materials

I am attempting to clean up existing sheet metal parts that contain bad data relating to sheet metal styles, materials, and unfold rules.  These are all embedded locally in each part, and am looking to purge / delete this outdated data.  I can find my way around the INV 2013 API with little issue, but am running into a few speed bumps.  Three main questions.

 

1) I am receiving errors when trying to run the following code.  Is the "UpdateFromGloal" method not avaliable for the sheet metal sytles object?  According to the API documentation, this should be supported (see attached snapshot).

 

Dim oPartDoc As PartDocument
Set oPartDoc = ThisApplication.ActiveDocument

Dim smDef As SheetMetalComponentDefinition
Set smDef = oPartDoc.ComponentDefinition

Dim oStyle As SheetMetalStyle

' Clean up old sheet metal styles from part
For Each oStyle In smDef.SheetMetalStyles
    If Not oStyle.StyleLocation = kLibraryStyleLocation Then
            oStyle.UpdateFromGlobal
    End If
Next

 

 

2) Same issue, but in attempting to use the "UpdateFromGlobal" method with the UnfoldMethod object.  Is this also not a valid method for this object? (see attached snapshot)

 

3) Deleting materials from being locally embedded in parts.  Receiving the same error as above, but this time it is shown when attempting to delete materials that are not in-use.  Again, API documentation shows this as a valid call.  (error shapshot attached)

 

Dim oPartDoc As PartDocument
Set oPartDoc = ThisApplication.ActiveDocument

' Define material
Dim oMaterial As material

' Clean up embedded materials in local part
For Each oMaterial In oPartDoc.Materials
    If Not oMaterial.InUse Then
        oMaterial.Delete
    End If
Next

 

 

Any insight would be much appreciated!