查看: 2907|回复: 0

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

[复制链接]

2480

主题

1280

回帖

8万

积分

管理员

PLM之家站长

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

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

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

×

$ d- P1 o# v7 N$ Y$ |2 _$ I' T( y& P$ U
2 V7 h1 d; a2 s

- A! N/ _$ ?4 i, z' Y. g首先认识下关于菜单的后缀文件
6 z8 K1 r# E* D. b; a8 m
; x9 }: R) v  S' E# O
Extension
UI object
.tbr
Toolbar
.grb
Group
.gly
Gallery
.ddb
Drop-down
.rtb
Ribbon tab
.csb
Cascade
.abr
Attachment
8 P/ R; M4 ~4 I2 B
9 ^+ l( o2 V2 q5 M. Q( k8 ^
RTB作为菜单ribbon 界面定义的关键,详细信息如下
; `& R# A+ z2 v8 T' D2 d2 W1 P- e- _1 f3 [8 c+ V
% A" n. ?2 Z4 c6 c
customer_ribbon_tab.rtb/ s& K4 I% e& `) C. x( N  Y
!; Y8 @# M9 N; ^% M3 W4 q, d
!  Customer Ribbon Tab; Y1 ^0 k) F" g5 m. V* K7 o9 P
! 3 B& l# u6 M7 x; \% z
!  This file will create a new customer tab containing three groups and
) n0 e9 L0 b2 E9 u0 f!  one top level button.) s( c7 J3 F( [2 I0 q; R3 {7 k
!, I5 |& ~. {! U: Q! j: M2 i  A! m6 c

. Z" c5 z& Y$ h) ~: s0 nTITLE  Customer Tab
; m) h# k/ m. iVERSION 170
6 x; W- G3 X- u; {1 P- @; \# b7 K8 S9 I. P. M/ _; J4 k
!  The first group represents a Ribbon group that references an existing
7 K; ]7 m2 K) a! ~!  toolbar with no Ribbon style changes.  
5 O  k3 z/ S" E! ]5 H' F!
9 v7 X. }# ]8 ~9 M!  This is the quickest way to add existing toolbar content into Ribbon mode.# R# I; }4 r) p9 ?% J2 C# @/ _
!) \# w& B) N  ]7 j
GROUP  customer_toolbar.tbr
3 c* A! P' R  b- V( \; G% E
! 如果想直接切换tbr 到 rtb,这是最快的 ' g8 K, ]; w) h5 ^
!  The second group represents a Ribbon group that references an existing 7 H6 O' _0 E9 _; ]) f9 K
!  toolbar with Ribbon specific style changes added to it.  There is no difference: K+ T2 j3 X; y9 I, P
!  in how this toolbar is referenced in the .rtb file compared to the first9 z2 R3 _2 y% s& ^6 k
!  toolbar as a group.  The only differences from the first group exist within
: ~4 F9 L! \; R- s- d+ m; C( B- s3 l5 d!  the .tbr file itself.
$ Q, P5 H" w* ]) B!
9 y' {+ r0 A8 V7 y$ l) J. U!  This approach has advantages for customers that will deploy both Ribbon and
9 n$ k( `/ ]9 L0 s6 w& E!  Classic Mode customizations since all the content is defined in the .tbr ! o+ Q6 X$ r/ Q9 {* Z( s
!  file and it will stay synchronized in both modes.  Only one set of customizations7 w" N: @7 h- N+ k# x# ~9 v
!  will need to be maintained while still making use of RIBBON_STYLE to 6 h0 P+ L! b' p( P8 i3 J
!  control the presentation of the buttons on the Ribbon.1 @2 E3 p+ e1 P- n0 I* P! x/ V
!7 ~2 j# G( I4 u% {# f
GROUP  customer_toolbar_alternate.tbr
& l! C3 d1 Y& L7 w3 x
; B2 N7 I+ u( ?!  The third group represents a Ribbon group that has been created explicitly
2 Q) h; ~" O% q- n, i0 [9 b!  as a Ribbon group and will not exist in Classic Toolbar mode.  This is the
8 \+ R. D% i, C5 Y# S!  preferred option since the user will be able to take advantage of all the
& }& \) W/ h7 C!  layout styles and containers offered by the Ribbon.  
0 q) X4 z' J" A, f7 c!3 S8 J$ O9 ?9 ?( P- z7 |
!  For customers that will deploy both Ribbon and Classic Mode customizations, ; x- I5 r; M" `. `
!  this approach will result in no synchronization and two sets of customizations 3 D( [) a! }  A- z/ }
!  will need to be maintained.0 U; H/ b- K4 L" v9 A6 U  ^
!
6 `) c, f8 w! M  s3 t! M- ~!  A group can alternatively be defined directly inside the .rtb file by using the. `. {9 u2 `* s! x7 m
!  keywords BEGIN_GROUP and END_GROUP.  
+ {& N. V! ~. |  Z!
4 r; W6 B* X1 }, S# N, EGROUP  customer_group.grb# q6 a0 n0 g: e7 Y2 [, h' ]
! t4 r- L5 O& x5 D5 h% y( R! x
!  Example of a button that is placed directly on the Ribbon without being
! C9 i) A7 A1 ]. E* C!  contained in a group.  This is a simple way to add a button to a tab
9 P$ j/ G6 R9 ~9 z/ S; K!  but is not recommended for many buttons since groups have advantages.: v0 {( M1 R- _/ x# X7 T
!  
+ p! S" _2 N( v  `2 |!  A few advantages of groups:- O  [: B0 m/ h# d( _# P& e
!     1. Easier to move many buttons around together in quick customization.  , |4 B& R: N* j
!        For example, MB3 on a group and choose "Add to Left Border Bar".  ; \% x/ i- D  q2 y
!        This will move the whole group to a new location.  If buttons are
+ L5 m( o& X5 c% _7 \8 ^  j!        not in a group, they need to be moved one at a time.
" ?6 I6 P. O& [3 W!5 v# @  n' T) h+ K
!     2. Provide a label to describe its contents.
. ~) [, q" N3 p- |) ]8 J- c" g7 a!
2 A. E- f3 Z& OBUTTON CUSTOMER_BUTTON_18 V' K) q9 W" E- z' F0 H7 ^5 E
LABEL Button1 Directly on Tab
5 _( g& R/ E/ R; J. ?

: P, k4 P. q+ l" T- S, Z
部分菜单可以单独写成group gallery 作为对应后缀,重复调用' O. c6 B9 b# Y& ]+ M8 Z
!  Example of a gallery defined in a GRB file.2 @! Z4 f% u1 n% u/ L6 _, r
!
1 c  F+ [+ z$ Y& H6 `1 x!  If this gallery is to be used in other places, then it could be , K7 x. g& d8 j( G0 y) ^8 @% g1 y
!  defined in its own gallery (GLY) file and referenced here
8 F0 L3 r( g$ w9 E( ~; Z' w+ J!  Example:
% }6 p# h. o1 q1 i& c!    GALLERY customer_gallery.gly' s1 Y3 d3 B5 N
!7 U( \$ F1 U0 r
BEGIN_GALLERY  CUSTOMER_GALLERY8 R2 T6 I; P, p# a, w. v" M4 |
COLUMN_IN_RIBBON 2
. g0 ^+ U7 U, MCOLUMN_IN_POPUP 2
6 X$ M) C0 g" B. }* a3 dLABEL Gallery
9 g3 h; Y: s3 A& I7 pGALLERY_STYLE MEDIUM_IMAGE_AND_TEXT- t: |5 f7 C6 X# d( D$ C

3 b: _8 O, h6 e' O, ~" `    BUTTON CUSTOMER_BUTTON_2
8 W0 X. l' ^% h" X. Q    5 m7 \2 Y( M/ A0 q3 k
    BUTTON CUSTOMER_BUTTON_35 G. |. e6 L, M
   
1 g) y( C; z  @# R- a    BUTTON CUSTOMER_BUTTON_4
4 M* s, \, I5 S. t1 f$ B0 A3 j    0 t5 I  N# Z! `
    BUTTON CUSTOMER_BUTTON_5
" W) k, ?% K# W; A( V1 l, U/ M    3 E* u6 s! Y2 o
END_GALLERY
/ u  u  j2 X  F
4 M9 z; [- u* q& G) z. B& x
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

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

本版积分规则

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