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!

Shop Doc help

Status
Not open for further replies.

raysapp

Aerospace
Aug 26, 2009
135
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
 
Replies continue below

Recommended for you

You need to global it before setting it. It is globalled but it is after the set.
 
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
 
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]
 
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
 
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.
 
What ended up being the problem? Just got me interested now.
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor