Cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

post builder

Creator
Creator

Is there a way to have a dialogue box pop up when posting a program to ask u for certain variable u may wanna change... seen boxes like this for gauge lengths and would like to apply it to accommodate different programmers

16 REPLIES

Re: post builder

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom
I know two ways. First is a using tk package. Second - nxopen application.

Re: post builder

Legend
Legend

For an simple question you can use the command MOM_display_message.

 

Usage:

MOM_display_message <message> <title> <type> [<button1>][<button2>][<button3>]

 

Description:

Displays a message dialog box during NX/Post. <type> is the message box style of I | E | W | Q, where I is info, E is error, W is warning, and Q is question. Button labels are optional, up to 3 labels can be specified. Command returns the index of the button (1, 2, or 3) that the user clicks.

Re: post builder

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom
Can you input any values for variable with MOM_display_message?

Re: post builder

Siemens Phenom Siemens Phenom
Siemens Phenom
Hi
I haven’t tried that variable. The others I have tried don’t have any impact. Even testing if the variables have any info ie. if (info exists variable name )(do something )
Struggling with this local return.
Uplevel #0 etc. no change.
Thanks
Paul

Re: post builder

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

I don't think you can have the user input arbitrary data using MOM_display_message.  You can "on-the-fly" change the 3 options to whatever you want.

(you can present them with 100 MOM_display_message calls with different values, but I'm guessing the user won't be happy ;-)

 

If you look in%UGII_BASE_DIR%\POSTBUILD\pblib\custom_command\pb_cmd_ugwish_win64.tcl

you will see an example of the CORRECT way to display a TK dialog (and NOT lock up NX).

Extrapolate to however complex a TK dialog you want.  If you don't want to write API, that is your best bet.

You may want to write the value returned to an attribute in the part, so next time it is posted, you can read the attribute & use that as the default value for the dialog.

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP16/TC11.2
I'd rather be e-steamed than e-diseaseled


Re: post builder

Creator
Creator

I have been trying to come up with a tk program to ask weather to tape break or not.  I have the post working where it splits the programs up or doesnt by using var tape_break_switch and setting to ON or OFF...  Can't figure out what is needed to get the "set tape_break_switch ON" command to work in the tk program.

 

i have in my post at the start of program:

 

global tape_break_switch

set cam_aux_dir [MOM_ask_env_var UGII_CAM_AUXILIARY_DIR]
set cam_shopdoc_dir [MOM_ask_env_var UGII_CAM_SHOP_DOC_DIR]
set ug_wish "ugwish.exe"
set title "tape_break"
set msg "yesno"

exec ${cam_aux_dir}$ug_wish ${cam_shopdoc_dir}post_test.tcl $title $msg

 

 

then my tk program: 

 

global tape_break_switch

 

 

 

set answer [tk_messageBox -title NX_11_Postprocessors -message "Tape Break?" -type yesno -icon question]
switch -- $answer {
yes exit
no exit

}

if { [string match "yes" $answer] } {
set tape_break_switch OFF
} else {
set tape_break_switch ON

 }

 

 

any suggestions would be helpful... never wrote a tk program before and just cant figure out how to set the var for the post in the program...

 

thanks

 

Re: post builder

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

exit will immediately return to the calling program, so your code to set the variable is never reached.

exit returns zero if no parameter is used, so I suggest you use the exit code to transfer the information back to the post-processor.

So for yes I would return 1 and check that in the post-processor.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.2, FBM, MRL 3.1.7 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 11.4
Development: C (ITK), .NET, Tcl/Tk Testing: NX12.0 | AWC 3.4 Preparing: NX12.0

Employees of the customers, together we are strong Smiley Wink
How to Get the Most from Your Signature in the Community
NX Customization - Best Practice Guide

Re: post builder

Solution Partner Valued Contributor Solution Partner Valued Contributor
Solution Partner Valued Contributor

Try the following:

 

First, you should consider using the PB internal "EXEC" command, rather than the intrinsic tcl "exec" command as there have been issues with NX hanging when using "exec".

 

Anyhow, here's what to put as your custon command in your post (my changes are in bold text):

 

global tape_break_switch
set cam_aux_dir [MOM_ask_env_var UGII_CAM_AUXILIARY_DIR]
set cam_shopdoc_dir [MOM_ask_env_var UGII_CAM_SHOP_DOC_DIR]
set ug_wish "ugwish.exe"
set title "tape_break"
set msg "yesno"

set returned [ EXEC "${cam_aux_dir}$ug_wish ${cam_shopdoc_dir}post_test.tcl $title $msg" ]

set answer [lindex $returned 0]

 

# Just a test output so that you can see that this is actually working...
MOM_output_literal "=====================> Answer = $answer"

if { [string match "yes" $answer] } {
set tape_break_switch ON
} else {
set tape_break_switch OFF
}

 

 

Next, for your custom post_test.tcl TK script - just use this:

 

set answer [tk_messageBox -title NX_11_Postprocessors -message "Tape Break?" -type yesno -icon question]

set l_return [ list $answer ]
puts $l_return

exit

 

Hope this helps.

 

Regards,

~U

Re: post builder

Creator
Creator

I copied and pasted both parts but for some reason it didnt work.  Post Faults out with error message.  Gonna take me a while studing those commands to try and figure out what for sure there even doing. lol... You said "PB internal "EXEC" command" should be used instead.  Not sure what that means or how to go about learning it.  I would like to do it the better way but am limited with my experince.  How would I go about getting to do it the other way?

Highlighted

post builder

Creator
Creator

Is there a way to have a dialogue box pop up when posting a program to ask u for certain variable u may wanna change... seen boxes like this for gauge lengths and would like to apply it to accommodate different programmers

NX CAM Postprocessor Group
NX CAM Postprocessor Group

Members (149)