How to create a drop down menu instead of a ribbon
Best Answer
-
If you are using extensions the extension.xml file would look the same as for a ribbon but the xml for the dropdown menu that you reference in the extension.xml file would look something like this:
<root> <actionlist> <action tag="uniqueActionTag" text="text" tooltip="tip" image="image-80.png" command="tcl: ::UniqueNamespace::YourProc"/> </actionlist> <page tag="Your_Menu_Page" text="Menu Fun"> <menu tag="Your_Menu_Menu"> <actiongroup tag="Your_Menu_Group" text="groupText"> <action actiontag="uniqueActionTag"/> </actiongroup> </menu> </page> </root>
I am working on a blog that goes over this and there are videos being created also.
2
Answers
-
If you are using extensions the extension.xml file would look the same as for a ribbon but the xml for the dropdown menu that you reference in the extension.xml file would look something like this:
<root> <actionlist> <action tag="uniqueActionTag" text="text" tooltip="tip" image="image-80.png" command="tcl: ::UniqueNamespace::YourProc"/> </actionlist> <page tag="Your_Menu_Page" text="Menu Fun"> <menu tag="Your_Menu_Menu"> <actiongroup tag="Your_Menu_Group" text="groupText"> <action actiontag="uniqueActionTag"/> </actiongroup> </menu> </page> </root>
I am working on a blog that goes over this and there are videos being created also.
2 -
Ben Buchanan said:
If you are using extensions the extension.xml file would look the same as for a ribbon but the xml for the dropdown menu that you reference in the extension.xml file would look something like this:
<root> <actionlist> <action tag="uniqueActionTag" text="text" tooltip="tip" image="image-80.png" command="tcl: ::UniqueNamespace::YourProc"/> </actionlist> <page tag="Your_Menu_Page" text="Menu Fun"> <menu tag="Your_Menu_Menu"> <actiongroup tag="Your_Menu_Group" text="groupText"> <action actiontag="uniqueActionTag"/> </actiongroup> </menu> </page> </root>
I am working on a blog that goes over this and there are videos being created also.
Thank you!
It works! Waiting for the blog to learn more about this!
0 -
Ben Buchanan said:
If you are using extensions the extension.xml file would look the same as for a ribbon but the xml for the dropdown menu that you reference in the extension.xml file would look something like this:
<root> <actionlist> <action tag="uniqueActionTag" text="text" tooltip="tip" image="image-80.png" command="tcl: ::UniqueNamespace::YourProc"/> </actionlist> <page tag="Your_Menu_Page" text="Menu Fun"> <menu tag="Your_Menu_Menu"> <actiongroup tag="Your_Menu_Group" text="groupText"> <action actiontag="uniqueActionTag"/> </actiongroup> </menu> </page> </root>
I am working on a blog that goes over this and there are videos being created also.
With the classic version of Hypermesh/Hyperview, we create menu using TCL commands. Is it possible to achieve the same in the HyperworksX version @Ben Buchanan ?
0 -
Akash Purushothaman said:
With the classic version of Hypermesh/Hyperview, we create menu using TCL commands. Is it possible to achieve the same in the HyperworksX version @Ben Buchanan ?
Yes, you can still do it that way as far as I know. Extensions I feel have a lot of advantages. Such as:
- ease of loading/unloading and turning on/off (no more messing with the hmcustom.tcl file)
- can have any number of extension active at a time
- seamless inclusion in GUI
- quickly and easily do a ribbon, dropdown menu or toolbar (take existing example plug in your values)
- etc..
Just some of my thoughts.
Here are some current articles about extensions and some extensions available on the exchange.
https://help.altair.com/hwdesktop/hwd/topics/reference/extensions/extensions_r.htm
https://community.altair.com/community?id=kb_article&sysparm_article=KB0120189
https://community.altair.com/community?id=kb_article&sysparm_article=KB0121742
https://community.altair.com/community?id=kb_article&sysparm_article=KB0121665
0 -
Ben Buchanan said:
Yes, you can still do it that way as far as I know. Extensions I feel have a lot of advantages. Such as:
- ease of loading/unloading and turning on/off (no more messing with the hmcustom.tcl file)
- can have any number of extension active at a time
- seamless inclusion in GUI
- quickly and easily do a ribbon, dropdown menu or toolbar (take existing example plug in your values)
- etc..
Just some of my thoughts.
Here are some current articles about extensions and some extensions available on the exchange.
https://help.altair.com/hwdesktop/hwd/topics/reference/extensions/extensions_r.htm
https://community.altair.com/community?id=kb_article&sysparm_article=KB0120189
https://community.altair.com/community?id=kb_article&sysparm_article=KB0121742
https://community.altair.com/community?id=kb_article&sysparm_article=KB0121665
I understand the advantages of using extensions.
Thank you for your explanation and examples as it is really helpful.
But for some special cases of my TCL scripts, I would also like to understand how to create a menu by using only the TCL commands similar to classic version. Is there any references that I can get for that?
0 -
Ben Buchanan said:
If you are using extensions the extension.xml file would look the same as for a ribbon but the xml for the dropdown menu that you reference in the extension.xml file would look something like this:
<root> <actionlist> <action tag="uniqueActionTag" text="text" tooltip="tip" image="image-80.png" command="tcl: ::UniqueNamespace::YourProc"/> </actionlist> <page tag="Your_Menu_Page" text="Menu Fun"> <menu tag="Your_Menu_Menu"> <actiongroup tag="Your_Menu_Group" text="groupText"> <action actiontag="uniqueActionTag"/> </actiongroup> </menu> </page> </root>
I am working on a blog that goes over this and there are videos being created also.
Hello Ben ,
Do you know how can we create dropdown for Hyperworks in Client Hyperview. As i tried using extension you have defined here. But for Hyperview its not working. Can you guide me how can i create dropdown for Hyperview. ?
0 -
Ajay Prabhakaran said:
Hello Ben ,
Do you know how can we create dropdown for Hyperworks in Client Hyperview. As i tried using extension you have defined here. But for Hyperview its not working. Can you guide me how can i create dropdown for Hyperview. ?
I just completed another blog for the new version of extensions and it touches on creating a dropdown for Hyperview.
https://community.altair.com/community?id=community_blog&sys_id=f497a24b97d87d10e3b0361e6253aff9
Hope that helps.
0 -
Akash Purushothaman said:
I understand the advantages of using extensions.
Thank you for your explanation and examples as it is really helpful.
But for some special cases of my TCL scripts, I would also like to understand how to create a menu by using only the TCL commands similar to classic version. Is there any references that I can get for that?
I found the following that will at least help you get started:
proc ::int_Menu::Main { } { variable str_scriptpath; if {[::HM_Framework::RunningUnityFramework]} { set str1 [hm_info -appinfo ALTAIR_HOME] set pyexe [file join $str1 ".." "common" "python" "python3.5" "win64" "python.exe"] set str_menuName "Menu Name" # puts $str_menuName ::int_Menu::createandloadxml $str_menuName } } proc ::int_Menu::createandloadxml {str_menuName } { variable str_scriptpath; set csv "int_Menu.csv" set filename [file join $str_scriptpath "$csv"] set xmlfile "int_Menu.xml" set str1 [hm_info -appinfo ALTAIR_HOME] set strOS [string tolower $::tcl_platform(os)]; if {[string first "win" $strOS]!= -1} { set xmlfilepath [pwd] set pyexe [file join [file dirname $str1] "common" "python" "python3.8" "win64" "python.exe"] puts "pyexe - $pyexe" } else { set xmlfilepath $str_scriptpath set pyexe [file join [file dirname $str1] "common" "python" "python3.8" "linux64" "bin" "python"] } set c [catch {exec $pyexe [file join $str_scriptpath read_tool_csv.py] $xmlfilepath $filename $xmlfile $str_menuName}] # exec $pyexe [file join $str_scriptpath read_tool_csv.py] $xmlfilepath $filename $xmlfile $str_menuName set strname [join [list "HMX_" [regsub {[-]} $str_menuName ""] "MenuPage"] ""] if {$c == 0} { ::hwf::ribbonpage remove $strname ::hwf::ribbonpage add [file join $xmlfilepath $xmlfile] puts "Done loading $str_menuName" } else { puts "some error while loading custom dropdown menus" } }
0 -
Ben Buchanan said:
I just completed another blog for the new version of extensions and it touches on creating a dropdown for Hyperview.
https://community.altair.com/community?id=community_blog&sys_id=f497a24b97d87d10e3b0361e6253aff9
Hope that helps.
Thank you Ben for the clear explanation. Its working for me now.
But there is a small blocking point. After creating the extension.xml, users have to load the extension manually from File -> Extension -> Add extension.
I understood that adding extension is a one time job. But i would like to automate that aswell. Do you have any api in hyperworks to load the extension? It would be really helpful for me if you can guide me on that too.
Right now i am manually loading the extension following the picture below :
Or i just have another question: Is it possible to load the extension.xml from a default directory everytime rather that loading the extension manually??
0 -
Ajay Prabhakaran said:
Thank you Ben for the clear explanation. Its working for me now.
But there is a small blocking point. After creating the extension.xml, users have to load the extension manually from File -> Extension -> Add extension.
I understood that adding extension is a one time job. But i would like to automate that aswell. Do you have any api in hyperworks to load the extension? It would be really helpful for me if you can guide me on that too.
Right now i am manually loading the extension following the picture below :
Or i just have another question: Is it possible to load the extension.xml from a default directory everytime rather that loading the extension manually??
In HW 2022.3 the HWX_PLUGINS environment variable can be used to do this. See #6 in the following help page:
https://help.altair.com/hwdesktop/hwd/topics/reference/extensions/extensions_add_t.htm
I don't know of a way to do this in the previous versions.
0