NX
Reading WEDM Power Tables Stored in a CSV Text Based Data File
2021-10-06T23:26:35Z
NX for Manufacturing
Summary
Details
An Excel Spreadsheet was created with the data that will be used to determine the burn settings on a Wire EDM machine. The columns in this database include the part material, wire thickness, block height and the number of passes. Additional columns include the data for the over burn allowance, feed rate and the power codes for multiple wire passes. How can this data be read when posting an NX Wire EDM program using Post Builder ?
Solution
The CSV format was selected for this file. This format was chosen because this data can be read in as a text file when posting and also allows the file to be edited in Excel as a spreadsheet. The CSV format is really just a text file with the entries separated by a comma. When the CSV file, as seen above in Excel , is opened in Notepad it might look like the picture below.
To be able to keep track of this CSV file it will be named the same name as the Post Builder post but with a ".csv " extension. Now, in addition to the PUI , TCL, CDL and DEF file, the post will have a CSV file, as well.
The following TCL code will be placed in a Custom Command in the Power procedure. The Post Builder UDE Editor will need to be enabled in order to display this in the Machine Control . When pasting this TCL code be careful that lines are displayed as seen in the picture. It is important that lines are not wrapped to the next line if too long.
global mom_event_handler_file_name global mom_part_material_name global mom_wire_guides_lower_plane global mom_wire_guides_upper_plane global mom_tool_diameter global mom_power_value global mom_wire_table global mom_rough_passes global mom_finish_passes
set burnhtg [expr round($mom_wire_guides_upper_plane + $mom_wire_guides_lower_plane)]
if [catch {open $lookup_tbl r} fileId] { set response [MOM_display_message "$fileId" "File error:" Q OK] return } else { set i 0 foreach line [split [read $fileId] \n] { set j 0 foreach value [split $line ,] { set mom_wire_table($j) "[lindex [split $line ,] $j]" incr j } set m 0 if { $mom_wire_table(0) == "$mom_part_material_name" } { set m [expr $m+1] } if { $mom_wire_table(1) == "$mom_tool_diameter" } { set m [expr $m+1] } if { $mom_wire_table(2) >= "$burnhtg" } { set m [expr $m+1] } if { $mom_wire_table(3) == "[expr int($mom_rough_passes + $mom_finish_passes)]" } { set m [expr $m+1] } if { $m == 4 } { MOM_output_literal "($mom_wire_table(0) $mom_wire_table(1) $mom_wire_table(2) $mom_wire_table(3))" MOM_output_literal H$mom_wire_table([expr int($mom_power_value * 3 + 1)]) MOM_output_literal F$mom_wire_table([expr int($mom_power_value * 3 + 2)]) MOM_output_literal E$mom_wire_table([expr int($mom_power_value * 3 + 3)]) close $fileId return } incr i } close $fileId set tmp "$mom_part_material_name $mom_tool_diameter $burnhtg $mom_wire_table(3)" set response [MOM_display_message "No entry in EDM Power Table $tmp" "File error:" Q OK] MOM_abort "*** $tmp ***" }
The part material is set by reading the Workpiece Material in the NX program. The selected material type will cause the correct row on the table to be read.
The data row for the wire diameter is selected by reading the Wire Tool Diameter in the program.
The wire height row is selected by reading Upper and Lower Plane ZM values in Cutting Parameters .
A Power UDE is added to the Start In path Events and a number entered indicating which step over pass is used. If, for example, the program has one rough pass and three finish passes then the power codes should be entered as one and end at four. This number will be used to determine which wire offset, feed rate and power code that is read from the CSV file.
The G-code that is output when posting might look something like the following:
Notes
The code in this article is not considered complete but rather provides a starting point for post development. Please be aware that any code provided by GTAC 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.