Showing results for 
Search instead for 
Did you mean: 

[Post Builder] output UDE variable.

Solution Partner Builder Solution Partner Builder
Solution Partner Builder



I want to use UDE to output TEXT values.

The setting for UDE is as follows.


I want to output the value "OUTPUT_TEST".

I do not know what the variable is for output.


Re: [Post Builder] output UDE variable.

Valued Contributor
Valued Contributor

Hello! If your question is, how to address the variable in Post: The UDE-variable get the prefix mom_ in Post.

If your UDE-parameter is called info_type then the value of info_type you find in mom_info_type in Post.



Production: NX10.0.3, FBM | TcUA
Development: VB.NET, Tcl/Tk | Testing: NX12.0

Re: [Post Builder] output UDE variable.

Solution Partner Builder Solution Partner Builder
Solution Partner Builder



I try set in post builder.


global mom_info_type


MOM_output_literal "TYPE : $mom_info_type"


But, Error: can't read "mom_info_type": no such variable
    while executing.



Re: [Post Builder] output UDE variable.

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

Have you read and understood the NX documentation section about custom UDEs?

You will have to create an event handler called "MOM_{your event name}", where your parameter variables will be valid.

Your parameter variables will be named "mom_{your parameter name}".

If you use post builder to create the UDE, then a proc of the correct name should be created for you.

You must also pay special attention to where you add the UDE, which in turn specifies the point after when the proc will be executed to have the parameters available.

Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.1, FBM, MRL 3.1.7 | TcUA 10.1 MP7 Patch 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] output UDE variable.

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor


It looks like you want a bunch of parameters for the NC code "Header" (i.e. at the beginning of the program).


Note that the UDE data will NOT be available at the "Start of program" event! (there is no way to get a UDE to trigger that early).


Before trying to use the UDE variables, I would (in the UDE handler code) just output a line of text, something like:

MOM_output_text "My UDE happens here"

Then try adding it to the top level object in the "program order view" in the ONT (e.g. "NC_Program" object)


Then post.

Look at where it is output.

Now arrange your post so you delay output of anything you don't want before the header, to after that event (possibly first toolchange event?)

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] output UDE variable.

Gears Phenom Gears Phenom
Gears Phenom

Ken brings up a good point.  If you do want this to be at the start of the program you can achieve this using attributes assigned to the PROGRAM object. and a procedure in the post to read the adttributes


for example:


#  Add to start of program procedure for program header

   global mom_attr_PROGRAMVIEW_PROGRAM_REV
global mom_part_name mom_machine_name mom_definition_file_name
global mom_logname ptp_file_name file_name mom_part_material_description
global mom_date mom_time mom_event_handler_file_name
global mom_spindle_speed mom_output_file_full_name mom_group_name
global mom_sys_control_in mom_sys_control_out ci co

# call in the control in & out codes

set ci " "
set co " "
if {[info exists mom_sys_control_in] == 1 }  { set ci $mom_sys_control_in }
if {[info exists mom_sys_control_out] == 1 }  { set co $mom_sys_control_out }

# get some variables

set postname [lindex [split [file tail $mom_event_handler_file_name] .] 0 ]


MOM_output_literal ":$mom_attr_PROGRAMVIEW_PROGRAM_NUMBER"
MOM_output_literal "(DNCID$mom_attr_PROGRAMVIEW_PROGRAM_DNCID)"
MOM_output_literal "(PART NAME= $mom_attr_PROGRAMVIEW_PROGRAM_PART_NAME )"
MOM_output_literal "(PROGRAM REV= $mom_attr_PROGRAMVIEW_PROGRAM_REV )"
MOM_output_literal "$co PROGRAM DATE= [string range $mom_date 4 6]/[string range $mom_date 8 9]/[string range $mom_date 20 23] [string range $mom_date 11 15], [string toupper $mom_logname] $ci"
MOM_output_literal "()"
MOM_output_literal "$co PART FILE= [string toupper [file tail $mom_part_name]] $ci"
MOM_output_literal "$co OUTPUT FILE= [string toupper $mom_output_file_full_name] $ci"
MOM_output_literal "$co UGPOST NAME= [string toupper $postname] $ci"
MOM_output_literal "$co MACHINE TYPE= [string toupper HORIZONTAL ] $ci"
MOM_output_literal "()"
MOM_output_literal "()"


In the PROGRAM object set the attributes



John Joyce, Manufacturing Engineer,
Senior Aerospace
Statements and opinions are mine alone and do not reflect
the opinion of my employer or any other member of the human race

Learn online

Solution Information