How to check if a specific solid has been meshed in HyperMesh using TCL?

asdfsdfasdfasdfasdf
asdfsdfasdfasdfasdf Altair Community Member

I have a question. After selecting a solid, how can I determine if this solid has already been meshed?

My current method doesn't seem to detect this properly. Do you know any TCL commands or approaches that can help with this?

hm_createmark elems 1 "by solids" $solid_id

My original idea was to first identify the component containing the selected solid, and then use [hm_getmark elems 1] to check if elements exist. However, this approach seems problematic if the component contains multiple solids, and the elements happen to be associated with other solids rather than the one I selected.

Tagged:

Welcome!

It looks like you're new here. Sign in or register to get started.

Best Answer

  • Fred_Juras
    Fred_Juras
    Altair Employee
    Answer ✓

    Hi,


    There's no API to select unmeshed solids. But there's one for unmeshed surfaces ⇒ hm_getunmeshedsurfstomark

    For instance:

    #select all surfaces
    *createmark surfaces 1 all
    #get unmeshed surfaces in mark 2
    hm_getunmeshedsurfstomark 1 2
    #retrieve solids from previous unmeshed surfaces
    hm_createmark solids 1 "by surface on mark"

    Does this method work for you?

    Regards,
    Fred.

Answers

  • Fred_Juras
    Fred_Juras
    Altair Employee
    Answer ✓

    Hi,


    There's no API to select unmeshed solids. But there's one for unmeshed surfaces ⇒ hm_getunmeshedsurfstomark

    For instance:

    #select all surfaces
    *createmark surfaces 1 all
    #get unmeshed surfaces in mark 2
    hm_getunmeshedsurfstomark 1 2
    #retrieve solids from previous unmeshed surfaces
    hm_createmark solids 1 "by surface on mark"

    Does this method work for you?

    Regards,
    Fred.

  • asdfsdfasdfasdfasdf
    asdfsdfasdfasdfasdf Altair Community Member

    thanks a lot.

    i try this code.and the code is useful for shell mesh,

    if i want to check "solid mesh",how to check by your code in advanced

  • asdfsdfasdfasdfasdf
    asdfsdfasdfasdfasdf Altair Community Member
    edited March 22

    proc is_solid_meshed {solid_id} {
    set comp_id [hm_getvalue solids id=$solid_id dataname=collector.id]
    hm_createmark elems 1 "by collector" $comp_id
    set elems_temp [hm_getmark elems 1]

    set catch_result [catch {
    eval *createmark elems 1 $elems_temp
    *findfaces elems 1
    }]

    if {$catch_result != 0} {
    # Solid not mesh
    return 0
    } else {
    # Solid meshed
    *createmark components 1 "^faces"
    *deletemark components 1
    return 1
    }

    }
    set solid_id 215
    is_solid_meshed $solid_id

    Could my phrasing above be improved in any way?

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.