Imports System.IO
Imports System.Runtime.InteropServices
Public Class Form1
Private Sub SetCameraIsoView_Click(sender As Object, e As EventArgs) Handles SetCameraIsoView.Click
Dim objApplication As SolidEdgeFramework.Application = Nothing
Dim objAssemblyDocument As SolidEdgeAssembly.AssemblyDocument = Nothing
Dim SEInstallDir As DirectoryInfo
Dim objView As SolidEdgeFramework.View = Nothing
Dim objCurWindow As SolidEdgeFramework.Window
Try
objApplication = Marshal.GetActiveObject("SolidEdge.Application")
SEInstallDir = GetTrainingFolder()
objAssemblyDocument = objApplication.Documents.Open(SEInstallDir.FullName + "\carrier.asm")
objCurWindow = objApplication.ActiveWindow
objView = objCurWindow.View
objView.SetCamera(EyeX:=0.2, EyeY:=-0.13, EyeZ:=0.25, TargetX:=0.01, TargetY:=0.07, TargetZ:=0.05, UpX:=-0.58, UpY:=0.58, UpZ:=0.58, Perspective:=False, ScaleOrAngle:=1786.6)
Catch ex As Exception
MsgBox(ex.ToString)
Clipboard.SetText(ex.ToString)
End Try
End Sub
Private Sub SetCameraTopView_Click(sender As Object, e As EventArgs) Handles SetCameraTopView.Click
Dim objApplication As SolidEdgeFramework.Application = Nothing
Dim objView As SolidEdgeFramework.View = Nothing
Dim objCurWindow As SolidEdgeFramework.Window
Try
objApplication = Marshal.GetActiveObject("SolidEdge.Application")
objCurWindow = objApplication.ActiveWindow
objView = objCurWindow.View
objView.SetCamera(EyeX:=0.01, EyeY:=0.07, EyeZ:=0.27, TargetX:=0.01, TargetY:=0.07, TargetZ:=0.05, UpX:=0.0, UpY:=1.0, UpZ:=0.0, Perspective:=False, ScaleOrAngle:=4123.0)
Catch ex As Exception
MsgBox(ex.ToString)
Clipboard.SetText(ex.ToString)
End Try
End Sub
Function GetTrainingFolder() As DirectoryInfo
Dim objInstallData As SEInstallDataLib.SEInstallData = Nothing
Dim objInstallFolder As DirectoryInfo = Nothing
Dim objTrainingFolder As DirectoryInfo = Nothing
Try
objInstallData = New SEInstallDataLib.SEInstallData
objInstallFolder = New DirectoryInfo(objInstallData.GetInstalledPath())
objTrainingFolder = New DirectoryInfo(Path.Combine(objInstallFolder.Parent.FullName, "Training"))
Catch
Finally
If Not (objInstallData Is Nothing) Then
Marshal.FinalReleaseComObject(objInstallData)
objInstallData = Nothing
End If
End Try
Return objTrainingFolder
End Function
End Class