Message 1 of 16
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I have been puzzling over something that I think I'm just doing wrong. What I want to do is simply delete all components in an assembly as fast as possible. The code below does work, but it is painfully slow on larger assemblies, as it deletes occurence one by one. I have not found a code solution to delete everything in one go. If anybody could help me with the lines, I would highly appreciate that.
Dim activeDoc As AssemblyDocument
activeDoc = ThisApplication.ActiveDocument
Dim assemblyDef As AssemblyComponentDefinition
assemblyDef = activeDoc.ComponentDefinition
' Disable graphics update to speed up the deletion process
ThisApplication.SilentOperation = True
' Iterate through all component occurrences and delete them
For Each compOcc As ComponentOccurrence In assemblyDef.Occurrences
compOcc.Delete
Next
' Enable graphics update after deletion
ThisApplication.SilentOperation = False
MsgBox("All components deleted successfully.", vbInformation, "iLogic")
Thanks,
/Rolf Even
Solved! Go to Solution.