A lot of time PB has issues with the "format" command in custom commands, as PB tries to verify the tcl code is valid before allowing you to save.
This is (or at least was) a major PITA.
This is a major reason (essentially) ALL my custom commands just call a proc in a "source"d in tcl file.
See if you can create word(s) and /or blocks to do the output (and hence the formatting) and use "MOM_do_template", instead of using "MOM_output_literal" (or "MOM_output_text") directly in the custom command.
And in your case, see if adding a "global mom_out_angle_pos" before the "format" line fixes your issue.
Production: NX10.0.3.5 MP16/TC11.2
I'd rather be e-steamed than e-diseaseled
I see strange things like this with old posts that I brought into a newer version of PB. Sometimes the variable that is being output is not available at the moment. You may need to set the variable to some default value at start of program.
In PB v11.02 & up you can turn off the syntax checker when you open a post. This would allow you to open a post with certain syntatical errors.
Since you are running PB v11.01, you may reveal this option by adding the line below:
set gPB(FORCE_SYNTAX_CHECK) 0
to the bottom of your "$HOME"\ui_pb_user_resource.tcl".
The $HOME can be found via "Help -> About Post Builder".
You may also fix the error by editing the Tcl file in a text editor.