×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

TeamCenter variables from within NX journal

TeamCenter variables from within NX journal

TeamCenter variables from within NX journal

(OP)
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

RE: TeamCenter variables from within NX journal

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

Khimani Mohiki
Design Engineer - Aston Martin
NX8.5

RE: TeamCenter variables from within NX journal

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
www.astonmartin.com
NX8.5 with TC9.1

RE: TeamCenter variables from within NX journal

(OP)
@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

RE: TeamCenter variables from within NX journal

(OP)
@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

RE: TeamCenter variables from within NX journal

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
www.astonmartin.com
NX8.5 with TC9.1

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources