"Find Components" Tool within the NX Open API

I am trying to see if there is a object in NX Open that mimics the functionality of the "Find Components" tool under assemblies.

What I have is a tool I created that parses the annotation table for component and material information. Well if the user has locked the table before deleting or suppressing components, the annotation table has a strikethrough or other options representing "Locked Deleted Rows". When I parse the table I have no indication that this is a deleted row in the program.

So now I would like to do a search on the component like "Find Components" which returns a '0' if it is deleted or suppressed. Can someone help me?

Given a row in a parts list, the .AskLdrMethod can indicate whether the given row is locked/deleted or not.

If you want to search through the components, I think you will have to do it manually; I don't know of any function dedicated to finding specific components. If you know the name of the component, the .CycleByName or .CycleByNameAndType might be helpful. If you are searching by some other attribute, you might consider pre-processing the assembly components by adding them to a dictionary to make the searches faster.

How do I get an instance of the Parts List from a work Part? It is not enabled to use Journal recording. I need to be able to see if the Parts List is out of date on another project but I cannot figure out how to get an instance of the Parts List in code.

Thomas

You can use the Plist.AskTags function to get the parts list(s) in the part. The code below gets the parts list and doubles the width of the first column to visually show that it got the reference to the list.

'NXJournaling.com
'July 30, 2015

'Edit the column width of a parts list column.

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module Module1

Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession()

Sub Main()

If IsNothing(theSession.Parts.BaseWork) Then
'active part required
Return
End If

Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()

Const undoMarkName As String = "edit parts list column width"
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)

Dim partsListTags() As Tag
Dim numPartsLists As Integer

theUfSession.Plist.AskTags(partsListTags, numPartsLists)

If numPartsLists = 0 Then
lw.WriteLine("No parts lists found in work part, exiting")
Return
End If

'change the width of the first column in each parts list found
For Each temp As Tag In partsListTags
Dim columnTag As Tag = Tag.Null
theUfSession.Tabnot.AskNthColumn(temp, 0, columnTag)

Dim columnWidth As Double
theUfSession.Tabnot.AskColumnWidth(columnTag, columnWidth)

theUfSession.Tabnot.SetColumnWidth(columnTag, columnWidth * 2)
Next

lw.Close()

End Sub

Public Function GetUnloadOption(ByVal dummy As String) As Integer

'Unloads the image immediately after execution within NX
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately

End Function

End Module

Would you know what function I can call to return whether a Parts List is out of date? I am having trouble journaling the Parts List item. It does not seem supported very well.

Thomas

A quick look at the documentation shows the Plist has an .Update and an .UpdateAllPlists method, but I don't see an obvious way to determine whether it is out of date or not.