Checking Whether all nodes in model having "TEMPERATURE" load or not

Vikas Kumar_22189
Vikas Kumar_22189 Altair Community Member
edited October 2020 in Community Q&A

Hi All,

I wrote a tcl\tk script to query whether each node in model is having temperature load or not.
But problem with this script is, It is taking more time execute the code.
Please provide any better script if available.
Current script is taking more than 1.30 Hrs for the number of node 162114.
Please provide if any solution exist as soon as possible.

 

My script is:-

proc validate args {
*clearmark nodes 1;
*nodecleartempmark
*plot
hm_redraw
set selectNode [lindex $args 0]
eval *createmark nodes 1 '$selectNode'
set nodeToChkTemp [hm_getmark nodes 1]

set nodeIDNotHvngTemp ''
set lengthOfN [llength nodeToChkTemp]
set currentTime [clock seconds]
puts 'Start date: [clock format $currentTime -format %D] , Total Nodes: $lengthOfN'
puts 'The time is: [clock format $currentTime -format %H:%M:%S]'
hm_usermessage 'Getting information about temperature on node.......'

foreach node $nodeToChkTemp {
set chk 0
*clearmark loads 1
*clearmark nodes 1
*createmark nodes 1 $node
*findmark nodes 1 1 1 loads 0 2
set loadID [hm_getmark loads 2]

foreach ld $loadID {
set loadType [hm_getvalue loads id=$ld dataname=typename]
if {$loadType == 'TEMPERATURE'} {
set chk 1
break;
}
}

if { !$chk} {
lappend nodeIDNotHvngTemp $node
}
}

*numbersclear
*clearmark nodes 1;
*nodecleartempmark;
set currentTime [clock seconds]
puts 'End date: [clock format $currentTime -format %D]'
puts 'The time is: [clock format $currentTime -format %H:%M:%S]'
puts 'validate nodes: $nodeIDNotHvngTemp'

*startnotehistorystate {isolateonly Component}
*clearmark components 2
*createmark components 2 'all'
*createstringarray 2 'elements_on' 'geometry_on'
*isolateonlyentitybymark 2 1 2
*endnotehistorystate {isolateonly Component}
*plot
hm_redraw
*view 'iso1'
*window 0 0 0 0
hm_usermessage ''
return $nodeIDNotHvngTemp
}
set chkNodeLst [validate 'all']
puts 'validate nodes: $chkNodeLst'

 

 

# SCRIPT END

Regards,

Vikas Kumar

Answers

  • tinh
    tinh Altair Community Member
    edited February 2019

    1st createmark loads by type temp

    2nd findmark nodes attach to above loads

    3rd reverse mark.

  • Vikas Kumar_22189
    Vikas Kumar_22189 Altair Community Member
    edited February 2019

    Hi @tinh

     

    Reverse mark means what ??

    Are you saying about clearmark ?

     

    Regards,

    Vikas Kumar

  • sandeepballiwar
    sandeepballiwar New Altair Community Member
    edited February 2019

    Check the below.

     

    *nodecleartempmark;
    *createmark loads 1 'by config' temperature;
    *findmark loads 1 1 1 nodes 0 2;
    set lst_TemperatureNodes [hm_getmark nodes 2];
    eval *createmark nodes 1 $lst_TemperatureNodes;
    *createmark nodes 1 'reverse';
    *nodemarkaddtempmark 1;

  • Vikas Kumar_22189
    Vikas Kumar_22189 Altair Community Member
    edited February 2019

    Hi Sandeep,

     

    It won't work if temperature load is applied on a 'set' which contains node.

    In this case how temperature will be applied is like,

     

    Will create one load collector which contains load type temperature and that load will carry set as mentioned in below image.

     

    image.png.f5600faed9cfaa1f341fbd8a2e5652c2.png

     

    In that case temperature will be applied indirectly to nodes.

    And, in this scenario we can not check by above method.

    @sandeepballiwar and @tinh pls reply if any other solution is there.

     

    Best Regards,

    Vikas Kumar

  • tinh
    tinh Altair Community Member
    edited February 2019

    Hi,

    don't need *findmark

    try this

    *nodecleartempmark

    *createmark loads 1 'by config' temperature

    *createmark nodes 1 'by loads' {*}[hm_getmark loads 1]

    *createmark nodes 1 reverse

    *nodemarkaddtempmark 1