AnsweredAssumed Answered

Telling if a part is in an assembly

Question asked by Jordan Wigley on Dec 28, 2015
Latest reply on Dec 29, 2015 by Jordan Wigley

I have created a c# add in that adds properties to the custom and configuration specific properties for parts and assemblies. The point of this is to make sure that older documents as well as new all have the correct properties. The add in does this automatically by being called by the events FileNewNotify2 and FileOpenPostNotify. It is working as intended for parts, but not for assemblies. When an assembly is open, it also opens every part in the assembly causing the FileOpenPostNotify event to be fired. If my assembly has 100 parts in it, then my add in is being called 100 times for each part, when i only need it to be called for the assembly only.  I thought about traversing the FeatureManager tree to tell if it is an assembly, but from what i understand, when the part is opened, the part becomes the Active Doc, meaning the feature tree will show the part tree and not the Assembly tree.


My question is, is there a way for me to filter out the FileOpenPostNotify events for the parts in the assembly? Or, when the part is opened and it fires the event, can i tell that that part is in the assembly such as with a property, method, or feature tree, and therefore ignore the event call? Any advice would be greatly appreciated.