Solid Edge Assembly Type Library
Relations3d Collection
Members 
Description
A collection of relationships for parts and subassemblies that are contained in the referenced assembly.
Remarks
You can access the Relations3d object through either the AssemblyDocument object or the Occurrence object. You access a specific relationship through the Item method. The Relations3d collection that belongs to the AssemblyDocument object provides a way to access all relationships that are defined for a part. There are three types of 3-D relationships: AxialRelation3d, GroundRelation3d, and PlanarRelation3d, and you can determine the type by means of the Type property.
Example
Option Infer On

Imports System
Imports System.Runtime.InteropServices

Namespace Examples
    Friend Class Program
        <STAThread>
        Shared Sub Main(ByVal args() As String)
            Dim application As SolidEdgeFramework.Application = Nothing
            Dim assemblyDocument As SolidEdgeAssembly.AssemblyDocument = Nothing
            Dim relations3d As SolidEdgeAssembly.Relations3d = Nothing

            Try
                ' See "Handling 'Application is Busy' and 'Call was Rejected By Callee' errors" topic.
                OleMessageFilter.Register()

                ' Attempt to connect to a running instance of Solid Edge.
                application = DirectCast(Marshal.GetActiveObject("SolidEdge.Application"), SolidEdgeFramework.Application)
                assemblyDocument = TryCast(application.ActiveDocument, SolidEdgeAssembly.AssemblyDocument)

                If assemblyDocument IsNot Nothing Then
                    relations3d = assemblyDocument.Relations3d

                    For i As Integer = 1 To relations3d.Count
                        Dim relation3d = relations3d.Item(i)

                        ' Get the runtime time. Will always be System.__ComObject.
                        Dim runtimeType = relation3d.GetType()

                        ' Invoke the Type property of the COM object.
                        Dim objectType = CType(runtimeType.InvokeMember("Type", System.Reflection.BindingFlags.GetProperty, Nothing, relation3d, Nothing), SolidEdgeFramework.ObjectType)

                        ' Now that we know what kind of relation we're working with, we can cast accordingly.
                        Select Case objectType
                            Case SolidEdgeFramework.ObjectType.igAngularRelation3d
                                Dim angularRelation3d = CType(relation3d, SolidEdgeAssembly.AngularRelation3d)
                            Case SolidEdgeFramework.ObjectType.igAxialRelation3d
                                Dim axialRelation3d = CType(relation3d, SolidEdgeAssembly.AxialRelation3d)
                            Case SolidEdgeFramework.ObjectType.igGroundRelation3d
                                Dim groundRelation3d = CType(relation3d, SolidEdgeAssembly.GroundRelation3d)
                        End Select
                    Next i
                End If
            Catch ex As System.Exception
                Console.WriteLine(ex)
            Finally
                OleMessageFilter.Unregister()
            End Try
        End Sub
    End Class
End Namespace
using System;
using System.Runtime.InteropServices;

namespace Examples
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            SolidEdgeFramework.Application application = null;
            SolidEdgeAssembly.AssemblyDocument assemblyDocument = null;
            SolidEdgeAssembly.Relations3d relations3d = null;

            try
            {
                // See "Handling 'Application is Busy' and 'Call was Rejected By Callee' errors" topic.
                OleMessageFilter.Register();

                // Attempt to connect to a running instance of Solid Edge.
                application = (SolidEdgeFramework.Application)Marshal.GetActiveObject("SolidEdge.Application");
                assemblyDocument = application.ActiveDocument as SolidEdgeAssembly.AssemblyDocument;

                if (assemblyDocument != null)
                {
                    relations3d = assemblyDocument.Relations3d;

                    for (int i = 1; i <= relations3d.Count; i++)
                    {
                        var relation3d = relations3d.Item(i);

                        // Get the runtime time. Will always be System.__ComObject.
                        var runtimeType = relation3d.GetType();

                        // Invoke the Type property of the COM object.
                        var objectType = (SolidEdgeFramework.ObjectType)runtimeType.InvokeMember("Type", System.Reflection.BindingFlags.GetProperty, null, relation3d, null);

                        // Now that we know what kind of relation we're working with, we can cast accordingly.
                        switch (objectType)
                        {
                            case SolidEdgeFramework.ObjectType.igAngularRelation3d:
                                var angularRelation3d = (SolidEdgeAssembly.AngularRelation3d)relation3d;
                                break;
                            case SolidEdgeFramework.ObjectType.igAxialRelation3d:
                                var axialRelation3d = (SolidEdgeAssembly.AxialRelation3d)relation3d;
                                break;
                            case SolidEdgeFramework.ObjectType.igGroundRelation3d:
                                var groundRelation3d = (SolidEdgeAssembly.GroundRelation3d)relation3d;
                                break;
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex);
            }
            finally
            {
                OleMessageFilter.Unregister();
            }
        }
    }
}
See Also

Relations3d Members