tcl - selecting all elements of a component

Jan-Eric Seidel
Jan-Eric Seidel Altair Community Member
edited June 2021 in Community Q&A

Hey

I'm making a tcl script and i want to create add elements to a set by a collector. normaly i would do elements -> by collector -> select collector.

but the command file just gives me:

*setvalue sets id=1 ids={elems 67376-70125}
*setvalue sets id=1 STATUS=0 5422=LIST
 
I don't want no name every element number. I want something like this:
 
*setvalue sets id=1 ids={#all elemets from my collector/component#}
*setvalue sets id=1 STATUS=0 5422=LIST  #and whatever has to be written here
 
thanks

Best Answer

  • Adriano A. Koga
    Adriano A. Koga
    Altair Employee
    edited June 2021 Answer ✓

    you could create a list of elems first:

    I believe it would be something like this.

     

    set comp_ID 10;

    *createmark elems 1 "by comp id" $comp_ID; #select elements by comp (maybe by collector or comp name)

    set elems_list [hm_getmark elems 1]; #store in a list

    *clearmark elems 1

     

    eval "*setvalue sets id=1 ids=\{elems $elems_list\}" ; #write the command to a string and then 'eval' the resulting string

    *setvalue sets id=1 STATUS=0 5422=LIST

     

     

    somethng like this might work..sorry, i haven't tested it.

Answers

  • Adriano A. Koga
    Adriano A. Koga
    Altair Employee
    edited June 2021 Answer ✓

    you could create a list of elems first:

    I believe it would be something like this.

     

    set comp_ID 10;

    *createmark elems 1 "by comp id" $comp_ID; #select elements by comp (maybe by collector or comp name)

    set elems_list [hm_getmark elems 1]; #store in a list

    *clearmark elems 1

     

    eval "*setvalue sets id=1 ids=\{elems $elems_list\}" ; #write the command to a string and then 'eval' the resulting string

    *setvalue sets id=1 STATUS=0 5422=LIST

     

     

    somethng like this might work..sorry, i haven't tested it.

  • Jan-Eric Seidel
    Jan-Eric Seidel Altair Community Member
    edited June 2021

    you could create a list of elems first:

    I believe it would be something like this.

     

    set comp_ID 10;

    *createmark elems 1 "by comp id" $comp_ID; #select elements by comp (maybe by collector or comp name)

    set elems_list [hm_getmark elems 1]; #store in a list

    *clearmark elems 1

     

    eval "*setvalue sets id=1 ids=\{elems $elems_list\}" ; #write the command to a string and then 'eval' the resulting string

    *setvalue sets id=1 STATUS=0 5422=LIST

     

     

    somethng like this might work..sorry, i haven't tested it.

    yes that worked thank you