NX How to set NX to open NC code in another editor

2019-10-18T08:37:45Z
NX for Manufacturing

Summary


Details

--------------- 

How to start NX to open NC code in another editor

Solution

 Set ENV variable: MESSAGE_EDITOR to point to program to be used eg. 

 

MESSAGE_EDITOR = C:\Program Files (x86)\TextPad 4\TextPad.exe

In Postbuilder, add in these procedures ( 'Program & Tool Path' tab )

PB_CMD_display_lpt_file:

# uncomment following line to bypass opening of file .lpt with Notepad.exe 

# return ; # !

global list_file 

global lpt_file_name 

set block 1 ; # 0 will leave NX running when editor is open, 1 will lock NX until editor is closed

set editor "Notepad.exe" 

set n [MOM_ask_env_var "MESSAGE_EDITOR"] 

if {$n!=""} {set editor $n}

if {[file exists $lpt_file_name] && [info exists list_file]} { 

 catch [flush $list_file] 

 close $list_file 

 if { $block } { 

 exec "${editor}" "${lpt_file_name}" 

 } else { 

 exec "cmd.exe" "${editor}" "${lpt_file_name}" 

 } 

 set list_file [open "${lpt_file_name}" "a" ]

PB_CMD_display_ptp_file:

# uncomment following line to bypass opening of file .ptp with Notepad.exe 

# return ; # !

global ptp_file_name 

set block 1 ; # 0 will leave NX running when editor is open, 1 will lock NX until editor is closed

set editor "Notepad.exe" 

set n [MOM_ask_env_var "MESSAGE_EDITOR"] 

if {$n!=""} {set editor $n}

if {[file exists $ptp_file_name]} { 

 MOM_close_output_file $ptp_file_name 

 if { $block } { 

 exec "${editor}" "${ptp_file_name}" 

 } else { 

 exec "cmd.exe" "${editor}" "${ptp_file_name}" 

 } 

 MOM_open_output_file $ptp_file_name 

}

Notes

KB Article ID# PL8010124

Contents

SummaryDetails

Associated Components

Manufacturing Post Builder