How to map 'references' in keyboard shortcuts?

Alberto Perticone
Alberto Perticone Altair Community Member
edited July 2021 in Community Q&A

Hi everyone,

does anybody know how to map the references browser panel? For instance, I know that the script for 'Review' is:

 ::HM_Framework::ToggleReviewFromGraphicsArea

Could you provide something similar for the 'References' command, usually accessible through the right click over an element in the entities tree?

 

Thanks

Best Answer

  • tinh
    tinh Altair Community Member
    edited July 2021 Answer ✓

    Ok. I see

    just modify a bit and it can works on both Include View & Model View:

    proc mbrGetSelectedComps {} { 	#model browser get selected comps: 	set results {} 	foreach tree {.model .fepre_model} { 		if {[winfo exists $tree]} break 	} 	set tree [winfo children $tree._pw._fbr].frmTreeArea.frmTree.__treectrl ....

     

    updated file:

Answers

  • Wesley Castro_21290
    Wesley Castro_21290
    Altair Employee
    edited December 2020

    Hi Alberto, 

    This is Wesley. I am an Application Engineer for Altair responding to your question - hopefully I can be of help here. 

     

    There is a references browser that can be access by right mouse button on a entity in the model browser and selecting references. This will show all entities that are referenced to that particular entity. See images below. 

    Is this what you are looking for?

     

    imageimage

     

    Wesley

  • Alberto Perticone
    Alberto Perticone Altair Community Member
    edited December 2020

    Hi Alberto, 

    This is Wesley. I am an Application Engineer for Altair responding to your question - hopefully I can be of help here. 

     

    There is a references browser that can be access by right mouse button on a entity in the model browser and selecting references. This will show all entities that are referenced to that particular entity. See images below. 

    Is this what you are looking for?

     

    imageimage

     

    Wesley

    Thanks for the reply, but it isn’t what I need. As I wrote in the heading, I need a keyboard shortcut to open the references browser by pressing a button, instead of right clicking with the mouse, as well as I call the review panel pressing ‘Q’ on my keyboard. 
    I know that I can manually add some shortcuts, but I need the related ‘script’. Something like that one used for ‘Review’ in Q button:  ::HM_Framework::ToggleReviewFromGraphicsArea

    Do you know how to do that?

  • tinh
    tinh Altair Community Member
    edited December 2020

    Hi,

    try this command:

    .model._pw._fbr.content.frmTreeArea.frmTree.__treectrl.popupMenumain invoke "References"

     

  • Alberto Perticone
    Alberto Perticone Altair Community Member
    edited December 2020
    tinh said:

    Hi,

    try this command:

    .model._pw._fbr.content.frmTreeArea.frmTree.__treectrl.popupMenumain invoke "References"

     

    Hi Tinh,

    thank you for your reply, but I'm afraid it doesn't work. I'm showing you how I applied it. Was I wrong?

     

    image

    image

  • tinh
    tinh Altair Community Member
    edited December 2020

    Hi,

    You have to right click on model browser first (only once), if the context menu has "References" item then the command is available then.

    You assign the command to "Keyboard Settings" so it's bound to Graphic Engine key event only (must click graphic area before press your key)

  • Alberto Perticone
    Alberto Perticone Altair Community Member
    edited December 2020
    tinh said:

    Hi,

    You have to right click on model browser first (only once), if the context menu has "References" item then the command is available then.

    You assign the command to "Keyboard Settings" so it's bound to Graphic Engine key event only (must click graphic area before press your key)

    Hi, 

    nice hint, but it seems to be still not working...

    Could you provide something else, please? It's obviously not necessary, but it would ease my workflow. 

    Thank you again for your effort and patience.

  • tinh
    tinh Altair Community Member
    edited December 2020

    Hi, 

    nice hint, but it seems to be still not working...

    Could you provide something else, please? It's obviously not necessary, but it would ease my workflow. 

    Thank you again for your effort and patience.

    It's working on my HM2019

    Maybe you have done wrong steps.

    check this clip:

    a.mp4 1.1M
  • Alberto Perticone
    Alberto Perticone Altair Community Member
    edited December 2020
    tinh said:

    It's working on my HM2019

    Maybe you have done wrong steps.

    check this clip:

    Thank you for the clip, really helpful, but this is the same path I followed and it said:

    image

    Do you guess the reason for this?

    I'm working with the same version of Hypermesh as yours.

  • tinh
    tinh Altair Community Member
    edited December 2020

    Thank you for the clip, really helpful, but this is the same path I followed and it said:

    image

    Do you guess the reason for this?

    I'm working with the same version of Hypermesh as yours.

    Maybe your hand was dirty !

     

    anyway, try alternative way as in my new post

  • tinh
    tinh Altair Community Member
    edited December 2020

    Hi,

    below code is closer wrapper than 'popupMainmenu invoke Refernences'

    Good luck with this time.

    proc mbrGetSelectedComps {} { 	#model browser get selected comps: 	set results {} 	set tree .model._pw._fbr.content.frmTreeArea.frmTree.__treectrl 	foreach item [$tree selection get] { 		lassign [$tree item ancestors $item] item_type 		lassign [$tree item text $item_type] item_type_text 		if {[string match -nocase Components* $item_type_text]} { 			lassign [$tree item text $item] -> item_id 			if {[string is integer -strict $item_id]} { 				lappend results $item_id 			} 		} 	} 	set results } proc mbrInvokeReferences {} { 	set CompList [mbrGetSelectedComps] 	if {[llength $CompList]} { 		[::hmbr::OperationManager::Instance] perform hmbr::xrefrecursive [list [list Components $CompList]] 	} } mbrInvokeReferences

     

    You should not put so long script into Keyboard Settings "Command", so

    Put it in a file 'InvokeReferences.tcl'  (or download attached file),

    and point to it from Keyboard Settings "File":

    image

  • Alberto Perticone
    Alberto Perticone Altair Community Member
    edited December 2020
    tinh said:

    Hi,

    below code is closer wrapper than 'popupMainmenu invoke Refernences'

    Good luck with this time.

    proc mbrGetSelectedComps {} { 	#model browser get selected comps: 	set results {} 	set tree .model._pw._fbr.content.frmTreeArea.frmTree.__treectrl 	foreach item [$tree selection get] { 		lassign [$tree item ancestors $item] item_type 		lassign [$tree item text $item_type] item_type_text 		if {[string match -nocase Components* $item_type_text]} { 			lassign [$tree item text $item] -> item_id 			if {[string is integer -strict $item_id]} { 				lappend results $item_id 			} 		} 	} 	set results } proc mbrInvokeReferences {} { 	set CompList [mbrGetSelectedComps] 	if {[llength $CompList]} { 		[::hmbr::OperationManager::Instance] perform hmbr::xrefrecursive [list [list Components $CompList]] 	} } mbrInvokeReferences

     

    You should not put so long script into Keyboard Settings "Command", so

    Put it in a file 'InvokeReferences.tcl'  (or download attached file),

    and point to it from Keyboard Settings "File":

    image

    That's very kind of you, man! I really appreciate your effort in helping me, but I have to say again that it doesn't work. I don't want to bother you anymore, but I attach what it responds to me when I use your template. (I do click on my component >then press R or click on component >click on hm window > then R. Both of these paths don't work)

     

    image

     

    Many thanks again, really!

  • tinh
    tinh Altair Community Member
    edited December 2020

    That's very kind of you, man! I really appreciate your effort in helping me, but I have to say again that it doesn't work. I don't want to bother you anymore, but I attach what it responds to me when I use your template. (I do click on my component >then press R or click on component >click on hm window > then R. Both of these paths don't work)

     

    image

     

    Many thanks again, really!

    Don't worry, I think you used Hyperworks Desktop instead of Hypermesh.

    Try overwrite your file by this attached:

    I modified some codes

    proc mbrGetSelectedComps {} { 	#model browser get selected comps: 	set results {} 	foreach tree {.model .fepre_model} { 		if {[winfo exists $tree]} break 	} 	append tree ._pw._fbr.content.frmTreeArea.frmTree.__treectrl 	foreach item [$tree selection get] { ....

     

  • Alberto Perticone
    Alberto Perticone Altair Community Member
    edited December 2020
    tinh said:

    Don't worry, I think you used Hyperworks Desktop instead of Hypermesh.

    Try overwrite your file by this attached:

    I modified some codes

    proc mbrGetSelectedComps {} { 	#model browser get selected comps: 	set results {} 	foreach tree {.model .fepre_model} { 		if {[winfo exists $tree]} break 	} 	append tree ._pw._fbr.content.frmTreeArea.frmTree.__treectrl 	foreach item [$tree selection get] { ....

     

    No, I'm using Hypermesh. Now I found out what the problem was. I usually work inside the "includes view" and it doesn't work there. image

    I have to change to "model view" in order to use your script or I should modify your script for include view.

  • tinh
    tinh Altair Community Member
    edited July 2021 Answer ✓

    Ok. I see

    just modify a bit and it can works on both Include View & Model View:

    proc mbrGetSelectedComps {} { 	#model browser get selected comps: 	set results {} 	foreach tree {.model .fepre_model} { 		if {[winfo exists $tree]} break 	} 	set tree [winfo children $tree._pw._fbr].frmTreeArea.frmTree.__treectrl ....

     

    updated file:

  • Alberto Perticone
    Alberto Perticone Altair Community Member
    edited December 2020
    tinh said:

    Ok. I see

    just modify a bit and it can works on both Include View & Model View:

    proc mbrGetSelectedComps {} { 	#model browser get selected comps: 	set results {} 	foreach tree {.model .fepre_model} { 		if {[winfo exists $tree]} break 	} 	set tree [winfo children $tree._pw._fbr].frmTreeArea.frmTree.__treectrl ....

     

    updated file:

    Unfortunately, It works neither in Model nor in Include View now...

  • tinh
    tinh Altair Community Member
    edited December 2020

    Unfortunately, It works neither in Model nor in Include View now...

    :D

    I am sorry.

    This one should work in Include View:

     

  • Alberto Perticone
    Alberto Perticone Altair Community Member
    edited December 2020
    tinh said:

    Ok. I see

    just modify a bit and it can works on both Include View & Model View:

    proc mbrGetSelectedComps {} { 	#model browser get selected comps: 	set results {} 	foreach tree {.model .fepre_model} { 		if {[winfo exists $tree]} break 	} 	set tree [winfo children $tree._pw._fbr].frmTreeArea.frmTree.__treectrl ....

     

    updated file:

    Yes, It works! Many thanks, man! You gave me your Christmas gift this year.

    I wish you a Merry Holy Christmas and happy holidays