admin 发表于 2015-1-9 09:29:52

最新,最全的NX二次开发Ribbon界面菜单的设计图文教程

最新,最全的NX二次开发Ribbon界面菜单的设计图文教程此教程,特为参加NX9二次开发培训的学员们准备,如果设计有问题,请在二次开发群内讨论!感谢大家的支持和信任,我会继续推进这方面的培训事业,希望你们能够更好,更快的掌握用来创造你们的财富。

1 Ribbon界面简介
从NX9开始NX的界面使用了微软目前最新的对话框布局格式,Ribbon界面,除了本身的Ribbon的功能外,NX也额外的增强了Ribbon界面的功能。目前可以进行定义的菜单种类包括groups, galleries, drop-down ,对应的文件后缀如下:

ExtensionUI object
.tbrToolbar
.grbGroup
.glyGallery
.ddbDrop-down
.rtbRibbon tab
.csbCascade
.abrAttachment

2 RIBBON菜单的加载
Ribbon界面的客户化文件和我们的菜单或者工具条.men,.trb文件一样,你可以放置在application目录,startup目录或者application\profiles目录下。具体的区别如下:
(1)Startup目录:这个文件夹下面的内容,是NX启动后,立即显示的类型,也就是说你的菜单会在NX启动后,立即全部展现出来。
(2)Application目录:和startup区别在于,只有在特定的模块下,才会显示,通常可以通过定义men文件或者通过API函数UF_UI_create_toolbar, UF_UI_create_ribbon进行定义。
(3)application\profiles目录:可以参考NX目录下UGII\menus\profiles目录下的定义
a. 对应的模块目录文件夹下:这种情况,根据你当前的模块去自动加载和卸载
b.ALL:和startup类似,全部加载

c.reference:在模块下的特殊子模块下加载,需要在.dtx文件里面定义




[*]</ActionLists>
</Layout>
<Reference>
<ActionList name=”cutomer_ribbon_tab.rtb”/>
<Reference>
</Profiles>
</NX_PROFILES>



另外,还有更简单的方法来控制RIBBON界面在不同的模块显示情况,那就是角色文件mtx,大家可以参考PLM之家NX工具包的V1.1.0版本,在这里startup目录下面有mtx格式的文件,这种文件就是,大家可以把所有的ribbon文件全部放置在startup目录下,启动nx后,在ctrl+1编辑菜单的模式下,在不同的模块下自己去取消掉不需要的菜单,比如PLM之家NX插件下面的创建程序组功能,这个功能只能在加工环境下使用,因此,我们可以把这个工具条在制图,建模下面移除掉,更改完成后,将mtx文件保存下来,放在startup目录下,这样NX加载的时候会自动的去根据mtx来加载菜单!


3 关于Ribbon界面上关键字的定义。
(1)RIBBON_STYLE关键字: 默认情况下是大图标LARGE_IMAGE
ALWAYS_EXTRA_LARGE_IMAGE_WITHOUT_TEXTEXTRA_LARGE_IMAGE_WITHOUT_TEXTALWAYS_LARGE_IMAGE_WITHOUT_TEXTLARGE_IMAGE_WITHOUT_TEXTALWAYS_LARGE_IMAGELARGE_IMAGEALWAYS_MEDIUM_IMAGE_AND_TEXTMEDIUM_IMAGE_AND_TEXTMEDIUM_IMAGEALWAYS_SMALL_IMAGE_AND_TEXTSMALL_IMAGE_AND_TEXTSMALL_IMAGE

(2)Group关键字的定义:
关键字是Group。
创建新的Group,使用BEGIN_GROUP,END_GROUP.
GROUP_STYLE 可以用DEFAULT和FLOWLAYOUT。


(3) Gallery的关键字定义:



