Showing results for 
Search instead for 
Did you mean: 

Teamcenter search for release status using NXOpen


Does anyone have experience with Teamcenter searches using NXOpen? What I am trying to do is look in Teamcenter for component revisions greater than the currently loaded revisions and get their release status. Currently I have a working method of doing this, but it is incredibly slow. What I do currently is ask if a certain item/rev/status exist and if not ask if the same item/rev exists at a different status. Status will always be one of three options(Production, Development, or Working) so I only have to ask twice. This process takes quite a while in an assembly with lots of components with several newer revisions though. Does anyone have a better suggestion?


    Function TCQuery(qItem As String, qRevision As String, qStatus As String) As Boolean        
        Dim entries() As String = {"item_id", "item_revision_id", ""}
        Dim values() As String = { qItem, qRevision, qStatus}
        Dim mySearch As PDM.PdmSearch = theSession.PdmSearchManager.NewPdmSearch()
        Dim mySearchResult As PDM.SearchResult = mySearch.Advanced(entries, values)
        Dim results() As String = mySearchResult.GetResultObjectNames()
        If results.Length <> 0
            Return True
            Return False
        End If
    End Function 

Re: Teamcenter search for release status using NXOpen

Valued Contributor
Valued Contributor

I have used Teamcenter revision rules to do something similar. We just have one release status to consider but you may be able to adapt the principle.


 Dim configRule As String = ""
        Dim revcount As Integer
        Dim revstr() As Tag = Nothing
        Dim revtag As Tag
        Dim parttag As Tag
        Dim latestRev As String
        Dim RevString As String

        ugmgr.AskConfigRule(configRule) ' capture current rev rule

        partNumber = workPart.GetUserAttributeAsString("DB_PART_NO", NXObject.AttributeType.String, 0)

        ugmgr.AskPartTag(partNumber, parttag)               'get tag of workpart
        ugmgr.ListPartRevisions(parttag, revcount, revstr)  'get count of revisions and tags of all revisions of parts

        ugmgr.AskPartRevisionId(revstr(revcount - 1), latestRev)    'gets string of revision of latest revision of part

        ugmgr.AskConfiguredRev(parttag, revtag)         'gets tag of revision meeting config rule
        ugmgr.AskPartRevisionId(revtag, RevString)      'gets string of revision from revision tag

        ugmgr.SetConfigRule(configRule) 'reset config rule



NX 12.0.0 TC11.3 VMU 11.3