×
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

UI styler and journal programing

UI styler and journal programing

UI styler and journal programing

(OP)
Hello,

I made a simple UI and want to control 2 parameters in the expression list with it.

Im not so familiar with journal more than recording and changing values so if someone could help it would be great!

When i do a recording changing the values it looks like this

' NX 9.0.0.19

Option Strict Off
Imports System
Imports NXOpen

Module NXJournal
Sub Main (ByVal args() As String)

Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work

Dim displayPart As Part = theSession.Parts.Display

' ----------------------------------------------
' Menu: Tools->Expressions...
' ----------------------------------------------
theSession.Preferences.Modeling.UpdatePending = False

Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Expression")

Dim expression1 As Expression = CType(workPart.Expressions.FindObject("Stalldon_Kort"), Expression)

Dim unit1 As Unit = CType(workPart.UnitCollection.FindObject("MilliMeter"), Unit)

workPart.Expressions.EditWithUnits(expression1, unit1, "100")

Dim expression2 As Expression = CType(workPart.Expressions.FindObject("Stalldon_lang"), Expression)

workPart.Expressions.EditWithUnits(expression2, unit1, "200")

theSession.Preferences.Modeling.UpdatePending = False

Dim nErrs1 As Integer
nErrs1 = theSession.UpdateManager.DoUpdate(markId1)

' ----------------------------------------------
' Menu: Tools->Journal->Stop Recording
' ----------------------------------------------

End Sub
End Module

RE: UI styler and journal programing

Hi.
In your VB code you will find a function called "update_cb" and it looks like this:

CODE --> VB

'------------------------------------------------------------------------------
'Callback Name: update_cb
'------------------------------------------------------------------------------
Public Function update_cb(ByVal block As NXOpen.BlockStyler.UIBlock) As Integer
    Try
    
        If block Is Lyft Then
        '---- Enter your code here -----
        
        ElseIf block Is Vipp Then
        '---- Enter your code here -----
        
        End If
    
    Catch ex As Exception
    
        '---- Enter your exception handling code here -----
        theUI.NXMessageBox.Show("Block Styler", NXMessageBox.DialogType.Error, ex.ToString)
    End Try
    update_cb = 0
End Function 
The way it works is when the user changes a value on your dialog the update_cb will be executed. Then the If statement will decide which block it was that was changed. You need to then supply the code to execute when that block was changed (where the ---- Enter your code here ---- comments are).
Using the code in your recorded journal between the "Menu: Tools->Expressions..." and "Menu: Tools->Journal->Stop Recording" as a template, create the code to update the required expressions when each block changes.

Graham Inchley, Systems Developer.
NX6, NX8.5(testing)
www.sandvik.com

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