TCL error: entity not found

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

Hi all,

I am new at TCL macros and I tried to write the script above for get coordinates of box that includes selected nodes in HyperMesh.

*createmarkpanel nodes 1 'Select the nodes'
set nodeid [hm_getmark nodes 1]
set n [llength $nodeid]

set m [lindex $nodeid 0]
set x [hm_getentityvalue nodes $m 'x' 0]
set y [hm_getentityvalue nodes $m 'y' 0]
set z [hm_getentityvalue nodes $m 'z' 0]

set bx $x
set by $y
set bz $z
set kx $x
set ky $y
set kz $z

for {set i 1} {$i < $n}{incr i 1} {
set m [lindex $nodeid $i]
set x [hm_getentityvalue nodes $m 'x' 0]
set y [hm_getentityvalue nodes $m 'y' 0]
set z [hm_getentityvalue nodes $m 'z' 0]
if {$x > $bx} {set bx $x}
if {$y > $by} {set by $y}
if {$z > $bz} {set bz $z}
if {$x < $kx} {set kx $x}
if {$y < $ky} {set ky $y}
if {$z < $kz} {set kz $z}
}

hm_usermessage 'x1:[expr $bx+1] y1:[expr $by+1] z1:[expr $bz+1] x2:[expr $kx-1] y2:[expr $ky-1] z2:[expr $kz-1]'

When I run the script HM gives me the error above:

Tcl Error : hm_getentityvalue: entity not found.

while executing

'hm_getentityvalue nodes $m 'x' 0'

invoked from within

'set x [hm_getentityvalue nodes $m 'x' 0] '

Can anyone help about this error?

Thanks

Tuncel

Tagged:

Answers

  • tinh
    tinh Altair Community Member
    edited January 2013

    Hi Tuncel

    line 'for {set i 1} {$i < $n}{incr i 1} {' missing a space between } and {

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited January 2013

    Than you so much Tinh. I changed the script, it is working now.

    for {set i 1} {$i < $n} {incr i 1} {
    set x [hm_getentityvalue nodes [lindex $nodeid $i] 'x' 0]
    set y [hm_getentityvalue nodes [lindex $nodeid $i] 'y' 0]
    set z [hm_getentityvalue nodes [lindex $nodeid $i] 'z' 0]