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 objPartDoc As SolidEdgePart.PartDocument = Nothing
Dim Obj1 As Object = Nothing
Try
' Get application
objApplication = Marshal.GetActiveObject("SolidEdge.Application")
If objApplication Is Nothing Then
objApplication = Activator.CreateInstance(Type.GetTypeFromProgID("SolidEdge.Application"))
objApplication.Visible = True
End If
If objPartDoc Is Nothing Then
objPartDoc = objPartDoc.Documents.Add("SolidEdge.PartDocument")
End If
' The methods take variants (objects) in order to allow for expansion in further projects but at this moment they will only take strings.
Obj1 = "TestView"
Dim window As SolidEdgeFramework.Window = objPartDoc.Windows.Item(1)
Dim view As SolidEdgeFramework.View
view = window.View
view.SaveCurrentView(Obj1)
view.ApplyNamedView(Obj1)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
End Class