查看: 2622|回复: 0

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

[复制链接]

4

主题

3

回帖

48

积分

管理员

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

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

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

×
+ F. M  B6 E+ S% d" R! C
- l1 j  ^& q; p

& E0 q  o& `: W& k% N  v7 `( \5 `# L, L3 G
首先认识下关于菜单的后缀文件
7 B" K$ r' Y5 S& w/ O5 S/ R8 I7 b( Z, y
Extension
UI object
.tbr
Toolbar
.grb
Group
.gly
Gallery
.ddb
Drop-down
.rtb
Ribbon tab
.csb
Cascade
.abr
Attachment
% V: C0 @- K6 L# d9 h' `

1 o2 w; N9 F/ k: `: b& nRTB作为菜单ribbon 界面定义的关键,详细信息如下
! Q, Q. `  H% V  Q3 V; k8 X% V. D8 Q

# H4 ]' T- z! ], jcustomer_ribbon_tab.rtb
% t' W6 g+ S$ d!
- }( r; R, W- ~' Z/ o!  Customer Ribbon Tab! {) ^6 Q+ g3 L7 I8 ]
! 4 {. X. P  ^- U+ W$ x7 M; w0 X
!  This file will create a new customer tab containing three groups and
1 _! V  ?$ T  P5 G2 t!  one top level button.* |, J9 K$ N. ?' D- ]" x" D
!
+ T( z9 X* l# F* M7 I' P. U1 n6 c1 v8 H% `* Z! m! o
TITLE  Customer Tab
7 u1 j" T8 m* |- HVERSION 170
' U0 C% t% C9 t! w( G( d' |: T- k' B* K9 G7 r# Z
!  The first group represents a Ribbon group that references an existing * o6 m  S/ m1 ~% [) \
!  toolbar with no Ribbon style changes.  
- ?) G1 \& m* c' D, R$ C( w7 m!
" m2 O' m, g" d0 Y& D!  This is the quickest way to add existing toolbar content into Ribbon mode./ P. F  x% }5 o' U  a% y; j% G8 M3 U4 x8 o
!; m8 x4 c' @" I6 _5 G  E
GROUP  customer_toolbar.tbr1 y: R( p2 V8 v' h
! 如果想直接切换tbr 到 rtb,这是最快的
; a- X; v! w/ N/ q/ b& V1 m8 f# @: U' I6 _!  The second group represents a Ribbon group that references an existing
- D2 Z2 S+ C& f1 }+ T!  toolbar with Ribbon specific style changes added to it.  There is no difference
' i( E: x, l  ]8 a+ E!  in how this toolbar is referenced in the .rtb file compared to the first
" ]& I$ x7 E$ ]5 `!  toolbar as a group.  The only differences from the first group exist within 8 E/ {+ g4 N6 {6 Y& f) V
!  the .tbr file itself.
$ c2 q8 \7 O# E1 Y# n. N" x: y!
3 p4 d: P  A0 G3 p!  This approach has advantages for customers that will deploy both Ribbon and
1 l4 c6 `& S: i, G!  Classic Mode customizations since all the content is defined in the .tbr
% M1 p- P0 N% E3 H6 a2 q# q% a!  file and it will stay synchronized in both modes.  Only one set of customizations
5 b/ @) \7 R6 ~0 n% z! Z" K6 H& U!  will need to be maintained while still making use of RIBBON_STYLE to
! e$ Y8 r+ y9 L4 h) s4 J! v!  control the presentation of the buttons on the Ribbon.
! C- B$ F; H4 n7 Y- Y!7 _6 U% Z. W$ c- V* n
GROUP  customer_toolbar_alternate.tbr
6 Z) ^5 o4 Z! v+ a4 P6 |' j
! O$ a) q; w6 \! w. Q3 U!  The third group represents a Ribbon group that has been created explicitly: L( K+ \2 |4 D* d
!  as a Ribbon group and will not exist in Classic Toolbar mode.  This is the) d' _% \8 E' x' u  k# C7 Q' U# V
!  preferred option since the user will be able to take advantage of all the & w, ?. X; u& w7 I7 @+ G+ z3 j
!  layout styles and containers offered by the Ribbon.  6 R, {/ _& ]$ M4 `! |. O% E1 X5 ~
!9 ]% F6 \& V. p+ }  ^9 s% E' B
!  For customers that will deploy both Ribbon and Classic Mode customizations, 9 j8 a& x- H4 c8 m8 L- @
!  this approach will result in no synchronization and two sets of customizations
7 j1 [6 B/ C. ]2 q8 T!  will need to be maintained.
6 G2 c* V- _+ f  \* ^! f!
, O' A0 Y: }& V* S' P!  A group can alternatively be defined directly inside the .rtb file by using the9 [, s3 C; j3 E+ z" H
!  keywords BEGIN_GROUP and END_GROUP.  
. L5 L2 g4 d/ u4 m!( _; r$ }% m1 y8 W
GROUP  customer_group.grb0 D. }3 g  I- E- O; b3 c

