renumber or set as variable a specific domain by tcl

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Hi everybody,

 

I would like to renumber or to set as variable a specific domain. How can I do this in HM by usage of a tcl?

I tried the following:

 

*createmark domains 1 'by box' 0 10 12 0 11 13 0 inside 0 1 0

*renumbersolverid domains 1 101 1 0 0 0 0 0

 

But I got the error message 'Domains are not selectable with 'by box''

 

Which other command could I use instead of 'by box'? I just want to renumber or set as variable one of my 5 created Domains!

 

Thanks in advance

 

<?xml version="1.0" encoding="UTF-8"?>HM_Q3.PNG

Answers

  • tinh
    tinh Altair Community Member
    edited June 2018

    try create mark that domain 'by node' or 'by elem' ,...

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2018

     

    I tried this too but I get the message:

     

    Domains are not selectable with 'by node'

    Domains are not selectable with 'by element'

     

    ...

  • tinh
    tinh Altair Community Member
    edited June 2018

    If you cannot select the domain by any tag, you have to make a loop for each domain, compare its position with one you concern about, if they are match then you can pick up that domain to renumber

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2018

    If you cannot select the domain by any tag, you have to make a loop for each domain, compare its position with one you concern about, if they are match then you can pick up that domain to renumber

    Hi tinh,

     

    thanks for your reply.

    In the meantime I tried to do it by generating new handles but unfortunatly this doesn't work too. :(/emoticons/default_sad.png' srcset='/emoticons/sad@2x.png 2x' title=':(' width='20' />

     

    So I will try with a while {} command

    As I'm not that good in tcl scripting colud you please give me a hint how to go on?

     

    I know at least one node (Node ID = 177) of the domain and I know that I can get the nodes of the needed domain by the command 'hm_morph_getdomainnodes' but how to put those informations together?

     

    Thanks in advance

     

    *Edit:

     

    I tired this, but it doesn't work and I don't konw why ...

     

    *createmark node 1 'by box' 0 9.99 13.51 0 10.01 12.4 0 inside 0 1 0

    set nodelist1 [hm_getmark node 1 0]

    ##

    set domaintmp [hm_morph_getdomainnodes 1]
    set domain [lsort -dictionary $domaintmp]

    ##
    while {$domain != $nodelist1} {
    set domaintmp [hm_morph_getdomainnodes 4]
    set domain [lsort -dictionary $domaintmp]
    set domaintmp [hm_morph_getdomainnodes 5]
    set domain [lsort -dictionary $domaintmp]
    set domaintmp [hm_morph_getdomainnodes 6]
    set domain [lsort -dictionary $domaintmp]
    set domaintmp [hm_morph_getdomainnodes 7]
    set domain [lsort -dictionary $domaintmp]
    }
    *createmark domains 1 $domain
    *renumbersolverid domains 1 10 1 0 0 0 0 0
     

    domain 4 should be the one which should be renumbered...

     

  • tinh
    tinh Altair Community Member
    edited June 2018

    Hi Tomislav,

    the code looks like this:

     

    *createmark domains 1 all

    foreach DomainId [hm_getmark domains 1] {

          *createmark nodes 1 'by domain' $DomainId

          if {[hm_checkmark nodes 1 177]} {

                 *createmark domains 1 $DomainId
                   *renumbersolverid domains 1 10 1 0 0 0 0 0

          }

    }

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2018

    Hi Tomislav,

    the code looks like this:

     

    *createmark domains 1 all

    foreach DomainId [hm_getmark domains 1] {

          *createmark nodes 1 'by domain' $DomainId

          if {[hm_checkmark nodes 1 177]} {

                 *createmark domains 1 $DomainId
                   *renumbersolverid domains 1 10 1 0 0 0 0 0

          }

    } 

     

    Hi tinh,

     

    it works perfectly! :D/emoticons/default_biggrin.png' srcset='/emoticons/biggrin@2x.png 2x' title=':D' width='20' />

     

    Many thanks for your support! You are incredible!

     

    THANK YOU VERY VERY MUCH!!!!