Get COM object type name programmatically

By Adam Nagy

In different programming languages you can get the name of the object's type in different ways.

VBA, VB, VB.NET

Here you can use the TypeName built-in function and just pass in the object whose type name you want to know

C#

The object.GetType().Name property only return __ComObject for COM objects, and not the underlying type, so it is not that useful.
In C# you can either declare the ITypeInfo object and use that like in this article, or just take advantage of the VB.NET functionality by adding a reference to Microsoft.VisualBasic assembly and use Microsoft.VisualBasic.Information.TypeName() function.

TypeName

C++

Here you do need to use ITypeInfo interface as shown in this article.

Note: most Inventor object types also have a Type property that returns an ObjectTypeEnum which can also be useful when identifying object type.


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

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

Continue reading