Accessing Iproperties without opening part

Accessing Iproperties without opening part

Anonymous
Not applicable
480 Views
3 Replies
Message 1 of 4

Accessing Iproperties without opening part

Anonymous
Not applicable

I am trying to create an add-in to take an assembly and export a top level BOM to excel that includes some custom properties.  I am not really sure how to do this.

 

 

 

I have done the following

 

 

 

 

 

 

Occurrences = DocumentObject.ComponentDefinition.Occurrences

 

 

 

 

 

Dim oOcc As ComponentOccurrenceDim Occurrences As ComponentOccurrencesFor Each oOcc In Occurrences

 

MsgBox(oOcc.Name)

 

MsgBox(oOcc.ReferencedDocumentDescriptor.FullDocumentName)

 

 

 

 

Next

 

 

 

Which displays the name and full path of the files I want.  I am not sure how to get from her to accessing the custom iproperties without opening each part.  I don't want to open each component as it will use too much resources.

 

Any ideas on where to go from here would be greatly appreciated.

0 Likes
481 Views
3 Replies
Replies (3)
Message 2 of 4

jeff.pek
Community Manager
Community Manager

Hi -

 

Have you measured the memory impact of accessing the component's iProperties? I'd suspect that there isn't significant additional impact, given that these documents are open, anyway, by virtue of opening their containing assembly.

 

Jeff

0 Likes
Message 3 of 4

Anonymous
Not applicable
Thanks, had not thought of the fact they are already open in a sense. How would I go from the code above to opening parts to access the iproperties. I am at a bit of a loss how to go from an Occurance reference to opening the actual part or assembly.
0 Likes
Message 4 of 4

jeff.pek
Community Manager
Community Manager

Sure. You can access the iProperties of the component documents from their ComponentDefinitions, as in:

 

  Dim oPropertySets as PropertySets

  set oPropertySets = occ.ReferencedDocumentDescriptor.ReferencedDocument.PropertySets

 

You could also access it via its definition:

 

  occ.Definition.Document.PropertySets

 

I doubt that either one of these is any more or less efficient than the other.

 

One thing to watch out for: "missing" references, if they happen to be unresolved or unloaded (via an LOD).

 

Jeff

0 Likes