Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Need help with tcl command for shop docs

Status
Not open for further replies.

DMiller01

Mechanical
Jul 17, 2008
70
0
0
US
I am automating setup notes to appear when you generate shop docs.

I have learned enought tcl to do a crude implementation that works. To accomplish this I have add code in the shopdoc_programview_text.tcl file.

I'd like to polish the code to make it more robust and easiler to maintain but I am having trouble with what I would expect to be a very simple programming task.

I would like to read a txt file containing the setup notes to be added to the shop doc output file. I have tried using , "gets", "read" and "scan" to read the txt file and then "puts" to write it to the shop doc file. However it does not show up in the shop doc output file. I suspect that my "puts" command is not set up correctly. But it is possible that I'm not reading test.

I have also tried UG's MOM_output_literal also without success. If anyone has suggestion and/or would like more detail please let me know. A snippet of code is attached so you can see one of the many things I have tried.
I am using NX 6.0 with XP-pro

DaveM


 
Replies continue below

Recommended for you

Thanks for your help. It got me over the wall I was struggling with. I experimented with the code you suggested and ulimately used the following:

read data file
set fid [open C:\\$note_id r]
set data [read $fid]
close $fid
MOM_output_literal $data

With this implementation in place I am still playing with alternate methods. I am now working on getting an interative dialog box to open and provide a list of notes files to select from. I don't know if it is a better way but it'll be a good learning experience.

I have been able to run a tcl script file using ugwish to genertate a dialog box.

exec ugwish dialog.tcl;

I just have to figure out how to pass variables set under ugwish interpreter back to tclsh interpreter.

Thanks againDMiller
 
From the dialog, use puts to pass a string back.

puts $note1

In the calling proc, set a variable to the output of the exec statement...

set chosen_note [ exec $ug_wish $my_dialog ]

Tod (1d) Briggs
Manufacturing Solutions Architect
Siemens PLM Software
Detroit, MI
 
Status
Not open for further replies.
Back
Top