Showing results for 
Search instead for 
Did you mean: 


Valued Contributor
Valued Contributor



Why don't these return any values?


Dim HoleDataProperties_info As PropertyInfo() = GetType(SolidEdgePart.HoleData).GetProperties

Dim HoleDataMember_info As MemberInfo() = GetType(SolidEdgePart.HoleData).GetMembers


Posted by: Ian Burrows
Post date: 6/1/2012 4:10:22 AM


Re: HoleData

Valued Contributor
Valued Contributor

Very good question. I suspect it's related to caveats in .NET Reflection when applied to COM Interop objects. When you do GetType() on a Solid Edge API type, what you get is System.__ComObject, and from what experimenting I've done with it, System.Reflection tends to work better on native .NET types than COM types.


(By the way, make sure you have "Embed Interop Types" turned off for the Solid Edge Interop Assemblies if you're using .NET 4.0 in VS 2010.)


You should be able to use the Object Browser in VS to see the members and properties of the Solid Edge types. If that's not working, you may be missing a Reference.


Interestingly, it is actually possible to get Methods from a Com Interop object, provided its type is known at compile time. For example, to dump all the method names of a type, I was able to do (in C#, although it should work in VB .NET):

        static void DumpTypeInfo(Type t)
            foreach (MethodInfo m in t.GetMethods())
                Console.WriteLine("Method Name: {0}", m.Name);


You can call this with a known type, like so:



you should see

Method Name: ReplaceComponents
Method Name: get_HoleDataCollection
Method Name: GenerateWireHarnessReport
Method Name: get_AssemblyBodies
Method Name: CreateReference2
Method Name: UpdatePathfinder
Method Name: get_Zones
Method Name: UpdateStructureCache
Method Name: DeleteStructureCache
Method Name: get_FastenerSystems
Method Name: get_AssemblyGroups
Method Name: CheckInterference2
Method Name: TranslateMultipleOccurrences


By compile-time constant, I mean it won't work if you try to do mySolidEdgePart.GetType(), since that doesn't get evaluated until runtime.


Also, the MethodInfo class supports a ReturnType, which will allow you to see what you should get if you invoke a method (either with MethodInfo.Invoke or directly).


If you're interested in the details of how Interop Assemblies and RCWs work, check out and COM: The Complete Interoperability Guide.




Posted by: Jay Carlton
Post date: 6/21/2012 4:45:01 PM