Quantcast
Channel: NX Journaling - Journaling / NXOpen API
Viewing all articles
Browse latest Browse all 783

Visible layers in view

$
0
0

Hi, I have tried to make a journal to list all visible layers in a specific model view.
But I struggle to get the code correct. Could you help me?
I think GetVisibilitiesInView should be the method to use but obviously the syntax isn’t correct.

Option Strict Off
Imports System
Imports NXOpen
 
Module Module1
    Dim theSession As Session = Session.GetSession()
    Dim workPart As Part = theSession.Parts.Work
    Dim displayPart As Part = theSession.Parts.Display
    Dim lw As ListingWindow = theSession.ListingWindow
    Dim pmiNotesView As Integer
 
    Sub Main()
        Dim views As ModelingViewCollection
        Dim layersInView As New List(Of Layer.StateInfo)
        views = workPart.ModelingViews
        lw.Open()
 
        For Each view As ModelingView In views
            If view.Name <> "Front" Then
            Else
                lw.WriteLine("Front view exist")
                layersInView = theSession.Parts.Work.Layers.GetVisibilitiesInView(view)
                Exit For
            End If
        Next
 
        For Each temp As Layer.StateInfo In layersInView
            lw.WriteLine(temp.ToString)
        Next
 
    End Sub
 
    Public Function GetUnloadOption(ByVal dummy As String) As Integer
        'Unloads the image when the NX session terminates
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination
        '-------------------------------
    End Function
End Module

Viewing all articles
Browse latest Browse all 783

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>