🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

hypermesh create entity "if file exists"

User: "Suslu"
Altair Community Member
Updated by Suslu

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]
}
}

 

Find more posts tagged with

Sort by:
1 - 1 of 11
    User: "Adriano_Koga"
    Altair Employee
    Accepted Answer
    Updated by Adriano_Koga

    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
            }