查看: 2547|回复: 0

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

[复制链接]

4

主题

3

回帖

38

积分

管理员

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

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

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

×
& R- b- F; p5 ]1 k+ H6 Q( B$ E
  F9 ^5 w0 F& J. c0 d4 M  h+ h5 V5 L, p

# d  [; o/ B$ A# U5 d# C& f1 r' _& ?
首先认识下关于菜单的后缀文件
! |7 q* k$ N; ?+ H- ^. ~+ Z- y- Z& w
Extension
UI object
.tbr
Toolbar
.grb
Group
.gly
Gallery
.ddb
Drop-down
.rtb
Ribbon tab
.csb
Cascade
.abr
Attachment
: v# O8 N& h/ ^" [7 ]
5 e0 p! K; Q" B6 w9 h
RTB作为菜单ribbon 界面定义的关键,详细信息如下
5 U3 F! I8 u' B; k0 D2 O) l; ~. q  g- q
+ ^$ C, }# t3 E+ R
customer_ribbon_tab.rtb( c, B/ }2 Z* V9 \/ ^1 [
!+ b0 ~4 a, I# Y, z: C, u; k2 T+ W
!  Customer Ribbon Tab( |6 x* H' R  d( g
! 7 q# R& @3 k0 ?, X; h9 h5 \- O  ]( W0 s
!  This file will create a new customer tab containing three groups and$ q" F# e1 C, [. w( Z! H, H
!  one top level button." R! ]8 X% e" J: H2 u$ {
!- }, |1 [) l% B/ C" S

3 f9 W; M7 x+ r* ?9 ^6 ?' o. k& }TITLE  Customer Tab
3 c0 b( n. y( t6 t2 UVERSION 170
! Y" k) F) d  V/ k5 K
& C: B% E8 S2 O: m( k. w4 g" N& s!  The first group represents a Ribbon group that references an existing
  X- Z% ?- q4 w4 o" Z!  toolbar with no Ribbon style changes.  2 _! m6 d5 Z! @6 e& d" A: a8 T
! % q5 I6 k6 x( k; U& d
!  This is the quickest way to add existing toolbar content into Ribbon mode.* l* h  S6 p3 z5 j% y( n& ^
!  w  c8 f  L; Y' `: r
GROUP  customer_toolbar.tbr
% G6 l  G3 z5 D5 ^* C# }
! 如果想直接切换tbr 到 rtb,这是最快的
0 u1 q3 D: `# C4 U  x3 H!  The second group represents a Ribbon group that references an existing
5 \4 P( c! \7 Y' X8 R, W% _!  toolbar with Ribbon specific style changes added to it.  There is no difference8 Q, R! Z. N! U! L
!  in how this toolbar is referenced in the .rtb file compared to the first
6 J8 ?8 ?1 [& w5 M/ F  q& t, y!  toolbar as a group.  The only differences from the first group exist within * S3 H; t" _8 d  m5 D% a6 N/ T- d) q
!  the .tbr file itself.; Z* M( `4 T& ?
!
( ~/ C7 r, ?% y. \, \!  This approach has advantages for customers that will deploy both Ribbon and2 w' P" e/ ?* M$ t' Y+ f# ]
!  Classic Mode customizations since all the content is defined in the .tbr * `2 D% I! S' j, l; U: \5 l9 V( s
!  file and it will stay synchronized in both modes.  Only one set of customizations
0 I/ d( [: _! `3 ~1 G!  will need to be maintained while still making use of RIBBON_STYLE to
8 U' R+ t9 n3 \; h!  control the presentation of the buttons on the Ribbon.
' w2 f* s" [& ~! ~: X$ `; d!
3 s+ L0 v9 N, w/ gGROUP  customer_toolbar_alternate.tbr
8 Z4 p& V& K- p; K9 X& b
) m5 L# w( v" r2 d: y/ N( G!  The third group represents a Ribbon group that has been created explicitly
( [( k; L5 }6 C; h. l+ h!  as a Ribbon group and will not exist in Classic Toolbar mode.  This is the
, p4 N4 g  Q) I!  preferred option since the user will be able to take advantage of all the 7 _, y7 T8 @! h) l& t4 r; Y
!  layout styles and containers offered by the Ribbon.  
) `, k# Z% O" K7 k. d% D!
! O) d+ o3 H+ H; W# z' X; U!  For customers that will deploy both Ribbon and Classic Mode customizations, * i- M) @& D, B4 h9 I& f) z
!  this approach will result in no synchronization and two sets of customizations
7 j3 S, c" _  J!  will need to be maintained.& n& ^* d% U3 \, _6 ~
!
( C+ m+ h* J! V3 {0 x' ?!  A group can alternatively be defined directly inside the .rtb file by using the! N) v1 n; X3 |) F2 Z. k
!  keywords BEGIN_GROUP and END_GROUP.  . l# I0 Z1 \) S. w% _' [5 B
!" C& ^- ]7 [) z! K+ Q
GROUP  customer_group.grb& k& i$ w4 @( w) t
! Q. W# Z1 _: K. D8 q# W8 z1 ~
!  Example of a button that is placed directly on the Ribbon without being
& G7 _0 [% z# y6 s!  contained in a group.  This is a simple way to add a button to a tab
  I- i- @+ S; b6 }3 Y  ^( f) i!  but is not recommended for many buttons since groups have advantages.' ?4 D  Q7 N& C
!  2 h; X; ?1 v8 y* \9 [
!  A few advantages of groups:
7 F5 c7 V3 v% W1 s9 l!     1. Easier to move many buttons around together in quick customization.  8 l; I. I# Q5 F
!        For example, MB3 on a group and choose "Add to Left Border Bar".  : M4 e( Q; G! {+ o
!        This will move the whole group to a new location.  If buttons are ; B# \& H2 n) R! \
!        not in a group, they need to be moved one at a time.+ y4 |) g; {& C1 ~
!. l. i$ N3 F7 C3 x! N
!     2. Provide a label to describe its contents.
+ B7 _. }/ `5 Z! W!
2 x; a% c' ]. W2 sBUTTON CUSTOMER_BUTTON_19 ]6 a5 P5 L: k) X5 x9 L' u- ?
LABEL Button1 Directly on Tab

) ?9 \2 z/ {! F5 I8 s& M' H  C
: D6 R- k- ^! \$ O2 H
部分菜单可以单独写成group gallery 作为对应后缀,重复调用5 Z2 w7 G2 g' k; Y. N% c1 M
!  Example of a gallery defined in a GRB file.
3 J  g  x: d  T4 g!
! N, Y6 `3 m/ t! S9 ^3 ?!  If this gallery is to be used in other places, then it could be
. i5 h$ T2 Q3 H' Q- Z( `!  defined in its own gallery (GLY) file and referenced here3 y) d+ ~( S; ^2 A4 |1 L
!  Example:4 x. Y! W6 M, [
!    GALLERY customer_gallery.gly  a, f) v$ b" }% L% E3 ]7 m) W7 t
!
" |9 C3 p# `) N4 KBEGIN_GALLERY  CUSTOMER_GALLERY: }$ r% v% D/ M. d9 C4 |
COLUMN_IN_RIBBON 2, Q3 [3 C1 I5 f0 {2 j
COLUMN_IN_POPUP 2
4 [. _- X0 z- ?  S% d" u6 JLABEL Gallery3 @6 A" M: j, r/ G. U6 g5 c( C7 q4 N% a) x
GALLERY_STYLE MEDIUM_IMAGE_AND_TEXT( g; z1 w8 h( U5 k; J0 U7 x
+ D; J& e7 W  T# a6 }" ~
    BUTTON CUSTOMER_BUTTON_2
2 I. [. s9 s& B, Q/ K6 Q    - h3 C* Z! P- _' f
    BUTTON CUSTOMER_BUTTON_3& L3 R# M0 @5 P% w! V5 _; R
   
, C( Q8 n6 w8 u- Z/ y$ N, ]    BUTTON CUSTOMER_BUTTON_43 _$ t; {4 ?& b, J- A0 v8 l' z
   
% G0 M4 j1 \) A& s2 F    BUTTON CUSTOMER_BUTTON_5
! i/ w# G) i# e5 J   
2 Z! @9 D; c$ E4 X0 i/ w* E- k8 ^END_GALLERY
! k9 _! X& e" @9 N; S
9 O0 @& s2 p8 O8 q5 `6 J: @
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.doteam.tech
回复

使用道具 举报

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

本版积分规则

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