Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Journal to delete reference set 1

Status
Not open for further replies.

cubalibre000

Mechanical
Joined
Jan 27, 2006
Messages
1,070
Location
IT
Hi,
I've imported a step of a board and NX ha generated a reference set for each body imported 4200.
I want to delete all this reference set.
I don't know a OOTB command in NX, so a simple journal to clean those unwanted reference set.

Thank you,

Thank you...

Using NX 8 and TC9.1
 
Cubalibre00,

I can't take credit for this ...

Code:
'This journal cycles through a part and deletes all reference sets
'
'It assumes that you have already loaded the part.

Option Strict Off
Imports System
Imports System.Collections
Imports System.Windows.Forms
Imports NXOpen
Imports NXOpen.UF


Module Delete_All_RefSets_in_part
Sub Main
  Dim s As Session = Session.GetSession()
  Dim ufs As UFSession = UFSession.GetUFSession()
  
  Dim part As Part = s.Parts.Work

  Dim refset As Tag = Tag.Null
  Dim list As ArrayList = New ArrayList
''Dim compList = New List(of NXOpen.Assemblies.Component)()

  Do
     ufs.Obj.CycleObjsInPart(part.Tag,UFConstants.UF_reference_set_type,refset)
     If refset <> Tag.Null Then
        Dim name As String
        ufs.Obj.AskName(refset, name)
        If name <> "Empty" Then
           list.Add(refset)
        End If
     End If
  Loop While refset <> Tag.Null
  For Each refset In list
      ufs.Obj.DeleteObject(refset)
  Next
  MessageBox.Show("Deleted " & list.Count & " reference sets")

End Sub
End Module

HTH, Joe
 
Joe,
this journal works very well.
Deleted 4200 reference sets.

Thank you a lot.

Thank you...

Using NX 8 and TC9.1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top