查看: 2876|回复: 0

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

[复制链接]

2477

主题

1280

回帖

8万

积分

管理员

PLM之家站长

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

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

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

×
  ^' }, {4 m  W

# D7 U) o, q, l# W7 [
6 Z- p: F  i/ H' \2 b. E8 u- Q5 J' u5 ], e; I. z( T0 F
首先认识下关于菜单的后缀文件
2 b! r, z5 Z! l+ B+ B3 X: N2 M! ~& b4 F, p! ~9 T  Q6 S' }+ P3 N
Extension
UI object
.tbr
Toolbar
.grb
Group
.gly
Gallery
.ddb
Drop-down
.rtb
Ribbon tab
.csb
Cascade
.abr
Attachment

1 }" s: W8 m# x3 b; W) d
  q9 E8 |) S0 z- `RTB作为菜单ribbon 界面定义的关键,详细信息如下+ M& |9 r$ E( k7 b) G0 e; H4 k  \" H
9 _1 W3 A* X6 R

8 ?. z' n& o! E( o5 w; J3 w' Lcustomer_ribbon_tab.rtb7 _3 @. ~! l) r! ]
!( e" I$ R3 k+ B% u" x) S- o
!  Customer Ribbon Tab
6 E- t) K1 ~; \  d: t% \! ; r% P! d& B- A9 \
!  This file will create a new customer tab containing three groups and
) A, g9 `- A# ^! e) b* O4 i!  one top level button.1 T" H7 [; b/ t7 u8 s' M; j2 f0 F
!+ n/ v, w( Y% a& N

$ U# X5 i6 i! q- m8 TTITLE  Customer Tab/ E! v: l6 F) G; H# v0 g2 a
VERSION 170! }, O+ y5 c) k; L& G( f; h
* f* j( ~- }+ D/ O: H0 K
!  The first group represents a Ribbon group that references an existing
' q! v7 K& i4 v- k8 F!  toolbar with no Ribbon style changes.  
4 C  ~% Y. d: n+ I!
6 T1 j9 ~4 l% k7 X!  This is the quickest way to add existing toolbar content into Ribbon mode.4 @, ^- E: v# @( n& r
!
& {% A- s3 H. T4 ~' U/ `* I8 O  R" y
GROUP  customer_toolbar.tbr
* C+ x7 {3 O3 P) d& i
! 如果想直接切换tbr 到 rtb,这是最快的
& k# i4 U# P3 I8 P; j!  The second group represents a Ribbon group that references an existing
2 h9 D: g; O7 I6 ]!  toolbar with Ribbon specific style changes added to it.  There is no difference  I. X% {  y# H( v
!  in how this toolbar is referenced in the .rtb file compared to the first
: Z6 I6 Q+ @: U( W# h!  toolbar as a group.  The only differences from the first group exist within & E. k# f9 Z. [
!  the .tbr file itself.
! ]5 J% |# |7 Z! R9 A!
% _0 {! D$ }2 x# v. h) Z3 H!  This approach has advantages for customers that will deploy both Ribbon and& n% _) t: k5 X. c
!  Classic Mode customizations since all the content is defined in the .tbr
4 e' Z+ U/ r: d, k9 u7 b' L!  file and it will stay synchronized in both modes.  Only one set of customizations
2 o! p2 \8 A  K9 I!  will need to be maintained while still making use of RIBBON_STYLE to
# D' z  G7 Q6 t, h4 O, V!  control the presentation of the buttons on the Ribbon.9 }/ T0 ~* a+ y) V9 X2 w
!
1 p9 T& K- _( c0 `% _( ?* A+ M  yGROUP  customer_toolbar_alternate.tbr/ H* ?4 H2 j- v0 S; z* X
4 _3 r1 h& J! N3 g
!  The third group represents a Ribbon group that has been created explicitly
$ [3 A) W; G# e' C4 e!  as a Ribbon group and will not exist in Classic Toolbar mode.  This is the7 R1 H, y9 R- W" p
!  preferred option since the user will be able to take advantage of all the : s3 s  S( M8 h! t
!  layout styles and containers offered by the Ribbon.  : N6 j5 Z+ C# S- m; F
!
- B6 b% t4 Y* X- @; Y1 S!  For customers that will deploy both Ribbon and Classic Mode customizations, ) y9 q. W" H- A- }) M3 }
!  this approach will result in no synchronization and two sets of customizations
! n9 e' E. j+ M% W2 U!  will need to be maintained.: t! }, O: [2 v% B& m% w, o
!' @: B8 r8 ]$ y: k* h- W4 y
!  A group can alternatively be defined directly inside the .rtb file by using the2 F. C7 d, J* D; U
!  keywords BEGIN_GROUP and END_GROUP.  % U$ i0 L' H# ~. d' \4 u
!. s8 E6 [9 a) G. x6 h
GROUP  customer_group.grb3 p8 U" g: B% ?  s$ u
4 h  ]& h; A8 I7 a# K2 @' x
!  Example of a button that is placed directly on the Ribbon without being
( g9 M+ t& x6 ~; S$ H!  contained in a group.  This is a simple way to add a button to a tab7 v* h( L% _5 k& u. y" O+ D$ z$ Z
!  but is not recommended for many buttons since groups have advantages.. D0 o3 X1 U) v' l9 W9 O$ C# I( x- f
!  : k3 b9 D0 P! ~! I; c* U: ~: t
!  A few advantages of groups:% y4 B; A# g7 p2 i1 m# O, \
!     1. Easier to move many buttons around together in quick customization.  9 ?; p3 ^' f. A( D" ?
!        For example, MB3 on a group and choose "Add to Left Border Bar".  6 ?) b1 [) b& D# y
!        This will move the whole group to a new location.  If buttons are
% B+ {* d: R" }) |!        not in a group, they need to be moved one at a time.  A$ q6 h' q7 v  I) r
!
8 s! @5 ]9 ]7 y# Y!     2. Provide a label to describe its contents.# N: s5 @, ?- M4 B- l7 B1 c
!
0 }* o& M- a$ W7 c( E* a- sBUTTON CUSTOMER_BUTTON_1
  T2 H' }" C7 f/ N2 |' ZLABEL Button1 Directly on Tab

9 M2 V# F7 P" V; E+ J5 d
  [  a& F  d/ {; B
部分菜单可以单独写成group gallery 作为对应后缀,重复调用- Y% g5 T4 N6 a( t+ Y, i
!  Example of a gallery defined in a GRB file.3 X* ]" U0 [4 c% |
!
6 a3 R+ i# {$ U! J4 h7 D!  If this gallery is to be used in other places, then it could be 2 z5 C5 f4 i' o/ a& n' ?
!  defined in its own gallery (GLY) file and referenced here
7 h- r- L3 X/ ]2 K7 E9 C2 K!  Example:
- q5 P$ |) G# Q: A- t!    GALLERY customer_gallery.gly, i1 R9 s  V6 Y" d
!
0 h* s: a" e+ H& J9 g: DBEGIN_GALLERY  CUSTOMER_GALLERY
3 A% v! N& Z2 G+ j6 r/ x: hCOLUMN_IN_RIBBON 2
0 ~/ Q0 g9 K# B& `2 TCOLUMN_IN_POPUP 26 E. c- c) D7 G% y8 h) b
LABEL Gallery- f1 x8 L+ _0 ^0 Y3 b0 p: G0 ?
GALLERY_STYLE MEDIUM_IMAGE_AND_TEXT! }# y2 w8 V  F9 T% N+ L, q
& O- K/ I6 ^" _5 p
    BUTTON CUSTOMER_BUTTON_2; \! }9 ^; ?4 q
   
% n. m6 h6 H' O5 N  n7 w2 x) d) Y    BUTTON CUSTOMER_BUTTON_3$ n& {- \& T* X$ r
   
& U  y! ^& H2 s) w) F( [* p5 g    BUTTON CUSTOMER_BUTTON_4
. i: J& U' D8 d, ?, m) \   
6 }& K0 J$ W$ R2 J    BUTTON CUSTOMER_BUTTON_5$ S! n  E2 p  m$ L5 v" |4 s( e
    6 C' T4 z% p  }  t. D5 _. l
END_GALLERY
' `9 I  v2 S7 @" v, X" }

* a) E" i1 ~& l6 n. `& X% q
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

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

本版积分规则

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