1

I am trying some simple scripting with Amira, which uses TCL but I cannot assure that it's the standard version. I want to read a property from an object and assign it to another object.

In the command window the procedure would be the following:

Image1 getTransform

0.1 0.2 0.3 0 0 0 0 0 0 1

Image2 setTransform 0.1 0.2 0.3 0 0 0 0 0 0 1

I want to do the same without manually copy pasting the result of getTransform

The following do not work (taht is to say setTransform is executed without arguments)

Image2 setTransform [Image1 getTransform] 

or

set myT=Image1 getTransform
Image2 setTransform $myT 

I am sure I just need to appropriately use $ [ { , but what I've tried so far has not given any result

lib
  • 2,918
  • 3
  • 27
  • 53

1 Answers1

5

If you are using Tcl 8.5 or newer, then use the {*} argument expansion:

Image2 setTransform {*}[Image1 getTransform]

which is exactly what you want.

If you are using an older version of Tcl, then you have to use eval, a very useful command, where many things can go wrong if not used correctly:

eval [linsert [Image1 getTransform] 0 Image2 setTransform]

The linsert is used here to build up a propper list to avoid double substitution (which is almost always bad).

Johannes Kuhn
  • 14,778
  • 4
  • 49
  • 73