Gets the center point for detail view
Imports System.Runtime.InteropServices Public Class Form1 Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim objApplication As SolidEdgeFramework.Application = Nothing Dim objDraftDocument As SolidEdgeDraft.DraftDocument Dim objSheet As SolidEdgeDraft.Sheet = Nothing Dim objSheets As SolidEdgeDraft.SectionSheets = Nothing Dim objDrawingViews As SolidEdgeDraft.DrawingViews = Nothing Dim objDrawingView As SolidEdgeDraft.DrawingView = Nothing Dim objSections As SolidEdgeDraft.Sections = Nothing Dim objWkngSect As SolidEdgeDraft.Section = Nothing Dim dblX As Double = 0.0 Dim dblY As Double = 0.0 Try objApplication = Marshal.GetActiveObject("SolidEdge.Application") objDraftDocument = objApplication.ActiveDocument objSections = objDraftDocument.Sections objWkngSect = objSections.WorkingSection objSheets = objWkngSect.Sheets objSheet = objSheets.Item(1) objDrawingViews = objSheet.DrawingViews 'Here use appropriate view number objDrawingView = objDrawingViews.Item(3) objDrawingView.GetCenterForDetailView(dblX, dblY) objDrawingView.SetCenterForDetailView(1.5, 1.5) Catch ex As Exception MsgBox(ex.ToString) Finally End Try End Sub End Class
using System; using System.Windows.Forms; using System.Runtime.InteropServices; public class Form1 { private void Button1_Click(object sender, EventArgs e) { SolidEdgeFramework.Application objApplication = null; SolidEdgeDraft.DraftDocument objDraftDocument = null; SolidEdgeDraft.Sheet objSheet = null; SolidEdgeDraft.SectionSheets objSheets = null; SolidEdgeDraft.DrawingViews objDrawingViews = null; SolidEdgeDraft.DrawingView objDrawingView = null; SolidEdgeDraft.Sections objSections = null; SolidEdgeDraft.Section objWkngSect = null; double dblX = 0.0; double dblY = 0.0; try { objApplication = (SolidEdgeFramework.Application)Marshal.GetActiveObject("SolidEdge.Application"); objDraftDocument = objApplication.ActiveDocument; objSections = objDraftDocument.Sections; objWkngSect = objSections.WorkingSection; objSheets = objWkngSect.Sheets; objSheet = objSheets.Item(1); objDrawingViews = objSheet.DrawingViews; //Here use appropriate view number objDrawingView = objDrawingViews.Item(3); objDrawingView.GetCenterForDetailView(dblX, dblY); objDrawingView.SetCenterForDetailView(1.5, 1.5); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { } } public Form1() { SubscribeToEvents(); } private bool EventsSubscribed = false; private void SubscribeToEvents() { if (EventsSubscribed) return; else EventsSubscribed = true; Button1.Click += Button1_Click; Button1.Click += Button1_Click; } }