找回密码
 注册
Simdroid-非首页
查看: 55|回复: 0

[二次开发] How to Add Tool Length to shop doc Tool List

[复制链接]
发表于 2009-9-20 13:22:38 | 显示全部楼层 |阅读模式 来自 湖北武汉
If we are using tool list (TEXT) output we need to look at shop_doc.dat. The
tcl file and tpl file to modify are listed here

Tool List (TEXT), ${UGII_CAM_SHOP_DOC_DIR}tool_list.tcl,
${UGII_CAM_SHOP_DOC_DIR}tool_list.tpl



Open tool_list.tcl - the proc that we will be modifying is


proc MOM_TOOL_BODY {} {

  global mom_tool_name
  global mom_tool_type
  global mom_template_subtype
  global mom_tool_diameter
  global mom_tool_nose_radius
  global mom_tool_length_adjust_register
  global mom_tool_orientation
  global mom_tool_corner1_radius
  global mom_tool_point_angle
  global mom_tool_flute_length
  global setup_header
  global tool_head
  global Tool_No
  global mom_drive_point_diameter
  global mom_tool_ug_type
  global mom_tool_description
  
  MapToolType tool_type
  
  if {$setup_header > 1} \
  {
     if { [string compare $tool_head $tool_type] } { return }

     if { $mom_template_subtype == "" } { set mom_template_subtype
$mom_tool_type }

     switch $tool_head \
     {
   
       "DRILL" {
                  set pi [expr 2 * asin(1.0)]
                  set mom_tool_point_angle [expr [expr 180 / $pi] * \
                                                   $mom_tool_point_angle]
                  set output [format "%-20s %-30s %-10.4f %-10.4f %-10.4f
%-10d\n" \
                    $mom_tool_name $mom_tool_description \
                     $mom_tool_diameter $mom_tool_point_angle \
                    $mom_tool_flute_length $mom_tool_length_adjust_register]
                  MOM_output_literal "$output"
               }
       "MILL"  {
                  # user defined tool. mom_tool_diameter is
mom_drive_point_diameter
                  if { $mom_tool_ug_type == 15 } {
                      if {[info exists mom_drive_point_diameter]} {
                          set mom_tool_diameter $mom_drive_point_diameter
                      }
                  }
                  set output [format "%-20s %-30s %-10.4f %-10.4f %-10.4f
%-10d\n" \
                    $mom_tool_name $mom_tool_description\
                    $mom_tool_diameter $mom_tool_corner1_radius \
                    $mom_tool_flute_length $mom_tool_length_adjust_register]
                  MOM_output_literal "$output"
               }
       "LATHE" {
                  set tool_orient [expr [expr 180 / 3.14] * \
                                           $mom_tool_orientation]
                  set output [format "%-20s %-30s %-10.4f %-15.4f %-10d\n" \
                    $mom_tool_name $mom_tool_description \
                     $mom_tool_nose_radius $tool_orient \
                    $mom_tool_length_adjust_register]
                  MOM_output_literal "$output"
               }
     }
  } else \
  {
     switch $tool_type \
     {
         "MILL"  { incr Tool_No(mill) }
         "DRILL" { incr Tool_No(drill) }
         "LATHE" { incr Tool_No(lathe) }
      }
  }
}




For our example if we want to add tool lenth to the Drills, you will add
mom_tool_length to the global list


global mom_tool_length


then modify the format statement under the "DRILL" case to look like this


       "DRILL" {
                  set pi [expr 2 * asin(1.0)]
                  set mom_tool_point_angle [expr [expr 180 / $pi] * \
                                                   $mom_tool_point_angle]
                  set output [format "%-20s %-30s %-10.4f %-10.4f %-10.4f
%-10.4f %-10d\n" \
                    $mom_tool_name $mom_tool_description \
                     $mom_tool_diameter $mom_tool_point_angle \
                    $mom_tool_flute_length $mom_tool_length
$mom_tool_length_adjust_register]
                  MOM_output_literal "$output"
               }


Notice we added the tool length after the tool flute length. This meant we had
to add the %-10.4f in the format statement and the $mom_tool_length
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-7-5 16:25 , Processed in 0.031751 second(s), 14 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表