get the line numbers in a perticular hm component

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

can you people any one is having idea about get the line numbers in a perticular component in hypermesh using tcl/tk

Tagged:

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited March 2012

    Hi Kiran,

    please post questions about macros in the Hypermesh macros section.

    I don't understand what you want to do. To get the thickness of a component you can use:

    set compT [ hm_getcompthickness $cid ]

    compT... result, thickness

    cid... component id

    Regards,

    Mario

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited March 2012

    Hi mario ,

    Thanks for your reply . by using set compT [ hm_getcompthickness $cid ] , we can get the thickness only if its assigned . what I want is I want a macro that should calculate the thickness by finding out the distance between the two lines. Hope you got my point

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited March 2012

    Hi Kiran,

    thats not so easy.

    I can post you a short macro to get the distance between two lines. Try to adapt it...

    proc distLineLine {} {

    set selectedLineA ''

    set selectedLineB ''

    *clearmark lines 1

    *createmarkpanel lines 1 'choose line to measure distance from'

    set selectedLines [hm_getmark lines 1]

    set selectedLineA [lindex $selectedLines 0]

    *clearmark lines 2

    *createmarkpanel lines 2 'choose line to measure normal to'

    set selectedLines [hm_getmark lines 2]

    set selectedLineB [lindex $selectedLines 0]

    set listValues [hm_getclosestpointsbetweentwolines $selectedLineA $selectedLineB]

    set xDistance [expr {abs([lindex $listValues 0]-[lindex $listValues 3])}]

    set yDistance [expr {abs([lindex $listValues 1]-[lindex $listValues 4])}]

    set zDistance [expr {abs([lindex $listValues 2]-[lindex $listValues 5])}]

    set distance [expr sqrt(pow($xDistance,2)+pow($yDistance,2)+pow($zDistance,2))]

    tk_messageBox -message 'Distance Line - Line: $distance'

    }

    distLineLine;

    Regards,

    Mario

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited March 2012

    thanxs for Reply. But I dont want this . I want to select that lines automatically in a component.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited March 2012

    thanks

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited March 2012

    Hi,

    sometimes you have to do a little bit by youself ;-)

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited March 2012

    Hi, do you mean that we have to select the line manually in HM. Or We have to try to modify somthing in this program. Please clarify.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited April 2012

    Hi,

    you have to replace the manual selection by a routine for automatic selection...

    Regards

    Mario

  • tinh
    tinh Altair Community Member
    edited December 2012

    Hi KIRAN PUTTA123

    I also think it is not easy to automatically measure thickness because it irregularly depends on CAD.

    For a long time I've developed a tcl procedure to do this but it was not exactly in some cases

    We cannot do anything we want. So just try to simplify your tasks first

    rgds,

    tinh