NX Journal Determine if Teamcenter is running
2019/11/29 categories:NX Journal| tags:NX Journal|VB|
In NX, Teamcenter may be used or it may be used standalone. The code of the journal changes a little in each case, so I created a program to judge which one.
It seems that you can check if Teamcenter is running with “IsUgmanagerActive ()”.
theUfSession.UF.IsUgmanagerActive(IsTcEng)
You can convert the retrieved object to a string with “ToString”.
IsTcEng.ToString
VB Code
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UI
Imports NXOpen.Utilities
Module module1
Dim s As Session = Session.GetSession()
Sub Main()
Dim theUfSession As UFSession = UFSession.GetUFSession()
theUfSession.UF.IsUgmanagerActive(IsTcEng)
Echo("TC running? " & IsTcEng.ToString)
End Sub
Sub Echo(ByVal output As String)
s.ListingWindow.Open()
s.ListingWindow.WriteLine(output)
s.LogFile.WriteLine(output)
End Sub
Public Function GetUnloadOption(ByVal dummy As String) As Integer
Return Session.LibraryUnloadOption.Immediately
End Function
End Module