Delete suppressed components in iLogic

If you would like to use iLogic to delete all suppressed components in an assembly you can use the code below. An example for using this would be if you are trying to export the BOM directly from the assembly environment, suppressed parts are included on export and there is no option to exclude, deleting the suppressed parts would give you the correct BOM for export.

resized-2

The code below could also be adapted to delete specific components from an assembly. A special thanks to Adam Nagy from the manufacturing dev blog who originally posted this code.

Sub Main()
  Dim doc As AssemblyDocument
  doc = ThisApplication.ActiveDocument

  Dim acd As AssemblyComponentDefinition
  acd = doc.ComponentDefinition

  Call DeleteSuppressedComponent(acd.Occurrences)
End Sub

Sub DeleteSuppressedComponent(occs As ComponentOccurrences)
  Dim occ As ComponentOccurrence
  For Each occ In occs
     If occ.Suppressed Then
         occ.Delete
     Else
         Call DeleteSuppressedComponent(occ.SubOccurrences)
     End If
   Next
End Sub

http://adndevblog.typepad.com/manufacturing/2015/02/delete-suppressed-components-in-ilogic.html

 If you have any enquiries, please send us a message:

Request More Information

3
Inventor 2015 Service Pack 2
Vault override user check out / Undo any user chec...

Related Posts

Autodesk reseller uk logo2
 
qms microsoft logo