Created Vector and Retrieving Coordinates of it.

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

hello everyone,

 

I had created the vector from 

Analysis -> Vector

 

now i want to get/retrieve the coordinates of this particular vector to use these coordinates in 

 

*createvector 1 $ox $oy $oz

 

i had tried the hm_getentityvalue to retrieve the coordinates of the vector as we do for nodes

 

set ZVx [hm_getentityvalue vectors $Zvector 'globalx' 0]

 

even not able to find the ID of the vector.

 

please help me in resolving this issue.

 

 

thanks

Adams

Answers

  • tinh
    tinh Altair Community Member
    edited March 2014

    Hello

    There are 2 kinds of vector and your mention is about vector entity. to create it using *vectorcreate

    and refer to data names of vector entity you can find its component (to use with hm_getentityvalue)

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited March 2014

    Hi tinh,

     

    Thanks for replying image/emoticons/default_smile.png' alt=':)' srcset='/emoticons/smile@2x.png 2x' width='20' height='20'>

     

    i am trying to retrieve the coordinates through 'vector' as an entity.

     

    firstly i had created the vector as an entity through 

    *vectordrawoptions 15 0 1

    *vectorcreate_twonode $Node1 $Node2

     

    saved the vector in one variable :

    set Zvector [hm_getmark vectors [*createmark vectors 1 -1]]

     

    then trying to retrieve the coordinates through : 

    set X [hm_getentityvalue vectors $Zvector 'globalx' 0]

    Y...

    Z...

     

    and want to put in : 

    *createvector 1 $X $Y $Z

     

     

    but here value of X, Y, Z is not retrieved.

     

     

    thanks 

    Shivanshu

  • tinh
    tinh Altair Community Member
    edited March 2014

    Hello Shivanshu

    did you read all data names of vector entity?

    please confirm  is it exactly 'globalx' ? this is available for node entity but sometimes it differs from other entities

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited March 2014

    Shivanshu,

     

    For vectors, you should use xcomp, ycomp and zcomp.

     

    http://www.altairhyperworks.com/hwhelp/Altair/hw12.0/help/hwdref/data_names_vectors.htm

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited March 2014

    hi cesar & tinh,

     

    i had tried to retrieved the coordinates of vector with:

     

    set a [hm_getmark vectors [*createmarkpanel vectors 1 -1]]

     

    then for 'X, Y, Z - Coordinate' 

     

    set VX [hm_getentityvalue vectors $a 'xcomp' 0]

     

    set VY [hm_getentityvalue vectors $a 'ycomp' 0]

     

    set VZ [hm_getentityvalue vectors $a 'zcomp' 0]

     

    but its not working.

     

    BASICALLY I WANT TO RETRIEVE THE COORDINATED TO DEFINE THE DIRECTION FROM THIS VECTOR. 

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited March 2014

    Import the following dyna deck into hypermesh using the Dyna profile

     

    $$ HM_OUTPUT_DECK created 06:12:32 03-19-2014 by HyperMesh Version 11.0.0.134
    $$ Ls-dyna Input Deck Generated by HyperMesh Version  : 11.0.0.134-HWDesktop
    $$ Generated using HyperMesh-Ls-dyna 971 Template Version : HW11.0.134-HWDesktop
    *KEYWORD
    *NODE
           1            10.0             5.0             2.5               
           2            15.0            10.0             0.5               
           5 14.531538935183             5.0 4.6130913087035               
    *DEFINE_SD_ORIENTATION
    $HMNAME VECTORCOL       1auto1                                                                  
    $HWCOLOR VECTORCOL       1      11
             1                 1.0       0.0       0.0
    *DEFINE_SD_ORIENTATION
             2          4.53153894       0.02.11309131
    *DEFINE_SD_ORIENTATION
             3                 5.0       5.0      -2.0
    *END

     

    After the import has been completed, copy the following tcl code into a file in your desktop, name the file get.vectors.tcl

     *createmarkpanel vectors 1 'Select vectors';set vectorList [ hm_getmark vectors 1 ];foreach a $vectorList {	set VX [ hm_getentityvalue vectors $a 'xcomp' 0 ];	set VY [ hm_getentityvalue vectors $a 'ycomp' 0 ]; 	set VZ [ hm_getentityvalue vectors $a 'zcomp' 0 ];  puts '$VX $VY $VZ';}

    In the command window type, source path/to/the/file/get.vectors.tcl and review the output.

     

     

  • tinh
    tinh Altair Community Member
    edited March 2014

    hi cesar & tinh,

     

    i had tried to retrieved the coordinates of vector with:

     

    set a [hm_getmark vectors [*createmarkpanel vectors 1 -1]]

     

    then for 'X, Y, Z - Coordinate' 

     

    set VX [hm_getentityvalue vectors $a 'xcomp' 0]

     

    set VY [hm_getentityvalue vectors $a 'ycomp' 0]

     

    set VZ [hm_getentityvalue vectors $a 'zcomp' 0]

     

    but its not working.

     

    BASICALLY I WANT TO RETRIEVE THE COORDINATED TO DEFINE THE DIRECTION FROM THIS VECTOR. 

     

    Hello

    to specify a direction from 2 nodes (or 3 nodes) you can retrieve node coordinates x, y, z and compute vector components by using hwat (or write it yourself)

    This is an example

     

    package require hwat

    *createlistpanel nodes 1 'Select direction by node1->node2'

    set nodelist [hm_getlist nodes 1]

    set nodeid1 [lindex $nodelist 0]

    set nodeid2 [lindex $nodelist 1]

    set coord1 [expr [hm_nodevalue $nodeid1]]

    set coord2 [expr [hm_nodevalue $nodeid2]]

    set vectorcomps [::hwat::math::GetVector $coord1 $coord2];#or you take x,y,z in coord2 plus x,y,z in coord1

    puts $vectorcomps

     

    you don't need to make vector entity

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited April 2014

    thanks tinh & cesar.