2016-07-02 59 views
0

我想從列表創建一個集合。 friends1是一個名字列表。在TCL中創建一個列表

我試圖做的事:

set friends2 ""   
    foreach frnd $friends1 { 
     append_to_collection friends2 $frnd 
    } 

Error: At least one collection required for argument 'object_spec' to append_to_collection when the 'collection' argument is empty (SEL-014)

任何想法?謝謝!

+2

什麼代碼定義了'append_to_collection'?它不是標準的Tcl(在http://www.tcl-lang.org/man/tcl8.6/中定義) –

+0

我使用ic編譯器,它是一個內置命令:append_to_collection 將對象添加到集合中,修改一個變量。 – Tlalit

回答

0

我認爲Synopsys集合只能由Synopsys的對象創建,例如網絡,引腳等。朋友不是Synopsys的對象......但是假設您有一個Synopsys對象的名稱列表,您可以使用相應的'get'函數將列表變成一個集合。

set col_of_nets [get_nets $nets] 
set col_of_pins [get_pins $pins] 
... 

要倒退(收集到名稱列表),請使用get_object_name。

set names_of_nets [get_object_name $col_of_nets] 
...