Gets the origin used when the draft file is placed as a embedded or linked symbol. This function will fail if no origin has been defined.
Imports System.Runtime.InteropServices Public Class DraftAutomation Private Sub btnSymbolFileOrigin_Click(sender As System.Object, e As System.EventArgs) Handles btnSymbolFileOrigin.Click Dim objApplication As SolidEdgeFramework.Application = Nothing Dim objDraftDoc As SolidEdgeDraft.DraftDocument = Nothing Dim xOrigin As Double Dim yOrigin As Double Dim objType As Type = Nothing Try 'Connect to a running instance of Solid Edge 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 'Get a reference to active draft document objDraftDoc = objApplication.ActiveDocument Call objDraftDoc.SetSymbolFileOrigin(0.12, 0.15) Call objDraftDoc.GetSymbolFileOrigin(xOrigin, yOrigin) 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 btnSymbolFileOrigin_Click(object sender, System.EventArgs e) { SolidEdgeFramework.Application objApplication = null; SolidEdgeDraft.DraftDocument objDraftDoc = null; double xOrigin = 0; double yOrigin = 0; Type objType = null; try { //Connect to a running instance of Solid Edge 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; } //Get a reference to active draft document objDraftDoc = objApplication.ActiveDocument; objDraftDoc.SetSymbolFileOrigin(0.12, 0.15); objDraftDoc.GetSymbolFileOrigin(xOrigin, yOrigin); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }