Solid Edge Assembly Type Library
AddGround Method
Specifies the Occurrence object to which a ground constraint is to be applied.
Description
Places the referenced part in a grounded position in the assembly.
Syntax
Visual Basic
Public Function AddGround( _
   ByVal Occurrence As Occurrence _
) As Object
Parameters
Occurrence
Specifies the Occurrence object to which a ground constraint is to be applied.
Remarks
This method places the active occurrence in a position that is fixed in space (grounded) in the assembly, regardless of the occurrence's position to other assembly components. An occurrence that receives a grounded constraint results in no editable (positioning) relationships relative to other assembly components.
Example
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 occurrences As SolidEdgeAssembly.Occurrences = Nothing
            Dim occurrence As SolidEdgeAssembly.Occurrence = 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
                    occurrences = assemblyDocument.Occurrences
                    occurrence = occurrences.Item(1)
                    relations3d = assemblyDocument.Relations3d

                    relations3d.AddGround(occurrence)
                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.Occurrences occurrences = null;
            SolidEdgeAssembly.Occurrence occurrence = 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)
                {
                    occurrences = assemblyDocument.Occurrences;
                    occurrence = occurrences.Item(1);
                    relations3d = assemblyDocument.Relations3d;

                    relations3d.AddGround(occurrence);
                }
            }
            catch (System.Exception ex)
            {
                Console.WriteLine(ex);
            }
            finally
            {
                OleMessageFilter.Unregister();
            }
        }
    }
}
See Also

Relations3d Collection  | Relations3d Members