How to get normal x of vector created by two nodes

Jouher_20929
Jouher_20929 Altair Community Member
edited October 2020 in Community Q&A

How to get normal x of vector created by two nodes

Answers

  • Pandurang
    Pandurang Altair Community Member
    edited April 2018

    Hi Jouher,

    Please try this:

     

    *vectorcreate_twonode $node1 $node2;
    *createmark vectors 1 -1;
    set ::vectorCord [ hm_getmark vectors 1 ]
    set x [ hm_getentityvalue vectors $::vectorCord 'xcomp' 0 ];
     

  • Jouher_20929
    Jouher_20929 Altair Community Member
    edited April 2018


             *createmarkpanel nodes 1 'Select N1...'
             set n1 [hm_getmark nodes 1]
             hm_markclear nodes 1

                set n1x [ hm_getentityvalue NODES $n1 'globalx' 0 ]
                set n1y [ hm_getentityvalue NODES $n1 'globaly' 0 ]
                set n1z [ hm_getentityvalue NODES $n1 'globalz' 0 ]

       
             *createmarkpanel nodes 1 'Select N2...'
             set n2 [hm_getmark nodes 1]
             hm_markclear nodes 1

                set n2x [ hm_getentityvalue NODES $n2 'globalx' 0 ]
                set n2y [ hm_getentityvalue NODES $n2 'globaly' 0 ]
                set n2z [ hm_getentityvalue NODES $n2 'globalz' 0 ]

          *createmarkpanel nodes 1 'Select N3...'
          set n3 [hm_getmark nodes 1]
          hm_markclear nodes 1

          set vec1x [expr $n2x - $n1x]
          set vec1y [expr $n2y - $n1y]
          set vec1z [expr $n2z - $n1z]

             set n3x [ hm_getentityvalue NODES $n3 'globalx' 0 ]
             set n3y [ hm_getentityvalue NODES $n3 'globaly' 0 ]
             set n3z [ hm_getentityvalue NODES $n3 'globalz' 0 ]

         set vec2x [expr $n3x - $n2x]
         set vec2y [expr $n3y - $n2y]
             set vec2z [expr $n3z - $n2z]

             set vecx [expr $vec1y*$vec2z - $vec1z*$vec2y]
             set vecy [expr $vec1z*$vec2x - $vec1x*$vec2z]
             set vecz [expr $vec1x*$vec2y - $vec1y*$vec2x]
    *createmark nodes 1 236
             *createvector 1 $vecx $vecy $vecz
     
    *translatemark nodes 1 1 5

  • Pandurang
    Pandurang Altair Community Member
    edited April 2018

    Hi,

    Do u want to translate the node 236 along created vector from 3 node selection or 2 node?