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.

O0001
(CREATED BY:3j7en5)
N10 G17 G21 G94 G90
(RFCNF , TOOL : MILL)
N12 G0 G53 Z0.0
N14 T01 M6
N16 G54
N18 G43.4 H1
N20 G17 G0 G90 X218.004 Y100. S1000 M3

Below is the desired output showing the Programmers actual name.

O0001
(CREATED BY:R Thorp)
N10 G17 G21 G94 G90
(RFCNF , TOOL : MILL)
N12 G0 G53 Z0.0
N14 T01 M6
N16 G54
N18 G43.4 H1
N20 G17 G0 G90 X218.004 Y100. S1000 M3

Solution

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.

q32e4h,B,Boyd
we3w2f,F,Wright
e3333e,J,Brown
ft334g,C,Waters
f44e45,J,Johns
4r553g,J,McCay
3j7en5,R,Thorp
53dd23,S,Gibbons
ee00e7,J,Mack

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 Excel spreadsheet. 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 Service Layer. 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

Ref: 002-8555140

KB Article ID# PL8555140

Contents

SummaryDetails

Associated Components

Manufacturing Post Builder Manufacturing Post Configurator