AssignData Condition

Moderator: GiD Team

Post Reply
gonzaloalen
Posts: 2
Joined: Tue Oct 15, 2019 8:27 am

AssignData Condition

Post by gonzaloalen »

Hello,

I'm trying to assign conditions to entities, through Tcl code, with a command as follows:

set cn_elem 45
GiD_AssignData condition Losses_Model body_elements {0 0 0 0 $cn_elem 0 0 0 0 0 0 0 0} all

However Gid assigns a value "$cn_elem" in the condition (not 45), which is the sintax of the GiD Proccess command to assign a condition with a variable?

Thank you in advance,
Gonzalo
User avatar
escolano
Posts: 1915
Joined: Sun Sep 05, 1982 10:51 pm

Re: AssignData Condition

Post by escolano »

This is a Tcl language rule, { } prevent substitution of variables, to allow substitution you can use " " or better
  • to preserve the amount of arguments, independently on the variable content (e.g. if it has spaces)


    GiD_AssignData condition Losses_Model body_elements "0 0 0 0 $cn_elem 0 0 0 0 0 0 0 0" all
    or better
    GiD_AssignData condition Losses_Model body_elements [list 0 0 0 0 $cn_elem 0 0 0 0 0 0 0 0] all

    Have a look to these Tcl rules: https://wiki.tcl-lang.org/page/Dodekalogue
Post Reply