Message 1 of 2
Turning off visibility for all levels of components in Assembly

Not applicable
06-07-2014
08:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have an iLogic rule that will turn off the visibility of parts based on user input, but will only turn off the subassemblies/parts that are 1st level parts. I would like to have the rule turn off all instances of a specified part within an assembly. In other words, I need a way to modify the code shown below so it will recognize the instances of the components in the subassemblies as well.
' Define User input uPrefix = InputBox("What is Prefix?","Prefix","n/a") PreLen = Len(uPrefix) ' Define a variable to the open Assembly Components Dim oAsmCompDef As AssemblyComponentDefinition oAsmCompDef = ThisApplication.ActiveDocument.ComponentDefinition 'Iterate through all occurrences and turn off specified parts Dim oOccurrence As ComponentOccurrence For Each oOccurrence In oAsmCompDef.Occurrences If (Left(oOccurrence.Name,PreLen) = uPrefix) Then Component.Visible(oOccurrence.Name) = False End If Next
Thanks,
Daniel