KeywordValueDescription
GALLERYReferenced Item IDSpecifies an item that refers to a gallery defined in a separate file.
BEGIN_GALLERYEND_GALLERYNew Item IDCreates and specifies a new gallery item and its contents.
BEGIN_RECENTLY_USEDEND_RECENTLY_USEDNACreates a new category within the gallery that tracks recently used commands.You can also specify the initial contents for the recently used gallery between begin and end tags.
NUMBER_OF_ITEMSNumber of recently used commandsSpecifies the number of recently used commands the gallery must track within the recently used category.
GALLERY_STYLEhttp://localhost:8181/data_services/resources/nx/10/nx_api/en_US/graphics/graphicLibrary/nx/manuscripts/gallery_style_1.pnghttp://localhost:8181/data_services/resources/nx/10/nx_api/en_US/graphics/graphicLibrary/nx/manuscripts/gallery_style_2.pngSimple Styles:SMALL_IMAGESMALL_IMAGE_AND_TEXTMEDIUM_IMAGEMEDIUM_IMAGE_AND_TEXTLARGE_IMAGELARGE_IMAGE_AND_TEXT_BELOWComposite Styles:SMALL_IMAGE_INPLACE_SMALL_IMAGE_AND_TEXT_INPOPUPSMALL_IMAGE_INPLACE_MEDIUM_IMAGE_AND_TEXT_INPOPUPSMALL_IMAGE_INPLACE_LARGE_IMAGE_AND_TEXT_BELOW_INPOPUPMEDIUM_IMAGE_INPLACE_SMALL_IMAGE_AND_TEXT_INPOPUPMEDIUM_IMAGE_INPLACE_MEDIUM_IMAGE_AND_TEXT_INPOPUPMEDIUM_IMAGE_INPLACE_LARGE_IMAGE_AND_TEXT_BELOW_INPOPUP
Specifies a preferred gallery style.
COLUMN_IN_RIBBONNumber of columns in RibbonDefines the largest size to which the in-place gallery can expand when the space is available.
COLUMN_IN_POPUPNumber of columns when expandedDefines the minimum size of the popup gallery.


admin 发表于 2015-1-9 10:08:25

(4)Drop-Down格式关键字


KeywordValueDescription
DROPDOWNReferenced Item IDSpecifies an item that refers to a drop-down list button that is defined in a separate file.
BEGIN_DROPDOWNEND_DROPDOWNNew Item IDCreates and specifies a new drop-down menu and its contents.
DROPDOWN_STYLEhttp://localhost:8181/data_services/resources/nx/10/nx_api/en_US/graphics/graphicLibrary/nx/manuscripts/drop_down_style_1.pnghttp://localhost:8181/data_services/resources/nx/10/nx_api/en_US/graphics/graphicLibrary/nx/manuscripts/drop_down_style_2.pngAS_POPUP_MENUPALETTESpecifies a preferred style for a drop-down list.
COLUMN_DROPDOWNNumber of columns in drop downDefines the largest size to which the drop-down list can expand when space is available.

admin 发表于 2015-1-9 10:10:05

(5) 其他关键字


KeywordValueDescription
CASCADEReferenced Item IDSpecifies an item that refers to a cascade defined in a separate file.
BEGIN_CASCADEEND_CASCADENew Item IDCreates and specifies a cascade menu and its contents.
ATTACHMENT_TARGETTopBackStageGroupLeftBackStageGroupRightBackStageGroupBottomBackStageGroupQuickAccessBarRibbonSystemBarSelectionBarTopBorderBarBottomBorderBarLeftBorderBarRightBorderBarAttaches the new content to a built-in container such as a group, or a bar.
NoteUse this keyword only in .abr files and it is declared at the beginning of the file.

CONTEXT_TITLEAlternate titleDifferentiates between groups in the Customize dialog box.
STYLEDEFAULTTEXTONLY_ALWAYSIMAGE_AND_TEXTTEXTONLY_MENUSpecifies an item style for regular toolbars and menus.
COLLAPSEDTUREFALSESpecifies whether a group, gallery, or cascade can be collapsed. The default value is FALSE.

页: [1]
查看完整版本: 最新,最全的NX二次开发Ribbon界面菜单的设计图文教程