×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Journal to delete all file attribute properties

Journal to delete all file attribute properties

Journal to delete all file attribute properties

(OP)
Hi,
someone has a journal to delete all attribute properties in the file ?

Thank you...

Using NX 8 and TC9.1

RE: Journal to delete all file attribute properties

Cubalibre00,

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

HTH,

Joe

CODE --> .Net

' 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 

RE: Journal to delete all file attribute properties

(OP)
Hi Joe,
the journal works perfectly.

Thank you.

Thank you...

Using NX 8 and TC9.1

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources