×
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 help

journal help

journal help

(OP)
Could someone help me with a simple jourmal file.
I'd like to "up-rev" my drafting attribute "REV" with a simple push of a button.
I'd think its a simple "if - then" type thing, where if the value is ORIG then it changes to A, if A then B, if C then D, all the way to Z (omitting I,O,Q,U) , then, if Z then ORIG.
Any help appreciated, (or similar examples ripe for modifying)

RE: journal help

(OP)
someone......please......

I tried to use an existing journal, and add what seemed like something suitable, but it doesn't work
can someone get it to work?

Option Strict Off

Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.UI
Imports NXOpen.Utilities

Module report_value_of_specific_part_attribute

Dim s As Session = Session.GetSession()
Dim ufs As UFSession = UFSession.GetUFSession()
Dim lw As ListingWindow = s.ListingWindow()

Sub Main()

Dim dispPart As Part = s.Parts.Display()

Dim title As String = "REV"
Dim value As String = ""

find_part_attr_by_name(dispPart, title, value)


End Sub


Sub Main()



If value = "ORIG" Then

dispPart.SetAttributr("REV" , "A")

' else

end if

End Sub



End Module

RE: journal help

The following was coded for NX 8, it should work on other versions but there are no guarantees...

Below is one way to do what you ask.

CODE

Option Strict Off

Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.UI
Imports NXOpen.Utilities

Module report_value_of_specific_part_attribute

    Dim theSession As Session = Session.GetSession()
    Dim theUfSession As UFSession = UFSession.GetUFSession()
    Dim lw As ListingWindow = theSession.ListingWindow()

    Sub Main()

        lw.Open()
        Dim dispPart As Part = theSession.Parts.Display()

        Dim title As String = "REV"
        Dim value As String = ""
        Dim charVal As Integer

        Try
            value = dispPart.GetStringAttribute(title)
            value = value.ToUpper
        Catch ex As Exception
            lw.WriteLine("error: " & ex.Message)
            Exit Sub
        End Try

        If String.IsNullOrWhiteSpace(value) Then
            lw.WriteLine("revision attribute has no value")
            Exit Sub
        End If

        If value = "ORIG" Then

            Try
                dispPart.SetAttribute(title, "A")
            Catch ex As Exception
                lw.WriteLine("error: " & ex.Message)
            End Try

        Else

            If value.Length > 1 OrElse value < "A" OrElse value > "Z" Then
                lw.WriteLine("error: invalid revision value")
                Exit Sub
            End If

            Select Case value
                Case "H", "N", "P", "T"
                    'skip values of "I", "O", "Q", "U"
                    charVal = Asc(value) + 2
                    value = Chr(charVal)
                Case "Z"
                    lw.WriteLine("current revision is 'Z', modify code to allow for more revisions")
                    Exit Sub
                Case Else
                    charVal = Asc(value) + 1
                    value = Chr(charVal)
            End Select

            Try
                dispPart.SetAttribute(title, value)
                lw.WriteLine("new revision value is: " & value)
            Catch ex As Exception
                lw.WriteLine("error setting attribute: " & ex.Message)
            End Try

        End If

    End Sub


End Module 

www.nxjournaling.com

RE: journal help

(OP)
Cowski,
That works faultlessly in NX8 & NX9 thanks very much, just what I was after...

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