internal nodes selection

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

Hi all,

 

I want to select the internal nodes for any nonuniform hole. So for same i want to write a tcl script. any idea?

I have written script for cylindrical hole. it works perfectly. but what if it is not cylindrical hole.

please suggest me any solution.

Answers

  • tinh
    tinh Altair Community Member
    edited January 2018

    Hi

    suggestion for you:

    - find free edge

    - isolate only ^edges

    - find edge element by initial node

    - find attached edge elements

    - find nodes attached to those elements => hole nodes

  • Pandurang
    Pandurang Altair Community Member
    edited January 2018

    Hi Tinh,

     

    Thanks for your valuable suggestion.

     

    Please refer the attachments for model.

    My model looks similar having tetra mesh (but it could be of any type).

    This model is of two part (upper and lower ) it has some small holes on middle part.

    could you please suggest some API.

    script should select internal nodes for any kind of model similar to one which i attached.

     

    Thanks & Regards,

    Pandurang

     

     

    Axle_Beam_2.PNG.5ecb98f9316dbc54d4f72a408b6c5523.PNGAxle_Beam_1.PNG.54bbe05c8dd03c15983615b82d30eb6c.PNG

     

  • tinh
    tinh Altair Community Member
    edited January 2018
  • Pandurang
    Pandurang Altair Community Member
    edited January 2018

    Hi Tinh,

    Thanks for reply.

     

    I think this wont work in my case. see attached images details of upper part.

    right now i am able select the nodes by changing feature angle.

    but every model wont work.

    I want to create tool with little user interaction, so that it work every time.

    i am just beginner  in hm customization.

    What you say?

     

    Thanks & Regards,

    PD

     

     

    <?xml version="1.0" encoding="UTF-8"?>axle_beam_1.PNG

    <?xml version="1.0" encoding="UTF-8"?>axle_beam_2.PNG

    <?xml version="1.0" encoding="UTF-8"?>axle_beam_3.PNG

  • tinh
    tinh Altair Community Member
    edited January 2018

    If the hole is not cylindrical, you have to know its mathematical formulation, othewise it is impossible applied for every model

    I can do it base on shape of model but it cost much time

  • Pandurang
    Pandurang Altair Community Member
    edited January 2018

    ok.

     

    for time being lets focus on this model 

    is it possible for this model??

     

    Regards,

    PD

  • tinh
    tinh Altair Community Member
    edited January 2018

    Of course it is possible. I just tell that script will not be able to work for every model

  • Pandurang
    Pandurang Altair Community Member
    edited January 2018

    ok.

     

    Would u please guide me to get the solution for this model?

    one solution i thick of is:

    1. create plane whose normal is axis of model.

    2. get the intersection node.

    3. translating plane along axis to get intersecting nodes.

    what u say??

     

    Regards,

    PD

  • tinh
    tinh Altair Community Member
    edited January 2018

    Please show your script codes

  • Pandurang
    Pandurang Altair Community Member
    edited January 2018

    Hi,

     

    I have not started yet:)/emoticons/default_smile.png' srcset='/emoticons/smile@2x.png 2x' title=':)' width='20' />

     

    Regards,

    PD

  • tinh
    tinh Altair Community Member
    edited January 2018

    Please start it up and show your codes

  • Pandurang
    Pandurang Altair Community Member
    edited January 2018

    Hi Tinh

     

    --first i find faces of selected compt then isolate it.
    --create center at one side get that node id as ::node_1
    --create center at other side get that node id as ::node_2
    --get dist bet them and store in ::dist


    # vector 

    *vectorcreate_twonode $n1 $n2;
    *vectordrawoptions size 1 0.1
    *createmark vectors 1 -1;
    set ::vectorCord [ hm_getmark vectors 1 ]


    eval set baseNodeCoords [hm_nodevalue $::node_1]
    set x [lindex $baseNodeCoords 0];
    set y [lindex $baseNodeCoords 1];
    set z [lindex $baseNodeCoords 2];

    set i [ hm_getentityvalue vectors $::vectorCord 'xcomp' 0 ];
    set j [ hm_getentityvalue vectors $::vectorCord 'ycomp' 0 ];
    set k [ hm_getentityvalue vectors $::vectorCord 'zcomp' 0 ];
    *createmark nodes 1 'on plane' $x $y $z $i $j $k 0.1 1 0
    set ::planeNodes [hm_getmark nodes 1]


    # Translate node along created vector & mark nodes by plane there 
        
    for {set trans 0.1} {$trans <= $::dist} {set trans [expr $trans + 0.1] } {
        *createmark nodes 2 $::node_1;
        *duplicatemark nodes 2 28;
        *createmark nodes 2 -1;
        *createvector 1 $i $j $k;
        *translatemark nodes 2 1 $trans;
        *createmark nodes 2 -1
        set trans_node [hm_getmark nodes 2];
        eval set baseNodeCoords [hm_nodevalue [hm_getmark nodes 2]];
        set x [lindex $baseNodeCoords 0];
        set y [lindex $baseNodeCoords 1];
        set z [lindex $baseNodeCoords 2];
        *createmark nodes 1 'on plane' $x $y $z $i $j $k 0.1 1 0
        eval lappend ::planeNodes [hm_getmark nodes 1];
        
        }
            
    eval *createmark nodes 1 $::planeNodes;    
    *findmark nodes 1 0 1 nodes 0 2

     

    This code is selects all nodes in that plane but i want only internal nodes.

    is there any API to do that.

    Regards,

    PD

     

  • tinh
    tinh Altair Community Member
    edited January 2018

    Can you select all internal nodes by feature angle?

    Then you can use *markintersection to get nodes on plane and at internal side

  • tinh
    tinh Altair Community Member
    edited January 2018

    I have another idea, 

    can you detect these 4 tip nodes by tcl script?

    if you can, it is easy to create 4 feature edges => we can select internal nodes by 90D feature angle

    axle_beam_3.thumb.PNG.e60b71fd6ab838af4fe2fd5f1df5ebfa.PNG.af5ea1d3db6cfe8b8e422a52f9bcd784.PNG

  • Pandurang
    Pandurang Altair Community Member
    edited January 2018

     

    Hi,

     

    We can ask user to select these four tip nodes.

     

  • tinh
    tinh Altair Community Member
    edited January 2018

    I think we can detect the 4 nodes by using hm_getclosestnode

    But first, we have to know position of your part relatively to origin (basic system XYZ)

    example X is red and Y is green, take P1 and P2 are two positions very far from model

    then the 4 tip nodes is:

    set Node1 [hm_getclosestnode $P1x $P1y $P1z]

    set Node2 ... ;#we have to choose appropriate P1 and P2 , maybe 4 positions are needed

    <?xml version="1.0" encoding="UTF-8"?>axle_beam_2.thumb.PNG.02163c7165a25b77d5bd66ebbec94217.thumb.PNG.3ebfd7347baa466379906cf659fc9212.PNG

    <?xml version="1.0" encoding="UTF-8"?>axle_beam_3.thumb.PNG.e60b71fd6ab838af4fe2fd5f1df5ebfa.PNG

  • tinh
    tinh Altair Community Member
    edited January 2018

     

    Hi,

     

    We can ask user to select these four tip nodes.

     

     

    OK ask user to select them is the simplest way

  • tinh
    tinh Altair Community Member
    edited January 2018

    So assume that use will select 4 nodes by this order:

    axle_beam_3.thumb.PNG.e60b71fd6ab838af4fe2fd5f1df5ebfa.PNG.bb0d16e969f6e30a9644a78171fc8b57.PNG

     

    and we will store them as Node1 Node2 Node3 Node4

     

    *createlistpanel nodes 1 'Select 4 nodes:'

    set TipNodes [hm_getlist nodes 1]

    if {[llength $TipNodes]!=4} return

    lassign $TipNodes Node1 Node2 Node3 Node4

     

    #Now try getting nodes on 4 edges:

    *nodelistbypath $Node1 $Node2 1

    set Edge12 [hm_getlist nodes 1]

    *nodelistbypath $Node2 $Node3 1

    set Edge23 [hm_getlist nodes 1]

    *nodelistbypath $Node3 $Node4 1

    set Edge34 [hm_getlist nodes 1]

    *nodelistbypath $Node4 $Node1 1

    set Edge41 [hm_getlist nodes 1]

  • tinh
    tinh Altair Community Member
    edited January 2018

    Can you create 4 feature edges from above 4 nodelist?

  • tinh
    tinh Altair Community Member
    edited January 2018

    Try

    eval *createlist nodes 1 $Edge12 

    *features_add 1 0 0

    eval *createlist nodes 1 $Edge23

    *features_add 1 0 0

    eval *createlist nodes 1 $Edge34 

    *features_add 1 0 0

    eval *createlist nodes 1 $Edge41 

    *features_add 1 0 0

     

    #now set a high feature angle to select all internal nodes:

    *featureangleset 180

    *createmark nodes 1 $FirstNode;

    *appendmark nodes 1 'by face'

    *featureangleset 30

    set InternalNodes [hm_getmark nodes 1]

  • Pandurang
    Pandurang Altair Community Member
    edited January 2018

    i tried...

    but it select all nodes..

     

    Regards,

    PD

  • Pandurang
    Pandurang Altair Community Member
    edited January 2018

    I just want to know...what is use of adding feature edges?/

     

    Regards,

    PD

  • tinh
    tinh Altair Community Member
    edited January 2018

    Did you see yellow feature edges?

    could you shift+F2 and select a node and select 'by face', observe how the nodes are being selected?

    adding feature edge will cause selection 'by face' stopped at the feature

  • Pandurang
    Pandurang Altair Community Member
    edited January 2018

    Yes there are yellow feature edges.

    i tried shift+F : but still it select all nodes

    I think its becoz there are some hole in that part..

    so do we need to add features edges around them as well? 

     

    ..........

     

  • Pandurang
    Pandurang Altair Community Member
    edited January 2018

    Hi Tinh,

     

    Thank you very very much for sharing your knowledge ,guidance, valuable time and quick replies:)/emoticons/default_smile.png' srcset='/emoticons/smile@2x.png 2x' title=':)' width='20' />.

     

    I tried creating feature edges at hole as well. 

    Now It work Perfectly.

    I am able to see internal nodes get selected.

     

    Now one thing is there any API to detect these hole in any part??

     

    Once again Thanks Lot:)/emoticons/default_smile.png' srcset='/emoticons/smile@2x.png 2x' title=':)' width='20' />

     

    Regards,

    PD

  • tinh
    tinh Altair Community Member
    edited January 2018

    It's true. Because there are holes.

    you have to add feature edge around holes, too

    to fetch holes, use 

    http://forum.altairhyperworks.com/index.php?/topic/20966-selecting-co-linear-nodes/&tab=comments#comment-47901