Showing results for 
Search instead for 
Did you mean: 

User Defined Events

Siemens Genius Siemens Genius
Siemens Genius


This is video 16 of 16 in a series about how to create and edit postprocessors with NX Post Builder.


(view in My Videos)

Tech Tip by Jim Wright, Siemens PLM Software



The NX Post Builder application is extremely flexible and powerful, and can provide useful benefits. This online Tech Tip series is intended as an overview of the post builder and postprocessing workflows in NX CAM.


Much of the content discussed in these videos is fairly advanced and while potentially valuable to everyone, it may be more useful to those of you with post processor experience. To get the most from this series, we suggest that you watch the videos in sequence. You can find the other videos in the Postprocessor section of this Tech Tip Knowledge Base.


Videos in this series:

  1. What is a postprocessor?
  2. Create and test a 3-axis postprocessor
  3. Modifying tool change and work offset output
  4. Changing G-codes in Post Builder
  5. Tool Command Language (TCL) - Part 1
  6. Tool Command Language (TCL) - Part 2
  7. Tool Command Language (TCL) - Part 3
  8. Tool Command Language (TCL) - Part 4: More on IF statement
  9. Tool Command Language (TCL) - Part 5: Source and Switch
  10. Using the Custom Command Library
  11. Create a lathe postprocessor
  12. Create a mill-turn postprocessor
  13. Create a 4-axis postprocessor
  14. Create a 5-axis postprocessor
  15. Tilted work plane
  16. User Defined Events


Do you have a question?

Click 'Comments' below to ask it. (You must be signed in to use this feature.)


Make Better Parts Faster!
Aaron Frankel (Community Manager)

Jim & Aaron,


I followed along with Jim in this video; all went well until I tested the post. I kept getting an (sort of non-specific)  error and finally tracked it down to the way the variable that we created is referenced.


It seems to only work if I program as such:


if { [info exists mom_nc_programmer] }


(checking to see if the variable exists) versus:


if { [info exists $mom_nc_programmer] }


(referencing the value held in the variable)


has anyone else ran into difficulty with this?

Siemens Valued Contributor Siemens Valued Contributor
Siemens Valued Contributor

Hi Thunderbird,


I checked some of my old posts, and you are correct.  You should use the first method (check to see if the variable exists) in this situation.


Jim Wright

Solution Partner Creator Solution Partner Creator
Solution Partner Creator

Hi Jim,


Good vidoe. It helps. However I have a quick question for you. 


I saw you placed the PB_CMD in First Tool block, however, I did the same thing and it said the mom_ variable doesn't exist. If I call the variable at Rapid Move block, then it works. 


So I'm wondering when exactly will the UDE variable be "read" by NX or Postprocessor?

In addition, it seems like the "uplevel" command is a little bit too difficult to use and do you have any sample codes or tutorial on that as well?


Thank you!




Hi Owen,


I met the same problem as you too. The reason for this "mom_variable doesn't exist" can be: Instead of adding the UDE in the program head, you may be adding the UDE in one of the operations, say Face_milling,  like the following pic shows:




While Jim's adding the UDE in the place where is the parent level of all the operation (in my case T12345-A), the post then creates the variable and "globalized" it in "Program Start Sequence". Later on, he would be able to use the variable anywhere after "Program Start Sequence".   


The way the post works, I believe, follows the sequence shown on the left hand side of your postbuilder:



Rapid Move (in Motion block) is "behind" Machine Control block. So at the point where Rapid Move is called, Machine Control has already been executed. That's why it works at your latter case.