Showing results for 
Search instead for 
Do you mean 
Reply
Solved! Go to solution

How to change the default name of the generated file.

I want change the default name of the generated file has the same name as the mom_grou_name. Do not name the file .prt. Can I do this in postbuilder or setting nx ?

 

123.jpg

15 REPLIES

Re: How to change the default name of the generated file.

In the post, it is common for users to use tcl to rename or move the output file when the post finishes.

 

If you want to control it in the output dialog, another option is to use library output mode, where the post and shop docs output files will be organized by program name. You can try this by selecting the cam_library configuration, or adding this to your current configuration:

 

LIBRARY_CAM_OUTPUT,${UGII_CAM_LIBRARY_TEMPLATE_DIR}cam_output.def,${UGII_CAM_LIBRARY_TEMPLATE_DIR}cam_output.tcl
Mark Rief
Retired Siemens

Re: How to change the default name of the generated file.

" In the post, it is common for users to use tcl to rename or move the output file when the post finishes. "

 

Please precise explanation. How to do it ?

Solution
Solution
Accepted by topic author mateu5
‎05-23-2016 02:48 PM

Re: How to change the default name of the generated file.

Hello,

 

You can write a cusm procedure at the end of postprocessor. MOM_end_of_program. Attach sample code:

 

#1. Create folder, if not exists, it be created.
global mom_post_in_simulation dpp_TNC_fixture_origin

if {$mom_post_in_simulation != "CSE" } {
global mom_output_file_directory
global mom_output_file_full_name
global mom_output_file_basename
global mom_parent_group_name
global maquina

set carpeta [file mkdir $mom_output_file_directory/$maquina]

 

#2. Close file postprocessor

MOM_close_output_file $mom_output_file_full_name

 

#3. Rename the file

global prog_name mom_operation_name mom_group_name mom_parent_group_name
if { [info exist mom_parent_group_name] } {
set programa $mom_parent_group_name
} elseif { [info exist mom_group_name] } {
set programa $mom_group_name
} else {
set programa $mom_operation_name
}

set extension ".h"

set new_file $mom_output_file_directory$programa$extension
file rename -force $mom_output_file_full_name $new_file

 

#4. Move the new file to the folder and it is deleted the original file

if { [file exists $new_file] } {
file copy -force $new_file $mom_output_file_directory$maquina
file delete -force $new_file
}

 

Good lucky,

 

Best regards,

Re: How to change the default name of the generated file.

I put your procedure but the error pops up and creates the file:

mom_information.out

 

***** A TCL Error Has Occurred *****
Event Handler: C: \ Users \ X \ Desktop \ pst test \ test2 \ XYZ_MINIMILL_SIN802D.tcl
Event: MOM_end_of_program
Error Info: can not read "maquina": no such variable
     while executing
"File mkdir $ mom_output_file_directory / $ maquina"
     (Procedure "PB_CMD_rename" line 13)
     invoked from within
"PB_CMD_rename"
     (Procedure "MOM_end_of_program" line 10)
     invoked from within
"MOM_end_of_program"
Error Code: NONE

 

Where is the problem ?

Re: How to change the default name of the generated file.

Hello,

You need to declare the variable name. Put this sentence at the top:

global maquina ; set maquina "folder_name"

Best regards,

Re: How to change the default name of the generated file.

Works! but does not display the code in the information window. Is it any way?

Re: How to change the default name of the generated file.

That's more complicated. The reason is because does not exist default file.

Best regards,

Re: How to change the default name of the generated file.

Is it possible to automatically open the resulting file outside the window information.

Re: How to change the default name of the generated file.

You can do something like:

exec "notepad.exe" "$mom_output_file_directory$maquina$programa$extension" &
Stefan Pendl, Systemmanager CAx, HAIDLMAIR GmbH
Production: NX10.0.3, VERICUT 8.0, FBM, MRL 3.1.4 | TcUA 10.1 MP7 Patch 0 (10.1.7.0) | TcVis 10.1
Development: VB.NET, Tcl/Tk    Testing: NX11.0 EAP, NX12.0 EAP

How to Get the Most from Your Signature in the Community

Learn online





Solution Information