C# equivalent of VB.net code

 

Hello ,

there's a piece of code from the Solid Edge ST .Net Programmers Guide that I'm trying to implement in C# but without success; There seems to somethings missing in C# versus in VB.net

The code is on page 88 of that document (see below);

In particular I cannot determine the type of a Relation3d object in C#, which is easily and directly accessible in VB.net (i.e. objRelation3d.Type)

I've try to use the C# Object .GetType() method and all sorts of different approaches but none of them worked. Finally, I compiled the offending piece in VB.net and used it in C#;

Any idea how to implement the equivalent of objRelation3d.Type in C#?

Thanks

Chahé

--------- VB.net Code  --------

 

objAssembly = objApplication.ActiveDocument

' Get a reference to the relations 3d collection

objRelations3d = objAssembly.Relations3d ' Loop through the relations 3d objects

 ForEach objRelation3d In objRelations3d ' Determine the relation type

 

 

objAngularRelation3d = objRelation3d

 

objAxialRelation3d = objRelation3d

 

objGroundRelation3d = objRelation3d

 

objPointRelation3d = objRelation3d

 

objPlanarRelation3d = objRelation3d

 SelectCase objRelation3d.TypeCase SolidEdgeFramework.ObjectType.igAngularRelation3dCase SolidEdgeFramework.ObjectType.igAxialRelation3dCase SolidEdgeFramework.ObjectType.igGroundRelation3dCase SolidEdgeFramework.ObjectType.igPointRelation3dCase SolidEdgeFramework.ObjectType.igPlanarRelation3dEndSelect

 Next

 

Posted by: Chahe Adourian
Post date: 9/16/2008 1:43:59 PM

2 REPLIES

RE: C# equivalent of VB.net code

 

VB does a lot of "stuff" for you.  C# is a little more work.

 SolidEdgeAssembly.Relations3d relations3d = assemblyDocument.Relations3d;for (int i = 1; i

 

Posted by: Jason Newell
Post date: 9/17/2008 7:30:10 AM

RE: C# equivalent of VB.net code

 

Great!

 

Thanks Jason.

 

Posted by: Chahe Adourian
Post date: 9/18/2008 12:40:56 PM