Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
JhoelForshav
in reply to: sheetal.b

Hi @sheetal.b 

The trick to find all these occurrences is to use Occurrences.AllReferencedOccurrences in your main assembly.

All you need is a document-object for your 'Part 1'. Here's an example, assuming the subassembly occurrences are named 'Subassembly B:1', 'Subassembly B:2', 'Subassembly B:3' and so on. And the 'Part1'-occurrence in the subassembly is named 'Part1:1'.

 

Dim oAsm As AssemblyDocument = ThisDoc.Document
Dim oDef As AssemblyComponentDefinition = oAsm.ComponentDefinition
Dim subAsm As AssemblyDocument = oDef.Occurrences.ItemByName("Subassembly B:1").Definition.Document
Dim part1 As PartDocument = subAsm.ComponentDefinition.Occurrences.ItemByName("Part1:1").Definition.Document

For Each oOcc As ComponentOccurrence In oDef.Occurrences.AllReferencedOccurrences(part1)
	oOcc.Visible = False
Next