Solved! Go to Solution.
Solved by cwhetten. Go to Solution.
Hi and welcome to the forum!
What have you tried so far?
Here is a basic chunk of code:
oComps = ThisDoc.Document.ComponentDefinition.Occurrences For Each oComp In oComps If Not oComp.Visible Then oComp.Delete End If Next
This will not work for invisible components that are in subassemblies--only components at the top level. You could copy this into each subassembly that needs it, or re-write the code to account for multiple levels of components, but this would become much more complicated.
Also, I'm not sure how well this works on components inside of a pattern, but I suspect it would have to be re-written to account for patterns.
Please click "Accept as Solution" if this response answers your question.
Cameron Whetten
Inventor 2014