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
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
Khimani Mohiki
Design Engineer - Aston Martin
NX8.5
RE: TeamCenter variables from within NX journal
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) NextReplace workpart with child in the reportComponentChildren sub.
Mike Hyde
www.astonmartin.com
NX8.5 with TC9.1
RE: TeamCenter variables from within NX journal
@MikeHyde, Thanks for that code. I'll try it out later.
Cheers,
Ian
RE: TeamCenter variables from within NX journal
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)) NextDo you have any idea how I could get information like release status from TeamCenter?
Cheers,
Ian
RE: TeamCenter variables from within NX journal
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 originalMike Hyde
www.astonmartin.com
NX8.5 with TC9.1