foreach循环说在右括号后还有多余的字符。无法识别在哪里

时间:2019-03-22 17:04:31

标签: tcl

proc p_derived_bars args {
    *createmarkpanel elems 1 "select 3d elems"
    set buff1 ""
    set buff2 ""
    set i 0; set j 0
    foreach NodeList [hm_getvalue elems mark=1 dataname = nodes] cx [hm_getvalue elems mark=1 dataname=centrex] cy [hm_getvalue elems mark=1 dataname=centrey] cz[hm_getvalue elems mark=1 dataname=centrez] {
      append buff1 "GRID,[incr i],,$cx,$cy,$cz\n"
       foreach NodeId $NodeList {
         append buff2 "PLOTEL,[incr j],$i,$NodeId\n"
        }
    }

    set fpt [open temp.fem w]
    puts $fpt $buff1
    puts $fpt $buff2
    close $fpt
}

我看不到多余的空间在哪里,有人介意帮助我吗?这是用于Hypermesh。

1 个答案:

答案 0 :(得分:4)

在这里,您缺少空格:

  cz[hm

这将导致错误数量的参数传递给foreach。