查看: 2740|回复: 0

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

[复制链接]

6

主题

4

回帖

60

积分

管理员

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

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

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

×

. I) ?  g" T5 w9 N
4 O6 `+ C% ]8 o! D1 f2 T. H9 ^0 ?# [5 {3 L6 g0 E1 R2 |, I
# F2 c' t( X( }! ~
首先认识下关于菜单的后缀文件9 V+ G4 J; u5 g

6 q/ h7 k8 g: C4 f4 f% E& x$ D) r
Extension
UI object
.tbr
Toolbar
.grb
Group
.gly
Gallery
.ddb
Drop-down
.rtb
Ribbon tab
.csb
Cascade
.abr
Attachment

1 s; V! g( ]; J) P- P# s' _+ l; I8 V0 n7 g0 Q0 X
RTB作为菜单ribbon 界面定义的关键,详细信息如下
: V( g: k; a5 q3 k8 B3 q% L! N0 x# ?  C" M
% s3 v( [! H2 @; C
customer_ribbon_tab.rtb
5 ]6 ?% e. o& O!+ J$ Z: X' K$ X5 a
!  Customer Ribbon Tab
0 p( ~/ ~; J& I8 l!
9 e+ V9 a7 e  Y) T!  This file will create a new customer tab containing three groups and
& H: i; m$ d5 A- t2 z: T!  one top level button.
3 M$ }5 |) a. u0 U, u!& ~5 ?- x) ]  u# P

/ \& p. u% x) E2 BTITLE  Customer Tab' n- B2 m) W9 p' s! c
VERSION 1708 R- K3 i3 _* y, X2 S. A
: q9 j! T# p6 p) D, r- `
!  The first group represents a Ribbon group that references an existing # V  U5 p  M3 Q8 V' m. Y4 C
!  toolbar with no Ribbon style changes.  9 w0 i3 Y9 \% a
! ( T+ c' Y- z2 u: A+ e
!  This is the quickest way to add existing toolbar content into Ribbon mode.
) G/ e5 i4 H" D. F. u!
, S( W( a' \" J! |  J8 r( y
GROUP  customer_toolbar.tbr( F; K# A6 P/ I2 @: W
! 如果想直接切换tbr 到 rtb,这是最快的 # u/ o; i* b  u' f$ i
!  The second group represents a Ribbon group that references an existing
9 O2 C+ O1 A% I2 t  x$ }' d' [!  toolbar with Ribbon specific style changes added to it.  There is no difference; e! N5 ?0 `6 Y9 u
!  in how this toolbar is referenced in the .rtb file compared to the first6 n  W: \# U  w
!  toolbar as a group.  The only differences from the first group exist within
8 |0 z$ @7 ~! r* |! O!  the .tbr file itself., F" `4 y5 K' n8 M& v: R4 V- D9 T9 k
!
, Q- m) k1 w# k!  This approach has advantages for customers that will deploy both Ribbon and
. g2 {& @0 _5 C0 q6 ]: y: s!  Classic Mode customizations since all the content is defined in the .tbr
7 f# z6 B3 r, B; K!  file and it will stay synchronized in both modes.  Only one set of customizations. J; o/ t) g1 z5 {8 |1 E: h$ k1 r. W
!  will need to be maintained while still making use of RIBBON_STYLE to $ N# c* p0 _5 ]7 E* x! a
!  control the presentation of the buttons on the Ribbon.. e# |/ }# z% I, n4 }. F* o- f
!
% j) m- u) Z" S4 X- m, qGROUP  customer_toolbar_alternate.tbr: ?: q) @* {; z/ N* F0 Y8 l  Q2 }0 a

