Clears the SelectSet, then adds all objects located within the specified rectangular fence to the SelectSet.
Imports System.Runtime.InteropServices Public Class DraftAutomation Private Sub btnFenceLocate_Click(sender As System.Object, e As System.EventArgs) Handles btnFenceLocate.Click Dim objApplication As SolidEdgeFramework.Application = Nothing Dim objDraftDoc As SolidEdgeDraft.DraftDocument = Nothing Dim objSheet As SolidEdgeDraft.Sheet = 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 objDraftDoc = objApplication.ActiveDocument objSheet = objDraftDoc.ActiveSheet Call objSheet.FenceLocate(0.0787, 0.3625, 0.4445, 0.089) SelSet = objDraftDoc.SelectSet i = SelSet.Count MsgBox(i.ToString) Catch ex As Exception MsgBox(ex.ToString) End Try End Sub End Class
using System; using System.Windows.Forms; using System.Runtime.InteropServices; public class DraftAutomation { private void btnFenceLocate_Click(object sender, System.EventArgs e) { SolidEdgeFramework.Application objApplication = null; SolidEdgeDraft.DraftDocument objDraftDoc = null; SolidEdgeDraft.Sheet objSheet = 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; } objDraftDoc = objApplication.ActiveDocument; objSheet = objDraftDoc.ActiveSheet; objSheet.FenceLocate(0.0787, 0.3625, 0.4445, 0.089); SelSet = objDraftDoc.SelectSet; i = SelSet.Count; MessageBox.Show(i.ToString()); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }