Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IRstuff on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

TeamCenter variables from within NX journal

Status
Not open for further replies.

ff1

Mechanical
Jun 30, 2014
3
Hi,

I am wring a Journal to export a full assembly structure from NX to Excel. I have used this post as a general structure for the code and it works very well. I'd now like to extend the Journal to include more data about each component. Some of the data I want is only available from TeamCenter. So the question is:

Does anyone know if there is a way to access a parts TeamCenter information from within NX?

Cheers,

Ian
 
Replies continue below

Recommended for you

Why dont you just export directly from Teamcenter structure manager into excel?

Khimani Mohiki
Design Engineer - Aston Martin
NX8.5
 
Ian

For single attributes you can use
Code:
lw.WriteLine(workPart.GetUserAttributeAsString("DB_PART_NO", NXObject.AttributeType.String, 0))
(will fail if attribute does not exist for part)

or to get all attributes use
Code:
   attrList = workPart.GetUserAttributes 
For Each attr As NXOpen.NXObject.AttributeInformation In attrList
        lw.WriteLine(attr.Title)
Next

Replace workpart with child in the reportComponentChildren sub.

Mike Hyde
NX8.5 with TC9.1
 
@KhimaniMohiki, The export from TeamCenter to Excel works fine. I'm just playing with Journals to see what can be achieved.

@MikeHyde, Thanks for that code. I'll try it out later.

Cheers,
Ian
 
@MikeHyde,

I tried your code and it works very well to return a limited set of attributes. I had to modify it slightly (I'm assuming that is because I am using NX7.5):
Code:
Dim attrList As Array = workPart.GetAttributeTitlesByType(NXObject.AttributeType.String)
For Each attr As NXOpen.NXObject.AttributeInformation In attrList
        lw.WriteLine(attr.Title & ": " & workPart.GetStringAttribute(attr.Title))
Next

Do you have any idea how I could get information like release status from TeamCenter?

Cheers,
Ian

 
Ian

The commands for reading attributes changed in NX8 and I have used the new ones in my code which is the reason why you had to modify them.

We have the release status in Teamcenter linked to an attribute in NX which is where I pick up the data. If it's not showing up when you list all the attributes then it may be possible to you revision rules to work out the release status. It's a messy way of doing it and is dependant on having the right rules set up. You may be able to adapt this code to get what you need.

Code:
Dim theUfSession As UFSession = UFSession.GetUFSession()
Dim ugmgr As UFUgmgr = theUfSession.Ugmgr
Dim part_number As String = ""
Dim revcount As Integer
Dim revstr() As Tag = Nothing
Dim revtag As Tag
Dim parttag As Tag
Dim configRule As String = ""
Dim RelStatus As String
Dim latestrev As String
Dim partRev As String

ugmgr.AskConfigRule(configRule) 'read current rule for reseting later
ugmgr.SetConfigRule("02-NX_Check_for_Latest_Frozen")

ugmgr.AskPartTag(partNumber, parttag)
ugmgr.ListPartRevisions(parttag, revcount, revstr)

ugmgr.AskPartRevisionId(revstr(revcount - 1), latestRev)

ugmgr.AskConfiguredRev(parttag, revtag)
ugmgr.AskPartRevisionId(revtag, RelStatus)

If latestRev = partRev Then
    'Part is at latest revision
End If
    
If latestRev = RelStatus Then
    ' frozen
Else
    ' not frozen
End If

ugmgr.SetConfigRule(configRule) 'reset back to original

Mike Hyde
NX8.5 with TC9.1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor