several questions about Tcl

Forum for OpenSees users to post questions, comments, etc. on the use of the OpenSees interpreter, OpenSees.exe

Moderators: silvia, selimgunay, Moderators

Post Reply
liushuhao
Posts: 88
Joined: Thu Jul 02, 2009 4:13 am
Location: HangZhou,ZheJiang,China

several questions about Tcl

Post by liushuhao »

several questions about Tcl

dear all , here I have several questions about Tcl

1 : I have gotten a line including some node tags , have can I set each strings to

node tags ?

for example

set fd [open "3.tcl" r]
:
:
:
set Value [string range $line [expr $equalpos + 1] [expr $commentpos -1]]
puts $Value

now I get :
* 1 25 360 2123 20120 ....
how can I set the" 1, 25, 360,2123, 20120 ... " these numbers to the node tags ?

2 : how can I add "#" to an assigned position ?for example the head of a line in a tcl by using tcl command ?

for example :

element 1 2 3 4 5 6 7 8 5 .....

to---------

# element 1 2 3 4 5 6 7 8 5 .....

thanks!
liushuhao
Posts: 88
Joined: Thu Jul 02, 2009 4:13 am
Location: HangZhou,ZheJiang,China

Post by liushuhao »

need help ,please
liushuhao
Posts: 88
Joined: Thu Jul 02, 2009 4:13 am
Location: HangZhou,ZheJiang,China

who can tell me what's wrong with the foolowing scripts&

Post by liushuhao »

set tags1 {77 78 81 80 86 87 90 89
82 83 86 85 91 92 95 94
83 84 87 86 92 93 96 95
85 86 89 88 94 95 98 97
86 87 90 89 95 96 99 98 }


set tags2 {77 78 81 80 86 87 90 89
82 }


set unkillednum [llength $tags2 ]

for {set i 0} {$i < $unkillednum } {incr i} {

set q [lindex $tags2 $i ]
puts $q

lsearch $tags1 $q

}
liushuhao
Posts: 88
Joined: Thu Jul 02, 2009 4:13 am
Location: HangZhou,ZheJiang,China

Post by liushuhao »

I want to compare these two lists ,if they have the same tags , pick up the tag , it can run successfully if I don't use “for” loop .but now it failed ,why ?
help
Post Reply