Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi forum,
I am trying to collect all leaf occurrence inside a sub assembly by running the code on the referenced main assembly in the drawing view.
I've tried this code but it doesn't work. The reason it doesn't work is because I tried to typecast the component occurrence as a assembly document to get all leaf occurrence for the sub assembly
Here's my sample code :
AssemblyDocument AsmDoc=oview.ReferencedDocumentDescriptor.ReferencedDocument;
AssemblyComponentDefinition AsmCompDef = AsmDoc.ComponentDefinition;
ComponentOccurrences comocc = AsmCompDef.Occurrences;
ComponentOccurrence subocc = AsmCompDef.Occurrences[1];
AssemblyDocument assem = (AssemblyDocument)subocc;
AssemblyComponentDefinition asemdef = assem.ComponentDefinition;
ComponentOccurrences comoc = asemdef.Occurrences;
ComponentOccurrencesEnumerator leaf = comoc.AllLeafOccurrences;
Thanks,
Vidhuran
Solved! Go to Solution.