7 A- q0 i+ H( L, w* k1 h3 W!  The third group represents a Ribbon group that has been created explicitly+ z8 a7 O( d( n0 c
!  as a Ribbon group and will not exist in Classic Toolbar mode.  This is the
* Y9 }/ N% n% S9 Y# a* c$ w!  preferred option since the user will be able to take advantage of all the
1 d$ g3 @( l5 s' P  w4 g! r5 {% s! h+ j!  layout styles and containers offered by the Ribbon.  8 }& |: s% y  X$ Y% v% A
!: M1 O- S' ^7 E+ ?+ N# d# E6 |
!  For customers that will deploy both Ribbon and Classic Mode customizations, ( v- R7 J8 z* D) X3 Q
!  this approach will result in no synchronization and two sets of customizations 4 |2 Y1 C- U$ j6 J. z; K
!  will need to be maintained., a" A1 i7 ]1 S2 p2 _
!
6 c7 I+ q# D2 ?2 X!  A group can alternatively be defined directly inside the .rtb file by using the
( O$ q5 k/ D/ u+ \! H! I! r!  keywords BEGIN_GROUP and END_GROUP.  
2 \2 O2 l* Y+ B8 M: J!6 d* M# f, C1 B- A% n1 A0 \
GROUP  customer_group.grb( u, e1 f$ l4 U6 J
9 T+ x' f8 [( p% Q
!  Example of a button that is placed directly on the Ribbon without being
2 G0 N; z# h" {6 U+ x5 D!  contained in a group.  This is a simple way to add a button to a tab
3 i5 m* a0 ~+ A: p5 g. w!  but is not recommended for many buttons since groups have advantages./ w  W) o5 {# Q0 ]1 I6 ^- U% M
!  7 s1 q: C4 F# t: j9 b
!  A few advantages of groups:
7 ?4 [! l1 m6 `; B* @!     1. Easier to move many buttons around together in quick customization.  
" M$ R2 }% z4 g' A. O!        For example, MB3 on a group and choose "Add to Left Border Bar".  
* d1 h! H: e6 p$ J!        This will move the whole group to a new location.  If buttons are ' q1 z9 A% M) {6 _: D$ K% a/ r
!        not in a group, they need to be moved one at a time.
; p2 Z6 ]% r7 ~2 S! R% {!7 f) s4 G6 {! a) X. D
!     2. Provide a label to describe its contents.& v( A! o1 O- s# q5 |. r
!
, N* ]2 v1 y. ?BUTTON CUSTOMER_BUTTON_1
" u1 N- t5 y* i& g. O6 BLABEL Button1 Directly on Tab
* {; |9 A4 f7 \# B  Q$ I- o

1 T4 M) h0 d( L' q
部分菜单可以单独写成group gallery 作为对应后缀,重复调用/ ~' R# q( I" V' [; K
!  Example of a gallery defined in a GRB file.' {  C& @* }4 g0 y' N
!
$ b: g7 @. h$ z, \!  If this gallery is to be used in other places, then it could be
; a% @: H9 [8 l) s!  defined in its own gallery (GLY) file and referenced here
, n4 M7 n8 r  p9 n' @& t!  Example:% E. {5 m7 N2 o& ]% K' W" C
!    GALLERY customer_gallery.gly
7 v  [) U# X9 E!
/ K$ s) _7 i* {BEGIN_GALLERY  CUSTOMER_GALLERY3 e, j. b8 x) C5 Q
COLUMN_IN_RIBBON 29 ~0 h3 D+ I+ d! G
COLUMN_IN_POPUP 25 d; c9 Q- D! }3 T# w* F
LABEL Gallery# S! g2 d8 b2 m" L# }% N( R. [; h( M' J
GALLERY_STYLE MEDIUM_IMAGE_AND_TEXT: M, M$ g) `% n" H" A
; F, K  @/ k% B  |; f) |7 K, B- W
    BUTTON CUSTOMER_BUTTON_2
' y/ s8 ?- X0 o8 R* p1 P   
2 R/ y! ^! E' U    BUTTON CUSTOMER_BUTTON_3: `+ d7 ?. l; z5 d
   
; R& h) P5 ^' W3 r! X9 k    BUTTON CUSTOMER_BUTTON_4
* C: ]3 d3 L7 \8 T   
$ _6 y8 M! |  r, i) j4 Q$ p( P    BUTTON CUSTOMER_BUTTON_5
- a( f( M4 T: k1 k; K' j    5 w1 |6 k& L, Z
END_GALLERY
7 s6 e7 T# M( f, D3 L
8 y  J6 {/ \! i" q, F8 e. \+ T
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.doteam.tech
回复

使用道具 举报

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

本版积分规则

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