3 p5 x) v+ g" D1 J!  Example of a button that is placed directly on the Ribbon without being0 V1 S2 P7 Z+ g. X) a1 R4 ^, ?4 i
!  contained in a group.  This is a simple way to add a button to a tab8 c1 p" `& {" f: u2 v
!  but is not recommended for many buttons since groups have advantages.
. U# r5 a3 r1 t. L+ ?!  
8 C3 L: X2 ~* X% A!  A few advantages of groups:
2 M7 L- P- h" N8 s8 a+ l) j!     1. Easier to move many buttons around together in quick customization.  
. W/ J2 x- k6 a8 l7 O1 {: r!        For example, MB3 on a group and choose "Add to Left Border Bar".  
1 t7 D6 h' B0 P  c) R$ \!        This will move the whole group to a new location.  If buttons are
- ]1 Q) U, k. w1 a0 [: p2 m& A- n!        not in a group, they need to be moved one at a time.7 }% E. A7 m! x. |
!
' V. Y! z9 N4 d# J! M! o8 f!     2. Provide a label to describe its contents.
, q( e2 x0 H/ j; U/ l, E0 g!: t' z: z6 K/ n! l
BUTTON CUSTOMER_BUTTON_1
9 d& u7 {9 K/ }, d4 L7 Q- wLABEL Button1 Directly on Tab

4 M# R* U* Q" @* Q7 n" @
2 {4 A. Y% t! }7 h( \9 M2 T( K# o
部分菜单可以单独写成group gallery 作为对应后缀,重复调用
0 F/ G8 S3 g4 e7 V# {  _2 H!  Example of a gallery defined in a GRB file.) w, p% m7 ]% _, t$ }
! + P. s% |1 M' |2 d% v! a
!  If this gallery is to be used in other places, then it could be
( R9 z: A7 i1 z3 C3 h! ?# y# Q!  defined in its own gallery (GLY) file and referenced here
/ b0 L; ^( f6 r!  Example:
  \0 K0 ?  g& d) _!    GALLERY customer_gallery.gly
: s% m+ ?9 {8 }; x2 W: O" E) ^3 S!
, Z# R$ q5 `3 c# S( UBEGIN_GALLERY  CUSTOMER_GALLERY
' }  z! U5 p1 p" D, @  l1 o: |COLUMN_IN_RIBBON 2
$ U2 e# O1 ^8 F- n! O5 {" ?$ ~COLUMN_IN_POPUP 2
+ U$ F. C* B( @2 z' M, k8 t! ULABEL Gallery+ Y1 a) k- {* q0 p9 V
GALLERY_STYLE MEDIUM_IMAGE_AND_TEXT' b, u) {! l+ o: J# \- y( I* c

$ c7 J; A8 O5 Z2 ?8 ~    BUTTON CUSTOMER_BUTTON_2
0 e& T( S3 j1 K) _; ~9 q6 T# f. f    9 j9 F! B9 h0 I0 L$ f3 F0 A5 y
    BUTTON CUSTOMER_BUTTON_3
' r  [& S2 Z, I' B    1 \+ U' P7 E) b4 X
    BUTTON CUSTOMER_BUTTON_4, F' r: R6 T% n6 z
   
' W' ]/ B) j! k- H8 m; [    BUTTON CUSTOMER_BUTTON_56 |, D* b4 O) A, f
   
  A5 c9 S+ j& \" _END_GALLERY
; l. W, @: t: U& v* j, F
7 x" `) e/ v+ z6 B8 ]& K7 h
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.doteam.tech
回复

使用道具 举报

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

本版积分规则

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