Need help with tcl command for shop docs
Need help with tcl command for shop docs
(OP)
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
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





RE: Need help with tcl command for shop docs
#read data file
set fid [open C:\\file r]
set data [read $fid]
close $fid
set lines [split $data \n]
----
kukelyk
RE: Need help with tcl command for shop docs
set line1 [lrange $lines 0 0]
MOM_output_literal "$line1"
etc.
----
kukelyk
RE: Need help with tcl command for shop docs
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
RE: Need help with tcl command for shop docs
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