Submitted by iamfallen on Mon, 08/19/2013 - 07:57
Forums:
Is there a way to get the status from the Assembly Navigator's Status column as a string in my journal? I would like to use this as a check in one of my scripts.
Is there a way to get the status from the Assembly Navigator's Status column as a string in my journal? I would like to use this as a check in one of my scripts.
Related Question to release status
Is there a way in a journal to test to see if a file is modified from its saved state. Theoretically I would like to offer choices to the user, but limit those options depending upon release status and if released, whether the drawing has been modified.
re: modified parts
Below is some code I wrote that will report the parts in session, the part modified status, part write access, and the part status. I'm running in native NX and do not have a TC installation to test on. The code works running under native NX, though I'm not entirely sure what the "part status" represents. The help file isn't clear on this point; I have a feeling it is a 'customer use' section of the file, I don't know if TC makes use of it or not. All my files report 0 (zero) for the file status.
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Module Module1
Sub Main()
Dim theSession As Session = Session.GetSession()
Dim theUFSession As UFSession = UFSession.GetUFSession
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()
Dim IsTcEng As Boolean = False
theUFSession.UF.IsUgmanagerActive(IsTcEng)
Dim tcNameSize = UFConstants.UF_UGMGR_NAME_SIZE
Dim tcPartNumber As String
lw.WriteLine("NX running under TC: " & IsTcEng.ToString)
lw.WriteLine("")
For Each myPart As Part In theSession.Parts
lw.WriteLine("part tag: " & myPart.Tag.ToString)
If Not IsTcEng Then
lw.WriteLine(myPart.FullPath)
Else
'I can't test this, might throw error?
theUFSession.Ugmgr.AskPartNumber(myPart.Tag, tcPartNumber)
lw.WriteLine(tcPartNumber)
End If
lw.WriteLine("is read only: " & myPart.IsReadOnly.ToString)
lw.WriteLine("is modified: " & theUFSession.Part.IsModified(myPart.Tag).ToString)
Dim myStatus As Integer
theUFSession.Part.AskStatus(myPart.Tag, myStatus)
lw.WriteLine("status: " & myStatus.ToString)
lw.WriteLine("")
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
re: Release status in a journal
Thank you for your help. The modified check was exactly what I wanted. The status responds 0 for all my tests though, so that isn't working as what I was hoping. What I am trying to do is get the value of a Teamcenter Workflow process applied on a part number. We have several such processes, for example Development and Production. Unfortunately, they do not show up as part attributes in my properties. NX is still accessing these status strings though as the File->Open dialog box shows this status and there is a Column in the Assembly Navigator that shows these strings. I just can't seem to track down where it is getting pulled from to display in these locations.
re: release status
Without TC to test with, I'm not in a good position to help on this one... Hopefully, GTAC's languages forum will come through for you.
I would like to ask you one thing, in what format was the TC "part number" written to the information window? Was it something expected/usable or was it something wonky?
When writing journals, I sometimes add a check for TC and write some info to the log file. Knowing what to expect from the code below would be helpful. Thanks.
theUFSession.Ugmgr.AskPartNumber(myPart.Tag, tcPartNumber)
lw.WriteLine(tcPartNumber)
re: release status
theUFSession.Ugmgr.AskPartNumber(myPart.Tag, tcPartNumber) gives an exception "Teamcenter Error: A deleted or invalid class id was used". I commented it out when I tested the code you supplied.
error
That's what I was afraid of, thanks for the info.