Submitted by karthiksampath on Mon, 02/26/2018 - 07:44
Forums:
Under part Navigator -> Model view -> when i click work view and ask for information (Ctrl + i) then at the end of information. We can see "Perspective Distance as OFF" or "Perspective Distance value 505.5" . I wish to retrieve that Perspective distance value from NXOpen . Can someone , help me out. Waiting for your response.
Thank you.
re: perspective distance
The .AskPerspective method will tell you the view projection (parallel or perspective) and the perspective distance. The journal below reports the projection type and perspective distance of the current work view.
Option Strict Off
Imports System
Imports System.Collections.Generic
Imports NXOpen
Imports NXOpen.UF
Module Module89
Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession
Sub Main()
If IsNothing(theSession.Parts.BaseWork) Then
'active part required
Return
End If
Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()
Dim projType As Integer
Dim persDistance As Double
theUfSession.View.AskPerspective(theSession.Parts.Work.Views.WorkView.Tag, projType, persDistance)
'Parallel: projType = 1
'Perspective: projType = 2
If projType = 1 Then
lw.WriteLine("Projection type: parallel")
Else
lw.WriteLine("Projection type: perspective")
lw.WriteLine("Perspective distance: " & persDistance.ToString)
End If
lw.Close()
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
'Unloads the image immediately after execution within NX
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
End Function
End Module