Cancel
Showing results for 
Search instead for 
Did you mean: 

Program name for two channel outputs

Solution Partner Genius Solution Partner Genius
Solution Partner Genius

Hello everyone,

would anyone know where to set the nc program name for two channel outputs? Now it always generates a program named part and channel_1 and channel_2. I need to define it myself.
I have not found it anywhere.

Thank you

4 REPLIES

Re: Program name for two channel outputs

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

You will have to add code (custom command) as the LAST thing in the "end of program" event

 

Code will look something like this:

	global mom_postprocessing_mode
	global mom_run_number
	global mom_output_file_basename			;# = OEMC0001channel_1 - NX10: OEMC0001__A001____.MPFchannel_1
	global mom_sys_output_file_suffix		;# = "mpf" (no period)
	global mom_output_file_directory 		;# = C:\Temp\OEMC0001_1\ 
	global mom_output_file_full_name 		;# = C:\Temp\OEMC0001_1\OEMC0001channel_1.ptp

# Only do when posting from sync manager
	if {![info exists mom_postprocessing_mode] ||
		!$mom_postprocessing_mode} {
		return
	}
	
	
	set suffix ""
	if {$mom_run_number == 1} {
		set new_name "WHATEVER" # your logic here
	} elseif {$mom_run_number == 2} {
		set new_name "WHATEVER2" # your logic here
	} else {
		MOM_output_to_listing_device "Unknown run number in Sync MGR = $mom_run_number (your_proc_name_here)"
		return
	}
		
	MOM_output_to_listing_device "Renaming $mom_output_file_full_name"
	MOM_output_to_listing_device "      to $new_name"

	MOM_close_output_file $mom_output_file_full_name
	if {[catch {file rename -force  $mom_output_file_full_name $new_name} result]} {
		MOM_output_to_listing_device "Error renaming $mom_output_file_full_name to \"$new_name\" "
		MOM_output_to_listing_device "   Message = $result"
	}
	
	# reset this so shop docs files are correct
	set mom_output_file_full_name $mom_output_file_directory$new_name$suffix
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: Program name for two channel outputs

Solution Partner Genius Solution Partner Genius
Solution Partner Genius

Thanks Ken,
is there anything you need to edit in the code? I still have a mistake in the postbuilder when I copy it to the command.

Re: Program name for two channel outputs

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

I kind of hacked the code to remove Moog specific stuff, so it is possible ;-) I have a tcl error

How I would proceed:

- Paste the code into a custom command

- comment out ALL the code (add a "#" to the beginning of every line)

- post SHOULD save at this point

- now, one line at a time, uncomment the line, and try to save the post (or just try to edit a different custom command, then go back to this one)

- eventually you will uncover the line with the error (may happen more than once).  Figure out what is wrong, fix it, then go onto the next line.

 

I know I've had issues with valid tcl code being unable to be saved in PB due to syntax checking.

So I keep (almost) all my tcl code in separate tcl files I "source" into the post.

No #@#^&%#@!! PITA syntax checking errors in Post Builder

(but then I get "#@#^&%#@!! PITA" errors when I use the post ;-)  so choose your poison ! 

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: Program name for two channel outputs

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

And watch for line wrapping when you copy/paste the code (e.g. 3rd "global" in my code listing)

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


Learn online





Solution Information