SubOccurrences may return ComponentOccurrenceProxy objects

By Vladimir Ananyev

Q: Why do SubOccurrences return ComponentOccurrenceProxy objects when according to the documentation it should return ComponentOccurrence objects?

A: ComponentOccurrenceProxy is derived from ComponentOccurrence, as PartDocument is derived from Document. Therefore when SubOccurrences is said to return ComponentOccurrence, it means that it can also return object types derived from that – in this case ComponentOccurrenceProxy. It works the same way as e.g. Application.ActiveDocument, which is said to return Document, therefore it can return many other derived types like PartDocument, AssemblyDocument, etc.


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading