NX
Displaying the CAM Programmer's Name by Reading the Logon Name.
2021-10-06T23:28:02Z
NX for Manufacturing
Summary
Details
All employees in a company are assigned a randomly generated login name. Post Configurator can display this login name when posting an NC file. What happens when the machine operator has a question and needs to contact the Programmer. This random set of characters is not very helpful when locating this person. Is there a way to read the login name, match it to the Programmer's actual name and then list that name?
In the output below notice the name 3j7en5 is listed after the CREATED_BY text. This text is the Programmer's login.
The NC Programmer's actual name can be determined by searching for the login name which is the first entry in a text file and then reading the actual name that follows. A sample of that text follows.
Creating the file with commas separating the fields, as seen above, and naming the file with a CSV extension will allow the file to be opened in an Excelspreadsheet. Opening the file in a spreadsheet will help simplify data entry.
To read this file use the following TCL code. Copy the text below into a Post Configurator ServiceLayer. Be careful that there is no word wrapping. The CSV text file will need to be located in the same folder as the Post Configurator post. The path to this file can be specified to a different location by removing the # sign before the set command on line 71 in the TCL file below. Do not add a CSV extension on this line.
LIB_GE_command_buffer_edit_append LIB_CTRL_nc_header PROG_NUMBER opname _opname proc opname { } { set cam_post_dir [MOM_ask_env_var UGII_CAM_POST_DIR] #Optional remove # from next line and specify path. Do not use extension. #set mom_event_handler_file_name "T:\CAMCustomization\Programmers" regsub -all {.tcl} $::mom_event_handler_file_name ".csv" lookup_tbl if [catch {open $lookup_tbl r} fileId] { set response [MOM_display_message "$fileId" "File error:" Q OK] return } else { foreach line [split [read $fileId] \n] { set j 0 foreach value [split $line ,] { set tmpt($j) "[lindex [split $line ,] $j]" incr j } if { $tmpt(0) == "$::mom_logname" } { set tmpt(1) "[string toupper $tmpt(1)] " set tmpt(2) "[string toupper $tmpt(2)]" set co $::mom_sys_control_out set ci $::mom_sys_control_in MOM_output_text "$co\CREATED BY:$tmpt(1) $tmpt(2)$ci" close $fileId return } } } close $fileId }
Notes and References
Please be aware that any code provided by NXCAM Support is intended to be used for sample purposes only. It is the user's responsibility to determine whether the code is suitable for the purpose.
Hardware/Software Configuration
Platform: all OS: n/a OS Version: n/a Product: NX Application: CAM Version: V1980 Function: POSTCONFIG