hypermesh create entity "if file exists"
Hi all
I am creating comps with for loop, however i really dont know how to catch error in TCL.
I want to skip the error " A component by that name already exists in database"
Regards
for {set i 10} {$i <20} {incr i} {
*createentity comps name=pshell.$i id=$i
if { [catch {set $i [expr $i + 1] }] } {
set $i [expr $i + 1]
}
}
Best Answer
-
there is command 'hm_entityinfo exist'
An example checking if some SET exists, below. If not, it is created.
if { [hm_entityinfo exist sets "$name" -byname] ==1 } {
#else
} else {
*createentity sets cardimage=SET_ELEM includeid=0 name=$name
*setvalue sets name=$name STATUS=0 5422=LIST
}1
Answers
-
there is command 'hm_entityinfo exist'
An example checking if some SET exists, below. If not, it is created.
if { [hm_entityinfo exist sets "$name" -byname] ==1 } {
#else
} else {
*createentity sets cardimage=SET_ELEM includeid=0 name=$name
*setvalue sets name=$name STATUS=0 5422=LIST
}1 -
Hi Adriano
Thanks for your answer. Before your answer, i marked all comps and compare with each one.
Regards
0