Cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted

mom_operation_notes in postbuilder

Experimenter
Experimenter

hello,

I would like to ad the operation notes in the post builder but get an error.

I can’t see the variable "mom_operation_notes" in the MOM_variables_browser in the post builder version 10.0.3.

Is it possible that I can’t us it in the post builder and if so is there another way to do it?

3 REPLIES

Re: mom_operation_notes in postbuilder

Solution Partner Creator Solution Partner Creator
Solution Partner Creator

mom_operation_notes is an array variable.

 

You have to use the TCL commands to test if it is an array.

also use "array get"

 

and possibly a foreach loop on the elements.

 

e.g. something like this inside a custom command. (placed at start of operation or other suitable position) 

 

global mom_operation_notes

if {[info exists mom_operation_notes]} {
                 if [array exists mom_operation_notes] {
                           foreach { idx elm } [array get mom_operation_notes] {
                                      if [info exists mom_operation_notes($idx)] {
                                               if { [string length $elm] > 52 } {
                                                    MOM_log_message "Operation note truncated: $elm"
                                                    set elm [string range $elm 0 52]
                                                 }
                                                MOM_output_literal "( [format "%-54s" [string toupper $elm]] )"
                                       }
                            }
                }
}

Re: mom_operation_notes in postbuilder

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

I use a somewhat shorter test...

 

if {[info exists mom_operation_notes(0)] &&
    [string length $mom_operation_notes(0)]} {
    # Do whatever
}

I assume the first one has to exist for any of the others to exist.

 

 

I also loop slightly differently (not sure if it ends up in actual difference in the output)

foreach i [lsort -integer [array names mom_operation_notes]] {
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: mom_operation_notes in postbuilder

Experimenter
Experimenter

Thx all for the fast reply.

 Your samples were very helpful.

 I use now the code below (found in another post) and it works fine to me.

 

    global mom_operation_notes

    set status 1
    set nr -1
     while { $status } {
        incr nr
        set id_nr "$nr"
        if { [info exists mom_operation_notes($id_nr) ] } {
               set status 1
               set str [string toupper $mom_operation_notes($id_nr)]
               if { [expr $nr > 0 ] || $str != "" } {
                       MOM_output_text ";$str"
               }
            } else {
                set status 0
                break
            }
        }
Highlighted

mom_operation_notes in postbuilder

Experimenter
Experimenter

hello,

I would like to ad the operation notes in the post builder but get an error.

I can’t see the variable "mom_operation_notes" in the MOM_variables_browser in the post builder version 10.0.3.

Is it possible that I can’t us it in the post builder and if so is there another way to do it?

NX CAM Postprocessor Group
NX CAM Postprocessor Group

Members (147)