TCL array problem
I am fairly bad at tcl, but I am trying to write my own procedures for a commercial software that has tcl API.
I have following procedure:
proc crs_rot { axis value } {
set actvie [GNS_get_system_var ACTVIEWID]
array set csecdef [GNS_get_cross_section $actvie 0 0]
# foreach {key value} [array get csecdef] {
# puts $key
# puts $value
# }
}
at this stage the API command GNS_get_cross_section is of importance.
puts [GNS_get_cross_section $actvie 0 0] will return following stuff:
STATE off TYPE Euler GEO show LINE on WIDTH 1 STYLE con RGBA {1 0 0 1} PIDCOLOR off INNERSOL off TAIL {1329 -739.4 514.4} DIRECTION {0 1 0}
at this moment I am interested in the DIRECTION vector {0 1 0}
the foreach loop works ok - I can print out the keys STATE TYPE GEO etc.
or values.
The important question is, how can I get only the specific entry DIRECTION without looping through
the whole array? And while we are at it, how can I get the vector {0 1 0} separated into components x, y and z?
|