Solid Edge Draft Type Library
AddConnectedAnnotationsToSelectSet Method
Solid Edge Draft Type Library > DrawingView Object : AddConnectedAnnotationsToSelectSet Method
Description
Adds annotations to select set which are connected to drawing view.
Syntax
Visual Basic
Public Sub AddConnectedAnnotationsToSelectSet() 
Remarks
Function won’t clear the select set before adding the annotations to it.
Example
Imports System.Runtime.InteropServices

Public Class AddConnectedAnnotationstoSelectSet
    Private Sub btnAddConnectedAnnotationstoSS_Click(sender As System.Object, e As System.EventArgs) Handles btnAddConnectedAnnotationstoSS.Click
        Dim objApplication As SolidEdgeFramework.Application = Nothing
        Dim ObjDraftDocument As SolidEdgeDraft.DraftDocument = Nothing
        Dim objSheet As SolidEdgeDraft.Sheet = Nothing
        Dim objDrawingViews As SolidEdgeDraft.DrawingViews = Nothing
        Dim objDrawingView As SolidEdgeDraft.DrawingView = Nothing
        Dim objType As Type = Nothing
        Dim selset As SolidEdgeFramework.SelectSet = Nothing
        Dim i As Integer

        Try
            objApplication = Marshal.GetActiveObject("SolidEdge.Application")

            If objApplication Is Nothing Then
                ' Get the type from the Solid Edge ProgID
                objType = Type.GetTypeFromProgID("SolidEdge.Application")
                ' Start Solid Edge
                objApplication = Activator.CreateInstance(objType)
                ' Make Solid Edge visible
                objApplication.Visible = True
            End If

            ObjDraftDocument = objApplication.ActiveDocument

            'getting the Active Sheet object
            objSheet = ObjDraftDocument.ActiveSheet
            objDrawingViews = objSheet.DrawingViews
            objDrawingView = objDrawingViews(0)

            'Add dimensions to select set which are connected to Drawing View.
            objDrawingView.AddConnectedAnnotationsToSelectSet()
            selset = ObjDraftDocument.SelectSet
            i = selset.Count
            MsgBox(i.ToString)

        Catch ex As Exception
            MsgBox(ex.ToString)
        End Try
    End Sub
End Class
using System.Windows.Forms;
using System.Runtime.InteropServices;

public class AddConnectedAnnotationstoSelectSet
{
    private void btnAddConnectedAnnotationstoSS_Click(object sender, System.EventArgs e)
    {
        SolidEdgeFramework.Application objApplication = null;
        SolidEdgeDraft.DraftDocument ObjDraftDocument = null;
        SolidEdgeDraft.Sheet objSheet = null;
        SolidEdgeDraft.DrawingViews objDrawingViews = null;
        SolidEdgeDraft.DrawingView objDrawingView = null;
        Type objType = null;
        SolidEdgeFramework.SelectSet selset = null;
        int i = 0;

        try
        {
            objApplication = (SolidEdgeFramework.Application)Marshal.GetActiveObject("SolidEdge.Application");

            if (objApplication == null)
            {
                // Get the type from the Solid Edge ProgID
                objType = Type.GetTypeFromProgID("SolidEdge.Application");
                // Start Solid Edge
                objApplication = Activator.CreateInstance(objType);
                // Make Solid Edge visible
                objApplication.Visible = true;
            }

            ObjDraftDocument = objApplication.ActiveDocument;

            //getting the Active Sheet object
            objSheet = ObjDraftDocument.ActiveSheet;
            objDrawingViews = objSheet.DrawingViews;
            objDrawingView = objDrawingViews(0);

            //Add dimensions to select set which are connected to Drawing View.
            objDrawingView.AddConnectedAnnotationsToSelectSet();
            selset = ObjDraftDocument.SelectSet;
            i = selset.Count;
            MessageBox.Show(i.ToString());

        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.ToString());
        }
    }

    public AddConnectedAnnotationstoSelectSet()
    {
        SubscribeToEvents();
    }

    private bool EventsSubscribed = false;
    private void SubscribeToEvents()
    {
        if (EventsSubscribed)
            return;
        else
            EventsSubscribed = true;

        btnAddConnectedAnnotationstoSS.Click += btnAddConnectedAnnotationstoSS_Click;
    }

}
See Also

DrawingView Object  | DrawingView Members