MSPBenson,
I hope this will help.
'-----------------------Searching the bodies in the ref set ----------------
Public Function test() As Tag
Dim theSession As Session = Session.GetSession()
Dim theUFSession As UFSession = UFSession.GetUFSession()
Dim theUI As UI = UI.GetUI()
Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
'lw.Open()
Dim iBodies(0) As IBody
Dim num_ref_sets As Integer = 0
Dim ref_sets() As Tag = Nothing
Dim ref_set_name As String = ""
Dim origin(2) As Double
Dim matrix(8) As Double
Dim num_members As Integer
Dim members() As Tag = Nothing
Dim ref_set_name_to_edit As String
Dim seedString As String = "MODEL"
Dim bodies_found As Integer = 0
Dim test_ertek_1 As NXObject = Nothing
Dim test_ertek_2 As NXObject = Nothing
Dim t_body As NXObject = Nothing
'Dim t() As String
'ReDim t(0)
Dim i As Integer = 0
Dim j As Integer = 0
Dim ref_set As Tag = Nothing
Dim ret_count As Integer = 0
Dim mems_1 As Tag() = Nothing
Dim mems_2 As Tag() = Nothing
Dim v_ref_set As String
Dim NULLTAG As Tag = NXOpen.Tag.Null
Dim objectTag As Tag = NXOpen.Tag.Null
Dim vissza As Tag = Nothing
Try
theUFSession.Obj.CycleObjsInPart(workPart.Tag, NXOpen.UF.UFConstants.UF_reference_set_type, objectTag)
Do
Dim myrefset As ReferenceSet = Nothing
Dim myObject As NXObject = Nothing
myObject = NXObjectManager.Get(objectTag)
myrefset = CType(myObject, ReferenceSet)
'MsgBox("Name = " & myrefset.Name)
If myrefset.Name = "MODEL" Then
ref_set = myrefset.Tag
i = i + 1
theUFSession.Assem.AskRefSetMembers(ref_set, ret_count, mems_1)
'lw.WriteLine("---------" & mems_1(0))
End If
If myrefset.Name = "TRUE" Then
v_ref_set = myrefset.Name
ref_set = myrefset.Tag
j = j + 1
theUFSession.Assem.AskRefSetMembers(ref_set, ret_count, mems_2)
'lw.WriteLine("---------" & mems_2(0))
End If
theUFSession.Obj.CycleObjsInPart(workPart.Tag, NXOpen.UF.UFConstants.UF_reference_set_type, objectTag)
Loop While objectTag <> NULLTAG
If j = 1 Then
vissza = mems_2(0)
'MsgBox("Name = " & v_ref_set)
Else
vissza = mems_1(0)
End If
'test_ertek_1 = mems_1(0)
'lw.WriteLine("this comes back: " & vissza)
If i = 0 And j = 0 Then
Return vissza
Exit Function
End If
Catch ex As Exception
'MsgBox("Nincs Hasab attributum definialva!" & ex.GetBaseException.ToString() & vbCrLf)
'MsgBox("Nincs MODEL vagy TRUE refset!")
'workPart.SetAttribute(db_part_title, db_part_ertek)
End Try
Return vissza
End Function