hm toolbars

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

Hi all.

i made some hypermesh macros in form of 'toolbar'

if you feel it interesting, please send me your mcid  image/emoticons/default_wink.png' alt=';)' srcset='/emoticons/wink@2x.png 2x' width='20' height='20'>

Answers

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2014

    Congratulations,it really looks so interesting  image/emoticons/default_smile.png' alt=':)' srcset='/emoticons/smile@2x.png 2x' width='20' height='20'>

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2014

    Interesting! But if you could share us how to do that, it's even more interesting image/emoticons/default_smile.png' alt=':)' srcset='/emoticons/smile@2x.png 2x' width='20' height='20'>

  • tinh
    tinh Altair Community Member
    edited November 2014

    Interesting! But if you could share us how to do that, it's even more interesting image/emoticons/default_smile.png' alt=':)' srcset='<fileStore.core_Emoticons>/emoticons/smile@2x.png 2x' width='20' height='20'>

    Hiii Mr.Quy

    to measure (diameter, surf-surf distance, ...) => click on corresponding toolbar buttons

    pick a circle => it shows diameter and radius

    pick 2 surfs => it shows distance

    pick a surf then a line => it shows distance,

    ...

    i add options to measure distance at closest position or picking position (ex. if in case 2 surfs or surf-line are not parallel)

    <?xml version="1.0" encoding="UTF-8"?>post-3195-0-93804400-1416965578_thumb.pn

    <?xml version="1.0" encoding="UTF-8"?>post-3195-0-01474400-1416965589_thumb.pn

    <?xml version="1.0" encoding="UTF-8"?>post-3195-0-17153100-1416965595_thumb.pn

    <?xml version="1.0" encoding="UTF-8"?>post-3195-0-54457600-1416965597_thumb.pn

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2014

    No, I'm speaking about ...  TCL script, not its usage image/emoticons/default_wink.png' alt=';)' srcset='/emoticons/wink@2x.png 2x' width='20' height='20'>

  • tinh
    tinh Altair Community Member
    edited November 2014

    image/emoticons/default_biggrin.png' alt=':D' srcset='/emoticons/biggrin@2x.png 2x' width='20' height='20'> it's a secret!

    i'll give a brief explain (actually difficult to explain fully in english, i am sorry)

    - diameter measure: i used only command hm_getbestcircle, it return diameter value directly just in one click

    - surf-surf measure: when click on surf, it creates a node at clicking position, the node then projected to alternative surf, projecting direction is not normal to the surf but make equally angle with each surf (so in case 2 surfs not parallel then => get correct distance)

    - surf-line measure: similar to surf-surf, but temp node will be created on line, it then projected normally to surf (to find normal distance) and hm_getdistancefromnearest on surf to get true distance

    - line-line measure: similar to surf-surf, but after temp node created on a line, a closest position from it on the alternative line will be get (hm_getdistancefromnearest)

    - segment-segment (used when measuring height of a bead): i do some vector operations to find common perpendicular line of the two segment, length of it is distance between 2 segments, with option 'extended closest postion' then this value is reported, in case of 'closest position' it is compared to relative position between 2 segments ( as edge-to-edge contact calculation)


     
     
  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2014

    Thank you!

    I'm looking for a sample code to create a customized toolbar like yours. I searched within HM's documents but I found nothing for this moment image/emoticons/default_smile.png' alt=':)' srcset='/emoticons/smile@2x.png 2x' width='20' height='20'>

  • tinh
    tinh Altair Community Member
    edited November 2014

    Hii Mr.Quy

    below is code to make my toolbar

    actually create toolbar can be done as in 'hmsettings.tcl' file. but i modify something to fix errors when starting hm or first invoking to the functions

    image/emoticons/default_cool.png' alt='B)'>


    proc ::nvtb:_DestroyToolBar {ToolBarName} {
    if {[winfo exists ._ViviToolBar-$ToolBarName]} {
    destroy ._ViviToolBar-$ToolBarName
    }
    foreach window [winfo children .] {
    if {[string match *.minibartoplevel* $window]} {
    foreach window2 [winfo children $window] {
    if {[string match *ViviToolBar-$ToolBarName* $window2]} {
    destroy $window
    break
    }
    }
    }
    }
    }
    proc ::nvtb:_CreateMeasurementToolBar {} {
    ::HM_Framework:_CreateMinibar . ViviToolBar-Measurement HyperMesh:HyperMesh:_blank
    ::HM_Framework:_SetMinibarIconList ViviToolBar-Measurement [list \
    [list [list p_CreateMinibarIcon [file join $::nvtb::v_ImageDir MeasureCircleDiameter-24.png ] 'if {!\[namespace exists ::nvtb\]} {source \'$::nvtb::v_InfoScript\'; ::nvtb:_MeasureCircleDiameter } else {::nvtb:_MeasureCircleDiameter }' {Circle Diameter} 1] ] \
    [list [list p_CreateMinibarIcon [file join $::nvtb::v_ImageDir MeasureDistanceSurfSurf-24.png ] 'if {!\[namespace exists ::nvtb\]} {source \'$::nvtb::v_InfoScript\'; ::nvtb:_MeasureDistanceSurfSurf } else {::nvtb:_MeasureDistanceSurfSurf }' {Surf-Surf Distance} 1] ] \
    [list [list p_CreateMinibarIcon [file join $::nvtb::v_ImageDir MeasureDistanceSurfLine-24.png ] 'if {!\[namespace exists ::nvtb\]} {source \'$::nvtb::v_InfoScript\'; ::nvtb:_MeasureDistanceSurfLine } else {::nvtb:_MeasureDistanceSurfLine }' {Surf-Line Distance} 1] ] \
    [list [list p_CreateMinibarIcon [file join $::nvtb::v_ImageDir MeasureDistanceLineLine-24.png ] 'if {!\[namespace exists ::nvtb\]} {source \'$::nvtb::v_InfoScript\'; ::nvtb:_MeasureDistanceLineLine } else {::nvtb:_MeasureDistanceLineLine }' {Line-Line Distance} 1] ] \
    [list [list p_CreateMinibarIcon [file join $::nvtb::v_ImageDir MeasureDistanceSegmSegm-24.png ] 'if {!\[namespace exists ::nvtb\]} {source \'$::nvtb::v_InfoScript\'; ::nvtb:_MeasureDistanceSegmSegm } else {::nvtb:_MeasureDistanceSegmSegm }' {Segment-Segment Distance} 1] ] \
    [list [list p_CreateMinibarIcon options-24.png 'if {!\[namespace exists ::nvtb\]} {source \'$::nvtb::v_InfoScript\'; ::nvtb:_Options } else {::nvtb:_Options }' {Options} 1 ] ] \
    ]
    ::HM_Framework:_AddMinibarToDockframe ViviToolBar-Measurement .mainFrame.dockframe_top
    set ::HM_Framework::Minibar::ViviToolBar-Measurement:_status 1
    }
    proc ::nvtb:_CreatePullDownMenuForToolBar {ToolBarName} {
    #set menu [. cget -menu].view.toolbars
    set menu [hm_framework getpulldowns].view.toolbars
    if {[catch {$menu index ViviToolBar-${ToolBarName}}]} {
    $menu add checkbutton \
    -indicatoron 1 \
    -offvalue 0 \
    -onvalue 1 \
    -variable ::HM_Framework::Minibar::ViviToolBar-${ToolBarName}:_status \
    -command '::HM_Framework:_ToggleMinibar ViviToolBar-${ToolBarName}' \
    -label ViviToolBar-${ToolBarName} \
    -underline 0
    return 0
    } else {
    return 1
    }
    }
  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2014

    Hi tinh,

     

    Thank you so much for sharing it with us image/emoticons/default_smile.png' alt=':)' srcset='/emoticons/smile@2x.png 2x' width='20' height='20'>

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited November 2014

    Thank you so much Tinh!

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited December 2014

    Hi.. Would you please send me the code.. suresh.babuks@gmail.com

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited December 2014

    Thanks for sharing.. Is this the complete code??

  • tinh
    tinh Altair Community Member
    edited December 2014

    Thanks for sharing.. Is this the complete code??

     

    Hi, below is complete code, after some persons used, i fix some bugs

    now already 4 persons use it  image/emoticons/default_biggrin.png' alt=':D' srcset='/emoticons/biggrin@2x.png 2x' width='20' height='20'>

    If you like, please send me your MCID, i just want to record number of users

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited December 2014

    Hi tinh,

     

    What is the MCID?

     

    and when i try to run this script it is also saying 'COULD NOT VERIFY MCID'.

     

    What should i do?

     

    Reg

    Karthi

  • tinh
    tinh Altair Community Member
    edited December 2014

     

     

    Hi tinh,

     

     

     

    What is the MCID?

     

     

     

    and when i try to run this script it is also saying 'COULD NOT VERIFY MCID'.

     

     

     

    What should i do?

     

     

     

    Reg

     

    Karthi

     

     

     

     

     

     

     

    Really? Could you try again with this new updated: 

     

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited December 2014

    I tried with the updated one also..
     
    It is also coming same

     

    Unexpected Error

     

    Could not verify your MCID. Please contact to tinh411@gmail.com

  • tinh
    tinh Altair Community Member
    edited January 2015

    Hi all

     

    this second toolbar has auto-detect mesh features and help fast create some element patterns with less picking

     

     

    :D/emoticons/default_biggrin.png' srcset='/emoticons/biggrin@2x.png 2x' width='20'>

     

     

     

     

     

     

  • tinh
    tinh Altair Community Member
    edited January 2015

    Hi all

     

    i finished set of 3 toolbars. Hope new hypermesh version will have new nicelooking ones  B)/emoticons/default_cool.png'>

     

     

    <?xml version="1.0" encoding="UTF-8"?>post-3195-0-69576900-1421398963_thumb.pn

     

     

     

     

     

     

     

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited March 2015

    It is throwing Error while executing this  script in Hyperworks 12.0

     

    Can you please help me on this .I am trying to call the tcl file which was provided in the zip file

     

    Regards

    sri

     

     

  • tinh
    tinh Altair Community Member
    edited March 2015

    It is throwing Error while executing this  script in Hyperworks 12.0

     

    Can you please help me on this .I am trying to call the tcl file which was provided in the zip file

     

    Regards

    sri

     

     

    Hi,

    could you please inform me what error occurred?

     

    input below command at command window to know detail

    set errorInfo

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited July 2015

     can you please share the macro as tcl file

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited July 2015

    #created
    #varthamanan
    proc CreateToolBar { carName jataList } {

        #Create Toolbar
        ::HM_Framework:image/emoticons/default_tongue.png' alt=':P' srcset='/emoticons/tongue@2x.png 2x' width='20' height='20'>_CreateMinibar . $carName;

        #Add Icon
        foreach Data $jataList {
            set iconfile [ lindex $Data 2 ]
            set cmd [ lindex $Data 1 ]
            set name [ lindex $Data 0 ]
            ::HM_Framework:image/emoticons/default_tongue.png' alt=':P' srcset='/emoticons/tongue@2x.png 2x' width='20' height='20'>_AddIconToMinibar $carName \
                             [ list p_CreateMinibarIcon [ file tail $iconfile ] $cmd $name 1 ];
            }


        #Pack Toolbar
        ::HM_Framework:image/emoticons/default_tongue.png' alt=':P' srcset='/emoticons/tongue@2x.png 2x' width='20' height='20'>_AddMinibarToDockframe $carName .dockframe_center;

        #Destroy

    }

    proc RedrawWindows { } {
        set pos [ hm_getcommandposition ]

        if { $pos == 'top' } {
            hm_setcommandposition bottom
            hm_setcommandposition top
        } else {
            hm_setcommandposition top
            hm_setcommandposition bottom
        }
    }

    set jataList ''
    # quick edit panel
    set EditIcon 'nodesInterpolateOnSurf-24.gif'
    set jataList '$jataList { {Quick Edit} { ::face {args} } $EditIcon }'
    # automesh panel
    set MeshIcon 'meshLines-32.gif'
    set jataList '$jataList { {AutoMesh} { hm_pushpanel \'automesh\' } $MeshIcon }'
    # check panel
    set CheckIcon 'check.gif'
    set jataList '$jataList { {Element Checks} { hm_pushpanel \'check elems\' } $CheckIcon }'
    #
    # vis button
    set MeshIcon 'distanceBetweenNodes-24.gif'
    set jataList '$jataList { {Distance} { hm_pushpanel \'distance\' } $MeshIcon }'
    #
    # vis button
    set MeshIcon 'edgesGeneral-24.gif'
    set jataList '$jataList { {Edges} { hm_pushpanel \'edges\' } $MeshIcon }'
    # vis button
    set MeshIcon 'elem-normal.gif'
    set jataList '$jataList { {Normals} { hm_pushpanel \'normals\' } $MeshIcon }'
    # vis button
    set MeshIcon 'intersectionGUI.gif'
    set jataList '$jataList { {intersection} { hm_pushpanel \'penetration\' } $MeshIcon }'
    # vis button
    set MeshIcon 'numbers-24.gif'
    set jataList '$jataList { {Numbers} { hm_pushpanel \'numbers\' } $MeshIcon }'
    # vis button
    set MeshIcon 'pan.gif'
    set jataList '$jataList { {Translate} { hm_pushpanel \'translate\' } $MeshIcon }'
    # vis button
    set MeshIcon 'pointsExtractParametric-24.gif'
    set jataList '$jataList { {Project} { hm_pushpanel \'project\' } $MeshIcon }'
    # vis button
    set MeshIcon 'blankNesting-24.gif'
    set jataList '$jataList { {Reflect} { hm_pushpanel \'reflect\' } $MeshIcon }'
    # vis button
    set MeshIcon 'gap-24.gif'
    set jataList '$jataList { {Replace} { hm_pushpanel \'replace\' } $MeshIcon }'
    # vis button
    set MeshIcon 'erase-16.gif'
    set jataList '$jataList { {Edit elements} { hm_pushpanel \'edit element\' } $MeshIcon }'
    # vis button
    set MeshIcon 'objectives.gif'
    set jataList '$jataList { {Replace} { hm_pushpanel \'split\' } $MeshIcon }'
    #
    # vis button
    set MeshIcon 'linesExtractEdge-24.gif'
    set jataList '$jataList { {Smooth} { hm_pushpanel \'smooth\' } $MeshIcon }'
    #
    # vis button
    set MeshIcon 'linesOffsetConstant-24.gif'
    set jataList '$jataList { {node edit} { hm_pushpanel \'node edit\' } $MeshIcon }'
    #
    # vis button
    set MeshIcon 'post-shaded-16.gif'
    set jataList '$jataList { {node edit} { hm_pushpanel \'ruled\' } $MeshIcon }'
    #
    # vis button
    set MeshIcon '3dElements-24.gif'
    set jataList '$jataList { {node edit} { hm_pushpanel \'drag\' } $MeshIcon }'
    #
    # vis button
    set MeshIcon 'solidDragLine-24.gif'
    set jataList '$jataList { {node edit} { hm_pushpanel \'solid map\' } $MeshIcon }'
    #
    # vis button
    set MeshIcon 'morphingVolume-16.gif'
    set jataList '$jataList { {node edit} { hm_pushpanel \'HyperMorph\' } $MeshIcon }'

    proc ::face {args} {
    *appendmark elements 1 'by adjacent'
    hm_saveusermark elems 1;
    *appendmark elements 1 'retrieve'
    hm_highlightmark elems 1 h;
    }
    # create toolbar
    catch { ::HM_Framework:image/emoticons/default_tongue.png' alt=':P' srcset='/emoticons/tongue@2x.png 2x' width='20' height='20'>_DeleteMinibar CustomToolBar }
    CreateToolBar fanels $jataList

    # redraw window
    RedrawWindows
     

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited July 2015

    #created
    #varthamanan
    proc CreateToolBar { carName jataList } {

        #Create Toolbar
        ::HM_Framework:image/emoticons/default_tongue.png' alt=':P' srcset='/emoticons/tongue@2x.png 2x' width='20' height='20'>_CreateMinibar . $carName;

        #Add Icon
        foreach Data $jataList {
            set iconfile [ lindex $Data 2 ]
            set cmd [ lindex $Data 1 ]
            set name [ lindex $Data 0 ]
            ::HM_Framework:image/emoticons/default_tongue.png' alt=':P' srcset='/emoticons/tongue@2x.png 2x' width='20' height='20'>_AddIconToMinibar $carName \
                             [ list p_CreateMinibarIcon [ file tail $iconfile ] $cmd $name 1 ];
            }


        #Pack Toolbar
        ::HM_Framework:image/emoticons/default_tongue.png' alt=':P' srcset='/emoticons/tongue@2x.png 2x' width='20' height='20'>_AddMinibarToDockframe $carName .dockframe_center;

        #Destroy

    }

    proc RedrawWindows { } {
        set pos [ hm_getcommandposition ]

        if { $pos == 'top' } {
            hm_setcommandposition bottom
            hm_setcommandposition top
        } else {
            hm_setcommandposition top
            hm_setcommandposition bottom
        }
    }

    set jataList ''
    # quick edit panel
    set EditIcon 'nodesInterpolateOnSurf-24.gif'
    set jataList '$jataList { {Quick Edit} { ::face {args} } $EditIcon }'
    # automesh panel
    set MeshIcon 'meshLines-32.gif'
    set jataList '$jataList { {AutoMesh} { hm_pushpanel \'automesh\' } $MeshIcon }'
    # check panel
    set CheckIcon 'check.gif'
    set jataList '$jataList { {Element Checks} { hm_pushpanel \'check elems\' } $CheckIcon }'
    #
    # vis button
    set MeshIcon 'distanceBetweenNodes-24.gif'
    set jataList '$jataList { {Distance} { hm_pushpanel \'distance\' } $MeshIcon }'
    #
    # vis button
    set MeshIcon 'edgesGeneral-24.gif'
    set jataList '$jataList { {Edges} { hm_pushpanel \'edges\' } $MeshIcon }'
    # vis button
    set MeshIcon 'elem-normal.gif'
    set jataList '$jataList { {Normals} { hm_pushpanel \'normals\' } $MeshIcon }'
    # vis button
    set MeshIcon 'intersectionGUI.gif'
    set jataList '$jataList { {intersection} { hm_pushpanel \'penetration\' } $MeshIcon }'
    # vis button
    set MeshIcon 'numbers-24.gif'
    set jataList '$jataList { {Numbers} { hm_pushpanel \'numbers\' } $MeshIcon }'
    # vis button
    set MeshIcon 'pan.gif'
    set jataList '$jataList { {Translate} { hm_pushpanel \'translate\' } $MeshIcon }'
    # vis button
    set MeshIcon 'pointsExtractParametric-24.gif'
    set jataList '$jataList { {Project} { hm_pushpanel \'project\' } $MeshIcon }'
    # vis button
    set MeshIcon 'blankNesting-24.gif'
    set jataList '$jataList { {Reflect} { hm_pushpanel \'reflect\' } $MeshIcon }'
    # vis button
    set MeshIcon 'gap-24.gif'
    set jataList '$jataList { {Replace} { hm_pushpanel \'replace\' } $MeshIcon }'
    # vis button
    set MeshIcon 'erase-16.gif'
    set jataList '$jataList { {Edit elements} { hm_pushpanel \'edit element\' } $MeshIcon }'
    # vis button
    set MeshIcon 'objectives.gif'
    set jataList '$jataList { {Replace} { hm_pushpanel \'split\' } $MeshIcon }'
    #
    # vis button
    set MeshIcon 'linesExtractEdge-24.gif'
    set jataList '$jataList { {Smooth} { hm_pushpanel \'smooth\' } $MeshIcon }'
    #
    # vis button
    set MeshIcon 'linesOffsetConstant-24.gif'
    set jataList '$jataList { {node edit} { hm_pushpanel \'node edit\' } $MeshIcon }'
    #
    # vis button
    set MeshIcon 'post-shaded-16.gif'
    set jataList '$jataList { {node edit} { hm_pushpanel \'ruled\' } $MeshIcon }'
    #
    # vis button
    set MeshIcon '3dElements-24.gif'
    set jataList '$jataList { {node edit} { hm_pushpanel \'drag\' } $MeshIcon }'
    #
    # vis button
    set MeshIcon 'solidDragLine-24.gif'
    set jataList '$jataList { {node edit} { hm_pushpanel \'solid map\' } $MeshIcon }'
    #
    # vis button
    set MeshIcon 'morphingVolume-16.gif'
    set jataList '$jataList { {node edit} { hm_pushpanel \'HyperMorph\' } $MeshIcon }'

    proc ::face {args} {
    *appendmark elements 1 'by adjacent'
    hm_saveusermark elems 1;
    *appendmark elements 1 'retrieve'
    hm_highlightmark elems 1 h;
    }
    # create toolbar
    catch { ::HM_Framework:image/emoticons/default_tongue.png' alt=':P' srcset='/emoticons/tongue@2x.png 2x' width='20' height='20'>_DeleteMinibar CustomToolBar }
    CreateToolBar fanels $jataList

    # redraw window
    RedrawWindows
     

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited July 2015

    this is my toolbar  created by most using command

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited June 2017

    Hi tinh, could you please share this macro with me? It looks very interesting. Do you know if it works with hypermesh 2017?

    Thank you in advance

  • ravinder muppidi
    ravinder muppidi Altair Community Member
    edited June 2019

    Hi tinh,

     

    I am eagerly waiting for this toolbar script.

    could you please share this macro with me? It looks very interesting.

    Thank you in advance

  • tinh
    tinh Altair Community Member
    edited June 2019

    Forget it! Hm2019 toolbars are really nice and convienience.

  • ravinder muppidi
    ravinder muppidi Altair Community Member
    edited June 2019

    Hello Tinh,

     

    I am really  happy for your response.

     

    Hm 2019 toolbars may be better but we still using old version like hm 14 and hm 17 as stable versions.

     

    Kindly share with us it will be more and more useful.  Rather than keeping them calm, we wanted to use it fully and efficiently.

    Hope you help us with your scripts.

    here my mail id to drop it  ravinderdme@gmail.com

    Thank you in advance!