查看: 2847|回复: 0

[资料分享] 关于NX二次开发 Ribbon菜单定义技巧

[复制链接]

2477

主题

1280

回帖

8万

积分

管理员

PLM之家站长

积分
82265
QQ
发表于 2018-12-25 16:10:57 | 显示全部楼层 |阅读模式

请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!

您需要 登录 才可以下载或查看,没有账号?注册

×
$ Q- U2 W* r: m6 ^) S

2 B* r( W; H% a8 `
" m2 U5 C1 ^+ [% A3 G9 q: p0 s. S; n
首先认识下关于菜单的后缀文件& h- a: `" J( F* f! ~6 B

: P/ B/ H8 F/ P: l* Z
Extension
UI object
.tbr
Toolbar
.grb
Group
.gly
Gallery
.ddb
Drop-down
.rtb
Ribbon tab
.csb
Cascade
.abr
Attachment
2 y& K4 E6 @! A* M3 U$ q

. f& u! p1 a) r) ?) y9 j. O+ _1 U8 ARTB作为菜单ribbon 界面定义的关键,详细信息如下
- Q, T  \/ P! M. S( k) N% R: P
1 U& o, H0 R$ G8 K8 ]6 p. }! G# K+ n+ |
customer_ribbon_tab.rtb
, f- N  R& g8 O$ P- ]!( H: u" D5 e; m
!  Customer Ribbon Tab
. J, K  V' d- `( G. i3 g' c: h!   G. j- W$ _: h( e7 u
!  This file will create a new customer tab containing three groups and  v; g' `0 c; ]; z2 A
!  one top level button.
1 K& R2 Q9 _) H& U!
. E- H/ B  l) Q. d* B5 N7 V" Z; F! e* W7 r. g: H
TITLE  Customer Tab
/ y2 Q8 o8 u+ w$ mVERSION 170
! h5 F0 j) g6 x% L6 V9 G, E* s# T, q) Z* N* |
!  The first group represents a Ribbon group that references an existing
+ l' A  s. {" D6 O! ]! S* q!  toolbar with no Ribbon style changes.  
8 ?" }7 N5 V" q) q- B!
7 k. \9 a4 a* Z* }+ I- z!  This is the quickest way to add existing toolbar content into Ribbon mode.
" O' l* B1 ?9 j, P4 c& O!5 q& w8 }0 F% N
GROUP  customer_toolbar.tbr3 s0 X0 y" k0 r9 y$ }5 t
! 如果想直接切换tbr 到 rtb,这是最快的
4 f3 u9 l; z0 A& `+ K5 s!  The second group represents a Ribbon group that references an existing
1 k0 r+ h! m3 Q, R4 e!  toolbar with Ribbon specific style changes added to it.  There is no difference: f& _) R7 |& a
!  in how this toolbar is referenced in the .rtb file compared to the first6 t+ ]4 d9 _4 Y. C" Q% R
!  toolbar as a group.  The only differences from the first group exist within
( J$ n; t/ E- }! l  z+ Z0 ?!  the .tbr file itself.( {+ y4 h* I& j$ K
!  F! S' {$ j7 y  f5 H: O. d
!  This approach has advantages for customers that will deploy both Ribbon and
. \# l3 x/ \* v8 o  O!  Classic Mode customizations since all the content is defined in the .tbr
, f* A) _! }. s- t# ]8 G( M/ X!  file and it will stay synchronized in both modes.  Only one set of customizations3 H9 g! m, ~( D2 a8 l
!  will need to be maintained while still making use of RIBBON_STYLE to
0 D: @( e6 T6 O; G: t* N+ d!  control the presentation of the buttons on the Ribbon.. H4 z' {  }# K# R9 M! Q
!7 q, I7 v' |% G+ s) I+ ?- V5 |# B
GROUP  customer_toolbar_alternate.tbr
' }2 y& w# J' W: z ; p' ~& o+ Q  t% S
!  The third group represents a Ribbon group that has been created explicitly
5 _. r3 f7 V- ~3 o- z!  as a Ribbon group and will not exist in Classic Toolbar mode.  This is the
  R1 P+ C9 N0 j& p) \!  preferred option since the user will be able to take advantage of all the
4 H" N2 P3 W3 w) O! ^! L" K!  layout styles and containers offered by the Ribbon.  3 p3 V- F, J, l" a$ q
!
7 e( o! y- s, I, s* f( {# i5 o!  For customers that will deploy both Ribbon and Classic Mode customizations, $ F4 _7 ~7 J; V5 w$ D: L
!  this approach will result in no synchronization and two sets of customizations
2 n* s" V- V6 u$ w6 e! d& z!  will need to be maintained.# Z6 `( O# f9 j' e
!' S$ C! d, G4 m; u9 n% `
!  A group can alternatively be defined directly inside the .rtb file by using the
2 K+ Y0 B7 }: s, \3 k1 B9 W, L!  keywords BEGIN_GROUP and END_GROUP.  9 ]: V4 }* A0 a0 o5 B7 Q
!7 |8 c1 t0 V4 E+ y7 Y0 Y4 [
GROUP  customer_group.grb
8 f0 e5 _3 X9 }& _9 ?& D- i: s$ B+ e, C' F, S
!  Example of a button that is placed directly on the Ribbon without being9 b# \4 V9 b3 K& F9 v" D1 a$ b
!  contained in a group.  This is a simple way to add a button to a tab  ^8 f/ i0 S0 S* ]
!  but is not recommended for many buttons since groups have advantages.% g8 P& I; Z2 [2 A3 p
!  
2 k2 {, j5 ~0 H!  A few advantages of groups:
, T$ t  a6 R' o! j1 a* t1 }' c!     1. Easier to move many buttons around together in quick customization.  
9 @' P- w  o# L. H- ]!        For example, MB3 on a group and choose "Add to Left Border Bar".  & s+ J5 I# I9 z. B' m. M
!        This will move the whole group to a new location.  If buttons are
0 k( m* i$ A8 d) e!        not in a group, they need to be moved one at a time.
' s* v1 P0 d5 |- T( I1 V!
4 }8 ]4 p1 k: _!     2. Provide a label to describe its contents.9 l# \& W  v2 E5 b
!( i" G0 N/ b5 h. D
BUTTON CUSTOMER_BUTTON_16 W$ [2 A/ l  s: G
LABEL Button1 Directly on Tab
" h8 V4 Y$ w7 K" ]" i
, c* i' F6 u. K4 B
部分菜单可以单独写成group gallery 作为对应后缀,重复调用4 F( Z% \% k8 y  z4 m
!  Example of a gallery defined in a GRB file., n# W  v- _. f; Y, L' D. C
!
4 z# K& c; ]. {  ^8 D!  If this gallery is to be used in other places, then it could be 1 y3 p2 W7 u: S2 _
!  defined in its own gallery (GLY) file and referenced here
; V( w; \! @2 q  M!  Example:
5 e( U  \6 i1 ^7 k5 i  |, h!    GALLERY customer_gallery.gly
; y( p- Q' h+ a& E# C!+ B$ A- o" r3 C. B# B9 k5 t
BEGIN_GALLERY  CUSTOMER_GALLERY
3 t6 E1 p6 z! O, z& U+ H$ XCOLUMN_IN_RIBBON 2& U0 s, t  q5 E# D% L& j
COLUMN_IN_POPUP 2! H: h0 b5 r: x& U6 C1 y# u5 D0 p3 a* ~
LABEL Gallery' M" _" q1 [" J* p- D8 }/ s% d
GALLERY_STYLE MEDIUM_IMAGE_AND_TEXT
. J4 R1 J6 x) u8 Q. n3 }
: ~, Y. d7 [  o' u    BUTTON CUSTOMER_BUTTON_2- g! E  L2 P! \
   
! R8 q, z8 ^0 H* s3 ]3 {2 j( c    BUTTON CUSTOMER_BUTTON_3
; A4 k" t+ _3 @( e3 n      F, W/ p; B& l) M9 F1 m7 V$ ^  x8 r
    BUTTON CUSTOMER_BUTTON_41 e6 J! ?! e4 x, _( k4 x$ i. i
   
1 U( I; _( R) h# X    BUTTON CUSTOMER_BUTTON_5
4 k+ i" U4 C* V   
6 l" e: ?# J, F/ o- f5 d1 k7 s, OEND_GALLERY: }0 P: w' s0 P
: e0 L* M' |% f$ n1 X
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

在本版发帖
关注公众号
QQ客服返回顶部