Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.Assemblies
Module Module2
Sub Main()
Dim theSession As Session = Session.GetSession()
If IsNothing(theSession.Parts.Work) Then
'active part required
Return
End If
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()
Const undoMarkName As String = "NXJ journal"
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)
lw.WriteLine("current arrangement: " & theSession.Parts.Work.ComponentAssembly.ActiveArrangement.Name)
lw.WriteLine("")
lw.WriteLine("available arrangements")
Dim changed As Boolean = False
For Each tempArr As Arrangement In theSession.Parts.Work.ComponentAssembly.Arrangements
lw.WriteLine(" " & tempArr.Name)
If Not changed Then
If Not tempArr.Equals(theSession.Parts.Work.ComponentAssembly.ActiveArrangement) Then
theSession.Parts.Work.ComponentAssembly.ActiveArrangement = tempArr
changed = True
End If
End If
Next
lw.WriteLine("")
lw.WriteLine("arrangement changed to: " & theSession.Parts.Work.ComponentAssembly.ActiveArrangement.Name)
lw.Close()
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
'Unloads the image when the NX session terminates
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
End Function
End Module