- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Folks.
I'm working on a program to get into the iProperties of each Component within an Assembly.
The attached code can run through each occurrence in an assembly and return the "Name" displayed in the browser window, printed out as a list in the Immediate window of the VBA Editor.
I would like to return the value of the "Category" iProperty of each occurrence. I would assume that I need to access the part associated with each occurrence in order to get to the iProperties of that part.
After fighting it most of the day yesterday, I'm fed up and need some help.
How do I access the iProperties of an OCCURRENCE? I can get the iProperties from a PART, ASSEMBLY, or DRAWING easily, but OCCURRENCES are killing me... Should be a cakewalk for some of you more experienced people.
The attached code was inspired by/imitates/borrowed from a Brian Ekins post on Mod the Machine.
Sub Test() ' Get the active assembly. Dim oAsmDoc As AssemblyDocument Set oAsmDoc = ThisApplication.ActiveDocument ' Get the definition of the assembly. Dim oAsmCompDef As AssemblyComponentDefinition Set oAsmCompDef = oAsmDoc.ComponentDefinition ' Get the occurrences that represent this document. Dim oOccs As ComponentOccurrencesEnumerator Set oOccs = oAsmCompDef.Occurrences.AllLeafOccurrences ' Iterate through the Occurrences Dim oOcc As ComponentOccurrence For Each oOcc In oOccs Debug.Print oOcc.Name Next End Sub
Kyle Arnold
Inventor Certified Professional
"Try not. Do or do not, there is no try." -Yoda
Solved! Go to Solution.