Showing results for 
Search instead for 
Did you mean: 

Post builder procedures declassified!

If you're like me, you have looked through the post and wondered to yourself 'what is this procedure doing?' 


Then you spend 15 minutes looking through folders, trying to find what file it's getting sourced from and you may or may not ever locate the darn thing!  Well in the spirit of Ken's show globals, I bring you Jake's show procedure!


If you stick this into your post (and edit the file output path) it will output the contents of all the procedures currently available at that time.


uplevel #0 {
    if {![info exists jake_procs]} {
        set open_file [open "C:/Jake/tcl/jake_procs/proc_bodies.tcl" w]
        foreach thing [lsort [info procs]] {
puts $open_file "\#========================================#" puts $open_file "proc $thing \{ \} \{" puts $open_file [info body $thing] puts $open_file "\}" puts $open_file " " puts $open_file " " } close $open_file set jake_procs 0 } }

Then if you open it with notepad++ and press "Ctrl + 1" it will pack them all for easy viewing!



The only down side is it doesn't actually show you what inputs it's looking for in the first set of curly braces.  If anyone has an idea of how that information could be found that would be helpful information!


Jake Hardwick
CNC Programmer
Senior Aerospace AMT
Production NX8.5.3.3 Beta testing NX10.0.1.4

Re: Post builder procedures declassified!

Esteemed Contributor
Esteemed Contributor


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 procedures declassified!

I've also made some changes to the MOOG_Show_Globals procedure that Ken gave to the forum.  He had mentioned that using the catch for the array wasn't his favorite piece of coding, so I changed it up a little and made it output to a file rather than the listing device.


proc MOOG_Show_Globals { } {
# Shows all globals -
# including arrays, and their values
# Just put call to this proc wherever you need it
# You probably want to add some code around the call 
# so you only output data one (or a few) times
#  Warning - if added as a custom commend, it takes a while for Postbuilder
#  to check this proc (i.e. Do not click on it to look at the code)
# KG Akerboom 15-Nov-2005
# Jake Hardwick 29-April-2015 
# Changed to output variables to a file in the directory program is being posted to
# Changed logic check on the array types 
    upvar #0 mom_output_file_directory op_dir mom_output_file_basename base_fn 
    set glob_file ${op_dir}${base_fn}_glbs[string range [clock clicks] 6 e].txt 
    set glob_chan [open $glob_file w] ;set global_vars [lsort [info globals]]

    puts $glob_chan "-----------------Global Vars-------------------"
    foreach global_var $global_vars {
        # you can use this to skip a variable type 
        # if {[string match *name* $global_var]} {continue} else { }
        # or this to skip all BUT this variable type
        # if {[string match *name* $global_var]} { } else {continue} 
        # I put them into one big check.  this is stuff you normally don't care about 
        if {[string match *mom_tool_use* $global_var]       || \
            [string match *mom_display*   $global_var]      || \
            [string match *platform*      $global_var]      || \
            [string match *mom_attr*      $global_var]      || \
            [string match *pocket*        $global_var]      || \
            [string match *mom_kin*       $global_var]      || \
            [string match *mom_isv*       $global_var]      || \
            [string match *mom_holder*    $global_var]      || \
            [string match *mom_tool_step* $global_var]      || \
            [string match *mom_gohome*    $global_var]      || \
            [string match *mom_from*      $global_var]      || \
            [string match *mcsn*attach*   $global_var]      || \
            [string match *mcs_info*      $global_var]}     {continue} 
        upvar #0 $global_var global_val
        if {[array size global_val] > 0} {
                foreach el [lsort [array names global_val]] {
                    puts $glob_chan "$global_var\($el) = $global_val($el)"
            } else {
                puts $glob_chan "$global_var = $global_val"

    puts $glob_chan "------------------------------------------------"
    close $glob_chan 


Jake Hardwick
CNC Programmer
Senior Aerospace AMT
Production NX8.5.3.3 Beta testing NX10.0.1.4

Learn online

Solution Information