×
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

Need help with tcl command for shop docs

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
 

RE: Need help with tcl command for shop docs

try this:

#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

write out:

set line1 [lrange $lines 0 0]
MOM_output_literal "$line1"

etc.

----
kukelyk

RE: Need help with tcl command for shop docs

(OP)
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

RE: Need help with tcl command for shop docs

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
 

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