Check if an assembly/set is already available in a model

User: "Altair Forum User"
Altair Employee
Updated by Altair Forum User

Hello guys,

 

I am new here and have less experience in scripting. I hope you can help me.  image/emoticons/default_smile.png' alt=':)' srcset='/emoticons/smile@2x.png 2x' width='20' height='20'>

My problem is the following one. I would like to check if an assembly and a set are already available in a model. I want do it by the assembly/set name.

For example, I want to to check if the assembly with the name xx is already available. When no, a new assembly is created. When yes, nothing is done.

Which command lines I have to use doing it? Thanks.

 

Find more posts tagged with

Sort by:
1 - 2 of 21
    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    Try this code:


    set assyName 'Toto';
    if { [hm_entityinfo exist assems $assyName -byname] == 1 } {
    puts 'Assy $assyName exists!'
    } else {
    puts 'Assy $assyName not found!'
    }

    Just change 'assems' to 'sets' for checking overs Sets.

     

    HTH,

     

    User: "Altair Forum User"
    Altair Employee
    OP
    Updated by Altair Forum User

    That helps. Thanks.  image/emoticons/default_smile.png' alt=':)' srcset='/emoticons/smile@2x.png 2x' width='20' height='20'>