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 all file attribute properties

Status
Not open for further replies.

cubalibre000

Mechanical
Joined
Jan 27, 2006
Messages
1,070
Location
IT
Hi,
someone has a journal to delete all attribute properties in the file ?

Thank you...

Using NX 8 and TC9.1
 
Cubalibre00,

This deletes all of the unlocked part attributes from the workpart.

HTH,

Joe

Code:
' Delete all unlocked part attributes from the workpart.
Option Strict On
Imports System
Imports NXOpen

Module NXJournal

    Dim theSession As Session = Session.GetSession()
    Dim theUI As UI = UI.GetUI()

Sub Main (ByVal args() As String)

    Dim workPart As Part = theSession.Parts.Work

    Dim atts() As NXObject.AttributeInformation = workPart.GetAttributeTitlesByType(NXObject.AttributeType.Any)
    Dim titles(atts.Length - 1) As String

    For ii As Integer = 0 To atts.Length - 1
        titles(ii) = atts(ii).Title
    Next

    Dim locked As Boolean = Nothing
    For ii As Integer = 0 To titles.Length - 1
        Try   
            locked = workPart.GetUserAttributeLock( titles(ii), NXObject.AttributeType.Any)
            Echo("")
            Echo(titles(ii) & " locked = " & locked.ToString)
            If locked = False   
                 workPart.DeleteUserAttribute(NXObject.AttributeType.Any, titles(ii), True, Update.Option.Now)
            End If
            Catch e As Exception
                theSession.ListingWindow.WriteLine("Error: " & e.Message)
        End Try
    Next

End Sub

    Sub Echo(ByVal output As String)
        theSession.ListingWindow.Open()
        theSession.ListingWindow.WriteLine(output)
        theSession.LogFile.WriteLine(output)
    End Sub
End Module
 
Hi Joe,
the journal works perfectly.

Thank you.

Thank you...

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

Part and Inventory Search

Sponsor

Back
Top