Imports System.IO
Imports System.Runtime.InteropServices
Public Class GetCamera
Private Sub btnGetCamera_Click(sender As Object, e As EventArgs) Handles btnGetCamera.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
Dim EyeX, EyeY, EyeZ, TarX, TarY, TarZ, UpX, UpY, UpZ, ScaleAng As Double
Dim boolPersp As Boolean
Try
objApplication = Marshal.GetActiveObject("SolidEdge.Application")
SEInstallDir = GetTrainingFolder()
objAssemblyDocument = objApplication.Documents.Open(SEInstallDir.FullName + "\carrier.asm")
objCurWindow = objApplication.ActiveWindow
objView = objCurWindow.View
objView.GetCamera(EyeX, EyeY, EyeZ, TarX, TarY, TarZ, UpX, UpY, UpZ, boolPersp, ScaleAng)
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