×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Shop Doc help

Shop Doc help

Shop Doc help

(OP)
I'm looking to add two columns to my tool list html file, "tool holder description" and "tool extension". The first went fine but I'm having trouble with the second. I imagine it is because "extension" is a variable I created within a custom command "PB_CMD_tool_extension" for my post. I tried setting the variable "set extension [expr $mom_tool_length - $mom_tool_holder_offset]", but I'm getting an error indicating the tool length variable isn't available. I'm not sure how to set this variable since I didn't have to do this in postbuilder. Not even sure if this doable. I've attached the tcl as well as the custom command.
TIA

Ray S
NX 7.0.1.7
www.appliedprecisionproducts.com

RE: Shop Doc help

You need to global it before setting it. It is globalled but it is after the set.

RE: Shop Doc help

(OP)
Thanks, that makes sense. I globalled where I did because that's where the other variables were globalled. And I set where I did because at top of file it said: "Here you should define any global variables that will be used in any one
# of the event handler."
At any rate, I'm not sure what to move where. I apologize for my tcl lameness. My programming skills pretty much end with machine tools.

Ray S
NX 7.0.1.7
www.appliedprecisionproducts.com

RE: Shop Doc help

You have to watch too that even if it is in the same file, it it is inside a proc then it is only globalled in that proc, so it is not seen in another proc later. If you put it there it should work. And I forget to global alot so don't feel bad.

set mom_source_directory [MOM_ask_env_var UGII_CAM_SHOP_DOC_DIR]
source "$mom_source_directory/shopdoc_header.tcl"
set table_flag 0
set setup_header 0
set Tool_No(mill) 0
set Tool_No(drill) 0
set Tool_No(lathe) 0
global extension
set extension [expr $mom_tool_length - $mom_tool_holder_offset]
 

RE: Shop Doc help

(OP)
Thanks for hanging in there. I'm still getting the same error: "can't read 'mom_tool_length': no such variable while executing." I tried globalling the other variables with no effect.

set mom_source_directory [MOM_ask_env_var UGII_CAM_SHOP_DOC_DIR]
source "$mom_source_directory/shopdoc_header.tcl"
set table_flag 0
set setup_header 0
set Tool_No(mill) 0
set Tool_No(drill) 0
set Tool_No(lathe) 0
global mom_tool_length
global mom_tool_holder_offset
global extension
set extension [expr $mom_tool_length - $mom_tool_holder_offset]

Ray S
NX 7.0.1.7
www.appliedprecisionproducts.com

RE: Shop Doc help

I have not messed with shop docs so I am talking tcl but I think this is probably a timing issue. I would global it and do the set right there before the switch.

RE: Shop Doc help

What ended up being the problem? Just got me interested now.

RE: Shop Doc help

(OP)
The "extension" variable was not defined with an "mom" in front of it, and yet when I called it out, I put one in front because I was following the format of what I saw in the above lines. It's the kind of mistake you make when you really don't know what the hell you're doing.
Anyway, I'll paste below what worked for me. I'm kind of surprised the shop docs don't have this info OTB. I don't know how set up guys can chuck up tools without it.

 global mom_tool_length
 global mom_tool_holder_offset
 global extension


  set extension [expr $mom_tool_length - $mom_tool_holder_offset]


  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]
                  MOM_output_literal "<tr>"
                  MOM_output_literal "<td ALIGN=CENTER>$mom_tool_name</td>"
                  MOM_output_literal "<td ALIGN=CENTER>$mom_tool_description</td>"
                  MOM_output_literal "<td ALIGN=CENTER>[format "%10.4f" \
                                      $mom_tool_diameter]</td>"
                  MOM_output_literal "<td ALIGN=CENTER>[format "%10.4f" \
                                      $mom_tool_point_angle]</td>"
                  MOM_output_literal "<td ALIGN=CENTER>[format "%10.4f" \
                                      $mom_tool_flute_length]</td>"
                  MOM_output_literal "<td ALIGN=CENTER>$mom_holder_description</td>"      
                  MOM_output_literal "<td ALIGN=CENTER>[format "%10.3f" \
                                       $extension]</td>"
                  MOM_output_literal "<td ALIGN=CENTER>[format "%10d" \
                                       $mom_tool_length_adjust_register]</td>"                                 
                  MOM_output_literal "</tr>"

Ray S
NX 7.0.1.7
www.appliedprecisionproducts.com

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources