Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

tool list in nc program

Status
Not open for further replies.

J0semi

Industrial
May 21, 2010
13
hi,how add to my nc program a tool list(the description,mom_tool_description) at the begin of program?
i see this comand but don´t works with mom_tool_description.
Need reprocess it?
Thnaks

Code:
global ptp_file_name mom_definition_file_name mom_output_file_full_name 
global mom_output_file_directory mom_output_file_basename mom_output_file_suffix 
global mom_warning_info 
global mom_machine_time mom_group_name mom_operation_name mom_part_name
global mom_tool_count mom_tool_use
global mom_logname mom_ug_version mom_date mom_machine_name 

set tm1 [clock seconds]
set tm2 [clock format $tm1 -format "%M:%S"]
MOM_log_message "MOM Start = $tm2 "

set tmp_file_name "${ptp_file_name}_"
if {[file exists $tmp_file_name]} {
  MOM_remove_file $tmp_file_name
}
MOM_close_output_file $ptp_file_name
file rename $ptp_file_name $tmp_file_name

set ifile [open $tmp_file_name r]
set ofile [open $ptp_file_name w]

set temp ";%_N_"
set temp1 $mom_output_file_basename
set temp2 _MPF
set stroka [concat $temp$temp1$temp2]
puts $ofile "$stroka"

set temp ";$"
set temp1 "PATH=/_N_WKS_DIR/_N_WORK_PROGRAMS\_WPD"
set stroka [concat $temp$temp1]
puts $ofile "$stroka"

puts $ofile " "
set path $mom_part_name
puts $ofile ";(PART: $path)"

if {[info exists mom_operation_name] == 0} { set mom_operation_name "" }
if {[info exists mom_group_name] == 0} { set mom_group_name $mom_operation_name }
puts $ofile ";(Program: $mom_group_name)" 
puts $ofile ";(Date:$mom_date User:$mom_logname)"
puts $ofile ";(MACHINE: $mom_machine_name, Siemens CNC)"

puts $ofile ";(MACHINE TIME: [format "%.2f" $mom_machine_time] MIN)"
puts $ofile " "

puts $ofile ";(----------- TOOL LIST -----------)"
for { set nn 0 } { $nn < 99 } {incr nn} {
  if {[hiset mom_tool_use($nn,0)] && [hiset mom_tool_use($nn,1)]} {
    set a [scan $mom_tool_use($nn,0) %d tn]
    set str [format "%s %.2f" $tn $mom_tool_use($nn,1)]
    puts $ofile ";(TOOL NUMBER $str MIN)"
  }
}
puts $ofile ";(--------- END TOOL LIST ---------)"

while { [gets $ifile buf] > 0 } {
   puts $ofile $buf
}

close $ifile
close $ofile
MOM_remove_file $tmp_file_name

set tm1 [clock seconds]
set tm2 [clock format $tm1 -format "%M:%S"]
MOM_log_message "MOM End = $tm2 "

MOM_open_output_file $ptp_file_name
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor