How to select surfaces with variable IDs

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

Hello,

I am new in this forum.

I am a student and currently working on a project of my university. We generate different STEP-Models and import them with a script in hypermesh. The STEP-Models can have different geometries. The script is producing one component and is meshing the geometry successfully in the first step. Right now, I have a problem with the constraints and the load. Due to the variable geometry, the IDs of the surfaces differ with each run that produces the models. So, at this point I am not able to select the surfaces for the constraints because the IDs are always different (in the script below surface ID 543 and 489).

 

Part of the script:

*startnotehistorystate {Created Constraints}

*createmark surfaces 1 543 489

*loadcreateonentity_curve surfaces 1 3 1 0 0 0 0 0 0 0 0 0 0 0

*createmark loads 0 1 2

*loadsupdatefixedvalue 0 0

*endnotehistorystate {Created Constraints}

 

My question now is how can I select the surfaces without the IDs? The first surface of the constraint is always nearby the point x=0, y=0, z=0 but the second surface can be at any possible position in a distance divided in 1400mm steps. In my current example the two surfaces for the constraints have a distance of 4410mm. But in the next example it could be 5810mm or 7210mm.

I am looking forward to your answers :)/emoticons/default_smile.png' srcset='/emoticons/smile@2x.png 2x' title=':)' width='20' />

 

Kind regards

Tagged:

Answers

  • Merula_20758
    Merula_20758 Altair Community Member
    edited December 2016

    For getting the node you can use: hm_getclosestnode x y z

    For getting the id of the surface you can use hm_getentityinfo nodes [hm_getclosestnode x y z] surfaceid 0 -byid

    For getting the nodes of the surface you can use: hm_createmark nodes 1 'by surface' [hm_getentityinfo nodes [hm_getclosestnode x y z] surfaceid 0 -byid]

     

    Hope this helps ;)/emoticons/default_wink.png' srcset='/emoticons/wink@2x.png 2x' title=';)' width='20' />

     

    Best regards,

    Merula

     

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited December 2016

    Thank you very much. Here is my code for the constraints:

     

    *startnotehistorystate {Created Constraints}
    hm_createmark nodes 1 'by surface' [hm_getentityvalue nodes [hm_getclosestnode 0 0 0] surfaceid 0 -byid]
    *loadcreateonentity_curve nodes 1 3 1 0 0 0 0 0 0 0 0 0 0 0
    *createmark loads 0 1-236
    *loadsupdatefixedvalue 0 0
    *endnotehistorystate {Created Constraints}

     

    Greetings

    Jonas