Cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate a custom error message

Creator
Creator

Hello,

 

I would like to ask for help with a problem I am trying to find a solution for. I have created a custom UDE. Everything works fine, I just want to add a custom error message in case a number entered in the UDE is out of range.

How could I do that, please?

I have tried this, but it gives me an error not related to my UDE.

 

if {$mom_additional_work_offset < "504"} {
    mom_display_message<offset_number_out_of_range><work_offset><E>[<button1>]}
if {$mom_additional_work_offset > "599"} {
    mom_display_message<offset_number_out_of_range><work_offset><E>[<button1>]}

 

I entered this code in CLSF.tcl file.

 

Thank you very much for your help, I appreciate it!

 

Alex

4 REPLIES 4

Re: How to generate a custom error message

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

It depends where you want to display the message

 

If you want to display to "Information" window, use

MOM_output_to_listing_device "Your text here"

If you want it in the "posted" code (in your case the CLS file), you can use

MOM_output_text "Your text"

or 
MOM_output_literal " your text"

If you were outputting actual posted code, you can use some variables to turn the output into a comment:

global mom_sys_control_out mom_sys_control_in

# WITH space after mom_sys_control_out
MOM_output_text "$mom_sys_control_out YOUR TEXT $mom_sys_control_in"

# WITHOUT space after mom_sys_control_out
MOM_output_text "${mom_sys_control_out}YOUR TEXT $mom_sys_control_in"

I'm guessing yours doesn't work as you need to CAPITALIZE the "MOM", plus you have some other formatting issues:

MOM_display_message "offset number out of range = $mom_additional_work_offset" "E" "OK"
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: How to generate a custom error message

Creator
Creator

Thank you Ken, it worked beautifully!

 

Alex

Re: How to generate a custom error message

Siemens Legend Siemens Legend
Siemens Legend
There are a number of errors in your code snippet:

1. When a number enclosed by "", such as "504", is treated as a string. It may not be used in the numerical comparison. The conditional statement would fail. You probably want to do "if { $mom_additional_work_offset < 504 } {...}" instead.

2. MOM_display_message should start with upper case MOM, and the rest of arguments should all be in quotes, as Ken_A described.

Re: How to generate a custom error message

Siemens Legend Siemens Legend
Siemens Legend
OPERATOR_MSG "<YOUR TEXT>"
will automatically take care of control in/out codes.

Learn online





Solution Information