查看: 2566|回复: 0

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

[复制链接]

4

主题

3

回帖

40

积分

管理员

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

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

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

×

7 s* o% H$ Z* I% ?
: }1 \) I+ L# l% c+ ^4 {' [- |) M8 n% a2 `; R3 i* G
; J% q" c( a" D% w/ L
首先认识下关于菜单的后缀文件3 J6 |2 n4 L( d
$ k) F0 K7 a6 K# L1 q
Extension
UI object
.tbr
Toolbar
.grb
Group
.gly
Gallery
.ddb
Drop-down
.rtb
Ribbon tab
.csb
Cascade
.abr
Attachment

7 P. j5 J8 x1 `2 m; h; F/ V+ m! v9 Q) n, }
RTB作为菜单ribbon 界面定义的关键,详细信息如下4 J2 Y- |) o" I( j+ B! C% M7 f

; c! K+ M' s! I5 Q6 K( {8 L6 |5 Q( z4 u' z. E: m
customer_ribbon_tab.rtb
. R8 q7 b1 ^* Y+ f!
% O+ |( ^$ k7 t0 K6 d8 w!  Customer Ribbon Tab/ ?' Q* {5 y7 _  S  \& Y% E
! * J5 r% ^" W- Y
!  This file will create a new customer tab containing three groups and6 }1 j- |8 q4 O+ g5 e6 L5 E- I7 \
!  one top level button.8 \! }% b: j* J% a) j; H6 A
!
, k3 [. a% ?5 b- O# M, t. \
5 ~4 k1 u! Z6 {! w5 z8 JTITLE  Customer Tab
+ O' g& M, v& Z' {! uVERSION 170( g. a* g6 {. T
6 e" q6 D# @* y; e3 H3 r
!  The first group represents a Ribbon group that references an existing - j# I* J/ W$ z0 M8 y* Z
!  toolbar with no Ribbon style changes.  $ G9 ~) o0 b6 h9 o  P
! 7 l; `8 i. f5 x8 k) S
!  This is the quickest way to add existing toolbar content into Ribbon mode.2 J8 J, x, q0 S& z6 k
!4 P3 ?, K! [4 {( L
GROUP  customer_toolbar.tbr9 e: C7 X% M" O
! 如果想直接切换tbr 到 rtb,这是最快的 $ J1 x$ ~% r$ ]9 f" K9 S; D0 `& [( |
!  The second group represents a Ribbon group that references an existing , h8 Z3 q6 Z+ {' K# p( P) k: P* Q
!  toolbar with Ribbon specific style changes added to it.  There is no difference2 K% B+ O+ k# [5 w
!  in how this toolbar is referenced in the .rtb file compared to the first
( K: x) B1 i+ y!  toolbar as a group.  The only differences from the first group exist within
. J; N, p* H( U3 J, N$ o; Q!  the .tbr file itself.- V2 E& N' \3 Y
!. a1 J; e4 U$ d+ H6 |
!  This approach has advantages for customers that will deploy both Ribbon and% w( h# {- V5 t+ E  |
!  Classic Mode customizations since all the content is defined in the .tbr 0 x4 I6 D9 R# k6 ]
!  file and it will stay synchronized in both modes.  Only one set of customizations  y  g7 W/ i2 v# }% O- H' p  T
!  will need to be maintained while still making use of RIBBON_STYLE to ) Z: C. ?0 o, S- V  F! x' @
!  control the presentation of the buttons on the Ribbon.
; A! z* M* `' Y; y!
8 r0 o3 h% I7 ~* `, }( R+ UGROUP  customer_toolbar_alternate.tbr
" {* R& z% G2 [: N( w3 @ % p6 D/ q2 J4 e0 B6 \5 G8 D" Q- L  I
!  The third group represents a Ribbon group that has been created explicitly+ q+ W0 U  f0 d  i
!  as a Ribbon group and will not exist in Classic Toolbar mode.  This is the% V8 v+ M6 I" Z7 {
!  preferred option since the user will be able to take advantage of all the " t" ]/ q: c" G" f6 V
!  layout styles and containers offered by the Ribbon.  ( ?% H+ u% O* S
!/ r2 v# M( m4 y
!  For customers that will deploy both Ribbon and Classic Mode customizations,
& `7 y, ?8 @  C!  this approach will result in no synchronization and two sets of customizations 4 t: Q6 {$ l/ _
!  will need to be maintained.
- A+ e4 f( z' _: I7 ^' J2 [6 P!& ]: j9 b4 T9 A6 M! q
!  A group can alternatively be defined directly inside the .rtb file by using the: R3 H! B. o1 W3 |! n) j: r
!  keywords BEGIN_GROUP and END_GROUP.  # d4 F+ c( E% V: e& X# A
!2 }& R. M' K4 a  j
GROUP  customer_group.grb- V5 N6 o4 j0 R. f

* C  w3 ?( o. ~" k* _!  Example of a button that is placed directly on the Ribbon without being. Z( a# V! t3 a5 y& @1 b
!  contained in a group.  This is a simple way to add a button to a tab
3 D6 H+ ~2 Y# L' }1 {!  but is not recommended for many buttons since groups have advantages.
* R! g' p6 P6 x3 ~9 P  [/ |4 K!  
) A$ _3 @; N  J  N* d+ n!  A few advantages of groups:
. {2 W: P2 o) x& X!     1. Easier to move many buttons around together in quick customization.  ! G/ E( Q. T4 ^2 i9 {
!        For example, MB3 on a group and choose "Add to Left Border Bar".  
5 ]" e. s. T9 {$ m!        This will move the whole group to a new location.  If buttons are 3 Y# Z+ G8 h- `
!        not in a group, they need to be moved one at a time.
4 K: X; |1 p+ W; S/ d2 x!
3 }  }& }5 T# _4 l: I$ t!     2. Provide a label to describe its contents.5 d4 Y5 x/ q) b/ E0 X/ L8 \
!
; P9 {5 V! L( a4 J" U0 dBUTTON CUSTOMER_BUTTON_1
6 \' z+ i- Y9 ]% r" Y  ^5 C' t) YLABEL Button1 Directly on Tab
4 Y5 ^& j0 m- S: K; n4 L# G( E* x! D
5 G( H2 N& D+ v+ {$ t7 B9 S( f7 U
部分菜单可以单独写成group gallery 作为对应后缀,重复调用
1 L2 ^# W4 t5 Q- n!  Example of a gallery defined in a GRB file.
8 a8 a  n: n* J$ _2 h!
+ p$ n2 a# N" O& _+ I: H!  If this gallery is to be used in other places, then it could be
# p+ p5 ~- v% X& D!  defined in its own gallery (GLY) file and referenced here
: k2 }  d' Y3 O$ Z6 }8 w!  Example:" @! U8 R* N( q( I( K
!    GALLERY customer_gallery.gly
  y8 s4 }+ \' s. k0 |5 z% ~+ d!, f; a. m0 r$ c" E2 s# S0 F1 Q
BEGIN_GALLERY  CUSTOMER_GALLERY9 C* r( y" \' C  k
COLUMN_IN_RIBBON 2
1 ?3 A! v. v6 S/ X1 ^  @: ^5 Z. ]COLUMN_IN_POPUP 2- G4 W$ E" ?: `& U
LABEL Gallery$ _/ T* G( A- h' j; b
GALLERY_STYLE MEDIUM_IMAGE_AND_TEXT, o. r5 [( _' J" W4 ^
) J& Z# E. ]7 \) U" {3 E9 b0 d
    BUTTON CUSTOMER_BUTTON_2
' H% K+ u! e2 E, Q' h8 J; H  T& G    9 ~+ E% T% k% R! g
    BUTTON CUSTOMER_BUTTON_3
: ]' ?3 ]3 B/ n+ g7 [; J9 M    3 W; L1 d' G. b7 Y  ^
    BUTTON CUSTOMER_BUTTON_4
: b2 @$ `/ P4 H. K8 _) L( b    & J/ Y: j3 {: `2 P4 s, c2 e- R4 G- K2 r
    BUTTON CUSTOMER_BUTTON_5
4 \( j. S: G  m+ \3 R   
$ T: K* W6 r; J: p% t2 HEND_GALLERY
. p8 P" N- y2 R1 j* e3 b9 i: E
" p0 v5 p9 j! E3 H  r
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.doteam.tech
回复

使用道具 举报

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

本版积分规则

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