Intersection Line/Element

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

Hi !

I am currently working on a macro for HyperMesh.

My problem right now is that i have a 2D mesh and some line going through many elements and i want to get the elements that are being crossed by a line.

 

To schematize the thing :

 

 

__l___l_l____l_____l_______l____   

    l      l  l        l          l              l

 

where ' l ' represents my lines and '_' my 2D elements.

 

I want to write a subroutine that could do :

 

 

 foreach lines $LineList {

 

        Give me the element that the line is going through

           

}

 

 

Any ideas how to do this ?

 

I was thinking of creating a 1D element that would replace the line and then try to look for the intersection of both elements (1D/2D) but i can't find out how !!

Maybe with the the hm_collision function, anyone already used it ?

 

Thanks a lot in advance !

 

 

Clément

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2013

    Maybe try to create a temporary surface for each 2D element and look for intersection between the line and surface through the function *nodecreateatintersection ? If intersection node found you got the element and so on.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2013

    Thanks for your answer.

    I was searching for a more direct solution only considering the elements.

    But seems like you have a good solution here !

     

    I will reduce the number of temporary surfaces to create with a hm_createmark elems 1 ' by cylinder',  basing the cylinder characteristics on the nodes of my lines.

     

    Again thank you !