Jump to content

TCL escape characters


fixxorion

Recommended Posts

Hi all,

Here's a seemingly simple yet frustrating problem. All I want to do is, from tcl, run the following:

hscript chkey -t 0 -v 0 -m 0 -a 1 -F 'ch("ty")' geo1/tx

But everytime I do this, I get the following in the tx channel:

ch(\"ty\")

This, of course, isn't exactly what I wanted. :) How do I prevent tcl from including the escape characters when it runs the command? (I assume that's what's happening) Any help would be greatly appreciated!

Thanks,

fixxorion

Link to comment
Share on other sites

I don't think I explained it too well in the last post, so I included an example of what I want to do. This was made with Visual Tcl. Now, this script assumes that you have a geo object called "model" at the object level. When you press the button, I want it to put the following in the ty channel:

ch("/obj/model/tx")

Instead, I get the following:

ch(\"/obj/model/tx\")

This really has me stumped, so any help would be unbelievably appreciated!!

Thanks,

fixxorion

test.tcl

Link to comment
Share on other sites

Unfortunatly I've found the tcl scripting interface to be prertty problematic in houdini. Some hscript calls in tcl are fine to call as your doing, but any time you want to set a string field it can be a real pain. There are some other pitfalls where you get a {} around your strings and it seems impossible to get rid of them when sending tcl strings directly to houdini though the tcl hcript command

The best way I've found is to simply dump commands like this to a temp file rather then sending the commands directly to houdini.. then at the end of your tcl script source them in and clean up the temp file. Heres's an example:

######################

#Open a temp file

set tempfile "c:/temp"

set fileID [open $tempfile w]

#Dump cmds to it

puts $fileID "opcd /obj"

puts $fileID "chadd -t 0 0 geo1 tx"

puts $fileID "chkey -t 0 -v 0 -m 0 -a 1 -F 'ch(\"tz\")' geo1/tx"

#Close, source and cleanup temp file

close $fileID

hscript source $tempfile

file delete $tempfile

exit

-daniel

Link to comment
Share on other sites

no problem. I've brought up some of the issues with the tcl plugin to sesi a long time ago, but it didn't seem very high on thier priority list. I'm of the opinion that if it's in the package it should work well, or be removed. I don't see the reasoning behind having 1/2 working features, it only frustrates users.

d

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...