Logic to Select nearby nodes (of shellmesh) to which hexa is projected? See the image.

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

Logic to Select nearby nodes (of shellmesh) to which hexa is projected? See the image.

<?xml version="1.0" encoding="UTF-8"?>image.png

Answers

  • Jouher_20929
    Jouher_20929 Altair Community Member
    edited April 2018

    Hi, Please help me to sort this issue. 

    I have created a vector using the above code. by createmark nodes 1 'by cylinder' option is selecting nodes of wrong component. Vector is created using two nodes shown in the figure by red arrow.

     

    ############################
    #
    #  Select Node of hexa to calculate
    #
    ############################

    *createmarkpanel nodes 1
    set nids [hm_getmark nodes 1]


    ############################
    #
    #  Select all Nodes of hexa
    #
    ############################
    *createmark nodes 2 displayed
    set nd [hm_getmark nodes 2]


    *createmark elements 1 displayed
    set eled [hm_getmark nodes 1]
    ############################
    #
    #  Calculate coordinates of hexa node selected
    #
    ############################
    set x1 [hm_getentityvalue nodes $nids 'x' 0]
    set y1 [hm_getentityvalue nodes $nids 'y' 0]
    set z1 [hm_getentityvalue nodes $nids 'z' 0]
    *createmark nodes 1 {*}$nd
    hm_createmark elems 1 'by config' hex8
    *createmark nodes 2 $nids
    set cln [hm_getclosestnode $x1 $y1 $z1 1 2]
    puts $cln

    ############################
    #
    #  Create Vector
    #
    ############################

    set x2 [hm_getentityvalue nodes $cln 'x' 0]
    set y2 [hm_getentityvalue nodes $cln 'y' 0]
    set z2 [hm_getentityvalue nodes $cln 'z' 0]


    *createmark nodes 1 'by cylinder' $x1 $y1 $z1 $x2 $y2 $z2 10 1 inside 0 1 0
    *nodemarkaddtempmark 1
    set cnd [hm_getmark nodes 1]

    puts 'The selected node: $nids and Closest node: $cln'
    puts 'the nodes are $cnd'

     

    image.png.cf908dfb4236b2dda0105b5135ee5f0f.png