Grabbing Tags of a Reference Set

Hi Cowski,

Hope you're well! I've been working on a parts list exporter, and would like to export a list of parts filtered by a selected reference set.

I currently have the following function to pull the tags to be included in the parts list:

Public Function GetPartsListTag(ByRef partTag As NXOpen.Tag) As NXOpen.Tag
        Dim tempTag As NXOpen.Tag = NXOpen.Tag.Null
        Dim type As Integer
        Dim subtype As Integer
                    UFConstants.UF_tabular_note_type, tempTag)
            ufs.Obj.AskTypeAndSubtype(tempTag, type, subtype)
            If subtype = UFConstants.UF_parts_list_subtype Then
                    Return tempTag
                End If
        Loop Until tempTag = NXOpen.Tag.Null
    End Function

Is there a way to add something like "if tag is in the selected ref set, return the tempTag else next" ? I've been looking at AskMembersInReferenceSet() but haven't found a good way to use it.


It isn't clear to me exactly what you are trying to accomplish. Are you starting with an assembly file or a piece part file? Can you give an example of what you are starting with and what you want to get from it?

It sounds like you want to get a list of components from an assembly that are used in a particular reference set of the assembly; but the code you posted will only return a parts list tag. I'm not sure if you are after a parts list or the actual parts. Do parts lists work together with assembly reference sets? I don't think that I've ever tried to tie the 2 together...

Sure! So I have a assembly file with multiple components for the drawing. However in this assembly file are the components for two configurations with a difference of a single component. Configuration 1 uses component A, and Configuration 2 uses component B. The two reference sets specify the differences between these two configurations, and specifies the differentiating component.

I was hoping there would be way to add a filter on these ref sets, and then return a parts list tag only for these objects; doesn't seem to be the case!

In the end I want to be able to generate a parts list with just the components selected in a specified ref set.

Let me know if that doesn't make sense!


Ok, I think that I understand what you are after now.

Is there a process that you are currently following in interactive NX to generate this parts list? It's been a while since I've dealt with parts lists, I don't remember if they directly interact with reference sets. If they do, we can follow the same sequence of commands that you use in interactive NX. If they do not, we might be able to query the reference set and modify the parts list (delete rows) accordingly (though the results will not be associative to the reference set contents).

I wrote up something a while back on how I created a parts list:

It's what I'm using for this project; the UFPlist class/plist property


Do you currently have a process to get what you want by using the commands in interactive NX?

I've tried hiding/disabling with no avail. Deleting the components not part of the ref set before generating a parts list did work however... but I was hoping such a method could be averted.

I'm pretty sure that you can delete the rows of the parts list that you don't want to see/use. However, I'm not sure what the behavior is when the drawing/parts list is later updated. I don't know if the rows will re-appear or stay deleted on update...

One approach could be to get the components in the desired reference set and compare those components to the parts list; delete the rows of the parts list that you don't have a component for.

I'll try out your second suggestion; I'll let you know how it goes. Thanks for the help!