🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

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

User: "Vikas Kumar_22189"
Altair Community Member
Updated by Vikas Kumar_22189

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

Find more posts tagged with

Sort by:
1 - 5 of 51
    User: "tinh"
    Altair Community Member
    Updated by tinh

    1st createmark loads by type temp

    2nd findmark nodes attach to above loads

    3rd reverse mark.

    User: "Vikas Kumar_22189"
    Altair Community Member
    OP
    Updated by Vikas Kumar_22189

    Hi @tinh

     

    Reverse mark means what ??

    Are you saying about clearmark ?

     

    Regards,

    Vikas Kumar

    User: "sandeepballiwar"
    New Altair Community Member
    Updated by sandeepballiwar

    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;

    User: "Vikas Kumar_22189"
    Altair Community Member
    OP
    Updated by Vikas Kumar_22189

    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

    User: "tinh"
    Altair Community Member
    Updated by tinh

    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