Jump to content
Sign in to follow this  
Ushay

Error: Can't read "vx1": no such variable

Recommended Posts

Hello all,

 

In a part of my script the vector coordinates are pulled for a later use. When I execute I have the following error message

---------------------------------------------------------------------------------------

Error: 
can't read "vx1": no such variable
    while executing "*createvector 1 $vx1 $vy1 $vz1"

---------------------------------------------------------------------------------------

Code: 

        *vectorcreate_twonode $x $y
        set vectorList [ hm_getmark vectors 1 ];
        foreach vct $vectorList {    
            set vx1 [ hm_getentityvalue vectors $vct "xcomp" 0 ]
            set vy1 [ hm_getentityvalue vectors $vct "ycomp" 0 ]
            set vz1 [ hm_getentityvalue vectors $vct "zcomp" 0 ]
            return "{ $vx1 } { $vy1 } { $vz1 }"
        }
        *createmark nodes 1 $x
        *duplicatemark nodes 1 25
        set r [hm_entitymaxid nodes 1]
        *createvector 1 $vx1 $vy1 $vz1
        *translatemark nodes 1 1 10
-------------------------------------------------------------------------------------------------------------

 

Would be great if someone could tell how to reference the coordinates vx1, vy1 and vz1 in the other parts of the code. 

 

Thanks in advance

 

Share this post


Link to post
Share on other sites

You have a list of vectors but you want to translate it into one direction. The problem is that the variables are only valid within the for loop...

 

try this

 

set vector [*vectorcreate_twonode 1 2]

set vx1 [ hm_getentityvalue vectors $vector "xcomp" 0 ]
set vy1 [ hm_getentityvalue vectors $vector "ycomp" 0 ]
set vz1 [ hm_getentityvalue vectors $vector "zcomp" 0 ]

*createmark nodes 1 1
*duplicatemark nodes 1 25
set r [hm_entitymaxid nodes 1]
*createvector 1 $vx1 $vy1 $vz1
*translatemark nodes 1 1 10

I changed the $x and $y that it works for me... also the createmark command after that...

 

Hope this helps

Livil Lyle likes this

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...