查看: 4689|回复: 0

[资料分享] 关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧

[复制链接]

4

主题

3

回帖

48

积分

管理员

积分
48
发表于 2015-1-9 10:37:48 | 显示全部楼层 |阅读模式

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

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

×
关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧+ Z( W/ I" L- ~# t: t' R

经典界面到RIbbon界面转换

经典界面到RIbbon界面转换

/ e: W7 o3 `7 t% V8 l9 g6 w: d在经典界面下,需要的文件& C6 h5 m- _1 V+ Z; u- U& K
  • customer_men.men
  • customer_toolbar.tbr
    * v# G: J6 C8 |: \& Z
在ribbon界面下你可能需要的文件 6 e) Y. k  }7 \( [1 c8 a) C
  • customer_men.men
  • customer_tab.rtb
  • customer_toolbar.tbr
  • customer_toolbar_alternate.tbr
  • customer_group.grb
    ' j8 r' n- w2 Q+ M$ \9 O' z$ A
4 t& J+ {; E) ]# W1 l) v$ x0 T! [3 \

! d) {* Q- R0 ~) J! o  j举例如下:$ I+ M: C; ?% }, h4 U

& R7 D' p3 t- G: b: {3 q5 @6 s7 _2 d' {/ W6 c+ B, X: a
customer_men.men) j( C4 |7 A; d+ H+ R2 q
!
+ J% B4 W. X. V2 c0 P% y!  Customer menu file
& N4 `7 X5 L- ]5 Z, o!
, \. `0 q7 n) l4 }6 r!  Contains button definitions to be used in
8 L6 h- x1 q2 `!  toolbars and Ribbon files4 ?, Z' D" D9 V5 r0 N
!
" l! b8 h. l7 |- C# A' [5 u; `+ T$ u4 k* N: x$ h
VERSION 120  N) {% N- T! D0 C- I: t9 x
' t1 z3 _  R+ `6 m1 m3 n0 z1 v/ I
EDIT UG_GATEWAY_MAIN_MENUBAR$ v% _/ A, H4 R/ {' V
9 ^! S, I* w* Y, z3 {- G
TOP_MENU
9 M6 {( s  q' g! G2 k    CASCADE_BUTTON CUSTOMER_MENU- J, n8 M* T: U9 E% F, S$ T, V$ @
    LABEL Customer Menu
+ C' _0 M! r9 d/ t/ o4 a( x0 Q! O7 s5 v5 w8 W2 }6 ?, u, p
END_OF_TOP_MENU
( j9 G# t; Q" P' D4 k3 G6 p" A
8 Z: o( @  @4 j! A. `1 T2 a( ]MENU CUSTOMER_MENU
$ N: }, {- Y8 K% W; K3 D, ?. l
4 L- W* G& ]) ~& o. p    BUTTON CUSTOMER_BUTTON_17 W) ?1 u$ \5 B; q% C
    LABEL Menu Button12 X3 S+ v' K* {& i4 `  r
        RIBBON_LABEL Ribbon Button1* P1 i5 i  t7 p1 f
        TOOLBAR_LABEL Toolbar Button1
6 j! Y6 j* v" v: Q8 T, @+ s    BITMAP fileopen3 U" b; D% F6 F3 G" h) l( Q& m& C

2 C1 t' m6 ]6 l5 i0 s8 I) [, N    BUTTON CUSTOMER_BUTTON_21 _/ T  n' a' @8 [3 R
    LABEL Menu Button2$ C: u! Y1 J1 y* ^& j9 p
        RIBBON_LABEL Ribbon Button2! _7 J+ W0 {$ j1 M! k
        TOOLBAR_LABEL Toolbar Button23 o2 h+ C/ j" \
    BITMAP filesave
3 W$ \8 t8 e) y, |
  {! ~& n8 b- b$ `# Q. t. E  f    BUTTON CUSTOMER_BUTTON_3/ `1 n* `1 W$ s: G3 @
    LABEL Menu Button3- F6 X& |" R) i6 A5 d0 L
        RIBBON_LABEL Ribbon Button3
7 X7 h* R4 Q) v. l' A* C' a! [        TOOLBAR_LABEL Toolbar Button3
2 Y; [" b  s5 w. }- t" h8 V    BITMAP current_feature
( R% r8 n( I' o/ o3 k, `) C, g
* m3 B: E. d# P7 G8 K0 I4 h: M! H  j    BUTTON CUSTOMER_BUTTON_4
) d9 [1 ]4 w9 {$ M2 H& \% T    LABEL Menu Button4
( ~& c6 o: X) J, ?& m' @% Z        RIBBON_LABEL Ribbon Button4
/ ~$ Z6 S. @7 l- p2 U        TOOLBAR_LABEL Toolbar Button4
6 g- @5 T& F+ C  [    BITMAP block
5 M% L( q% W) G
) o# p. {% t2 _' q( \    BUTTON CUSTOMER_BUTTON_5
( c& v( j5 i. _# K* ^4 w+ B$ T! p    LABEL Menu Button5/ A, T/ o2 G2 l8 X5 X; n. j$ T: n
        RIBBON_LABEL Ribbon Button5
9 m& ^' }4 m, P, E: k" Q+ c) G, n        TOOLBAR_LABEL Toolbar Button5
0 D0 A# G% c; ?. v& |4 O) ~% _/ \    BITMAP checkgreen6 c# f4 {0 v' r

( U* X7 I# ^; tEND_OF_MENU! S  y0 m& x5 }
1 H1 H7 e7 m9 y4 V' ^

$ J" g. G% U7 s% C! z# x$ e. w2 T3 M0 s. h! H! h& X3 C( h/ j: S
customer_ribbon_tab.rtb" ~5 M* G7 a2 K. S
!
9 k; C/ L5 N5 s5 @1 ~3 b!  Customer Ribbon Tab
  P  f( h) |/ V!
" m* o4 J5 p) V/ X; _9 r. Q!  This file will create a new customer tab containing three groups and
8 v/ c7 o3 ^, E( [8 u+ F0 {8 p!  one top level button.& M) i: w) N: q8 D% I3 E" m
!
6 `5 V" W6 h; h/ a! W
0 V, E4 D) B$ m# }1 R4 yTITLE  Customer Tab
  B: T4 T6 f! r7 z; X: g( aVERSION 170) m/ e" b/ m+ A$ K: S% ]5 m4 H
! Q2 ^, t# e$ j# o3 K
!  The first group represents a Ribbon group that references an existing
' T+ L( y! T: F- X!  toolbar with no Ribbon style changes.    r4 d/ _, V+ A9 s$ ~5 k
!
+ y2 H3 {2 b! b* U!  This is the quickest way to add existing toolbar content into Ribbon mode.
$ Z. z1 ]) t/ m# f6 \) _!
- i) b) W. F; O. v$ jGROUP  customer_toolbar.tbr
* H& L2 F+ g, A. e  Q% F0 z, B3 y+ ^- @9 W4 x
!  The second group represents a Ribbon group that references an existing
4 N+ r6 W4 g  G!  toolbar with Ribbon specific style changes added to it.  There is no difference
, B$ `7 G1 d2 `!  in how this toolbar is referenced in the .rtb file compared to the first8 a' o) |% c4 _6 V7 ]
!  toolbar as a group.  The only differences from the first group exist within ) F; L9 r/ |# [6 V2 B
!  the .tbr file itself.
/ M5 j& h1 X5 ]  o, L+ p7 Q!
2 H( e& M3 e( F; m!  This approach has advantages for customers that will deploy both Ribbon and( C/ I- d" D6 P3 X- ]1 E
!  Classic Mode customizations since all the content is defined in the .tbr 3 q9 s) F! N1 Z6 K' ]. f, ?
!  file and it will stay synchronized in both modes.  Only one set of customizations4 m" s: a/ T' v9 G9 U
!  will need to be maintained while still making use of RIBBON_STYLE to ) W( A$ A) D0 r& k7 N0 y
!  control the presentation of the buttons on the Ribbon.9 O8 \* Q# l9 X
!4 H* I* p; l! m* |
GROUP  customer_toolbar_alternate.tbr
3 |# h9 I5 B1 C4 `/ b9 A9 e6 K: B1 Y+ p! |' H/ d
!  The third group represents a Ribbon group that has been created explicitly
# `  @9 x  b) l1 `1 l7 s& b!  as a Ribbon group and will not exist in Classic Toolbar mode.  This is the
0 s8 C! U" b4 ?& j$ e5 I!  preferred option since the user will be able to take advantage of all the 8 O% t# {/ O9 h
!  layout styles and containers offered by the Ribbon.  : Y/ U) q2 F  g9 G- H5 s
!
6 K' r% l, x3 L4 t' e% y  n- F2 C!  For customers that will deploy both Ribbon and Classic Mode customizations, 7 n, M( _" k- u0 U5 ^
!  this approach will result in no synchronization and two sets of customizations
# l5 J  H  H- [6 }4 `; i: ?!  will need to be maintained.& ^% y) p* W8 S: V3 R
!
* `7 U. a$ g9 Q# t1 B+ b!  A group can alternatively be defined directly inside the .rtb file by using the
' o$ b( Y! {& H- w8 J  u!  keywords BEGIN_GROUP and END_GROUP.  
3 J3 J- W6 H3 T8 s4 W0 M) K!" l) J  x) O" v
GROUP  customer_group.grb
* ~) m. i+ t0 S- g2 J6 p# r  @4 {& o% D+ r6 [
!  Example of a button that is placed directly on the Ribbon without being
* a1 G% f% K% V! f+ R3 ]/ Z' F!  contained in a group.  This is a simple way to add a button to a tab; e; K) R; f/ |( D: `
!  but is not recommended for many buttons since groups have advantages.$ n4 \3 j6 ]7 n7 W( D( K& {
!  , j5 {' o/ J2 p- _+ }
!  A few advantages of groups:
% ^6 M2 o  B9 z7 ^. K!     1. Easier to move many buttons around together in quick customization.  
$ g' e" ^! G8 n' N* f5 @; A!        For example, MB3 on a group and choose "Add to Left Border Bar".  0 l' ~& i9 G' Z7 G, l3 i7 g
!        This will move the whole group to a new location.  If buttons are   w$ C% n4 ^: Z$ P7 @
!        not in a group, they need to be moved one at a time.
: D( j. \9 m9 r; i( L: s7 N!
6 b3 u: z3 @) V! {3 ~: P3 ~9 H!     2. Provide a label to describe its contents.
8 B7 W; r( P& C: Y0 s: j0 z!7 R) E. N* ?% d% h! H
BUTTON CUSTOMER_BUTTON_1
$ t# p) H, G' D1 D" b6 w' |" F3 l. RLABEL Button1 Directly on Tab
; d' D( M+ k  l+ f' V3 K/ F: G/ F: e) I+ z7 _7 G0 H0 j3 b! B+ W4 @
3 n" g5 Y3 y& x) v3 `; u+ e) I
$ M4 \3 H& M/ J, L
customer_toolbar.tbr
: j7 G6 B" B& G8 H2 ~!
" |  \6 M; t, s+ {' {3 f!  Customer Toolbar File; k/ ~$ a0 z. k( H# u. a& }
!2 W2 H% W# p) ]2 }4 F  S( T
!  This is similar to an existing toolbar file containing8 L8 |- v' C1 g+ T0 X
!  no Ribbon changes.
. U" y) s- p! n% t+ ^!+ J% U, h1 i& ^+ ~7 l+ B4 m0 b  E
!  In Classic Toolbars mode - This toolbar will still show up in the 4 {, D' p  J* C- g
!     toolbars list.
3 M6 c4 e8 _/ P. E: Y3 i! \!
+ N5 k( v9 U" c" Z1 W!  In Ribbon mode - This toolbar will be automatically converted to a 4 S% _# I- R: B* O
!     Ribbon group and will appear in the "Classic Toolbars as Groups"
. m- @" x) J* z0 U+ U!     section in the Customize dialog.' x- t- e0 ?# u4 c  m3 Q
!  
3 [5 _* k  c* f9 B6 O4 i2 n+ K1 _# j2 ~. R, i
TITLE Toolbar
9 S5 h, ]2 u$ J4 ^. Z  V& ZVERSION 170% W! K1 J- Y( J2 I& m
. h  y) X5 S9 P- Y$ }( l) j
BUTTON CUSTOMER_BUTTON_1
+ |# `- G+ i+ ^* [+ r* L) Y6 `. x# H6 b; M
BUTTON CUSTOMER_BUTTON_2) i, |/ j2 f% N) }! V

9 H  Y3 B7 I6 E2 p9 z$ g7 KBUTTON CUSTOMER_BUTTON_3
+ e( h' O" O* v" I: Q+ d! b+ w0 I- ~% E( X. u  t/ L; }
BUTTON CUSTOMER_BUTTON_4& \& ]0 ~" T1 x+ I0 [3 \6 E5 O% N
  ?; O' _, C9 {' Z. N, r
BUTTON CUSTOMER_BUTTON_52 C2 p- A' I' u1 x" `
2 L# P' U$ c* l- L& y9 y$ \

+ i( V- E1 l2 G) b* b$ t1 C3 c  Y' s4 F8 m) I/ O, S
customer_toolbar_alternate.tbr
% ^1 M. P% I+ @" S; T# A' v4 E) Q!
7 V! o3 H2 F2 a& K!  Customer Toolbar File (Alternate)
4 `  Q, Q% D. Y!& ~* y9 m2 t) h. V
!  This is similar to an existing toolbar file with new
4 k9 @9 }9 ~+ H( H6 s4 k: e7 R4 {!  Ribbon styles added.
( u0 h0 z  k) s& x" `" C1 O!  - }5 J* W" h$ H" @, P
!  The RIBBON_STYLE will be honored when the toolbar is loaded 5 C8 |" G0 w+ K0 D6 g
!  in Ribbon mode as a group but will be ignored when the toolbar ( J* W0 F9 O' j0 @  {
!  is displayed in Classic Toolbars mode.3 m9 M1 r4 l! E2 u1 L
!
* ]! l7 @: q: g' k!  In Classic Toolbars mode - This toolbar will still show up in the , c! x, @& p8 y5 p% \  B3 @
!     toolbars list.
- l( @1 v) e8 v& M+ h% @% d9 z!; X  W) u- _: u$ p7 S; x5 V- F
!  In Ribbon mode - This toolbar will be automatically converted to a
9 M- j7 D- F) x7 Q0 v!     Ribbon group and will appear in the "Classic Toolbars as Groups"
7 M2 w" `! i6 [" j! M* T4 ~5 {( y) D!     section in the Customize dialog.$ [3 f* G2 A, v2 I
!, y& h  c( a' [. M& c$ W

) L; v3 ^- ^1 u7 B9 p: [TITLE Toolbar (Alternate)* H- |: D& G# O# c6 W
VERSION 170
, J1 u: j7 M4 V( ]+ P  m' j2 w: d$ O6 ^
BUTTON CUSTOMER_BUTTON_11 r  j% g, u/ ~+ h. K8 V! u
LABEL Toolbar(Alt) Button1
5 _3 J+ _4 s* j& L/ nRIBBON_STYLE LARGE_IMAGE. P& J! D3 X' |4 ^4 y+ g

7 L) a% {" J% Q/ I4 I* V3 @BUTTON CUSTOMER_BUTTON_2+ _- k. M. X" P/ e. b
LABEL Toolbar(Alt) Button2
0 `  W: K# Y% f% M* {% i3 y# `RIBBON_STYLE LARGE_IMAGE
7 x' @% i* y) ]- D+ g! {2 g" V' x* r% N5 W  _% @( y
BUTTON CUSTOMER_BUTTON_3
3 E- P9 g7 a7 o# @, FLABEL Toolbar(Alt) Button3
6 B' N3 y" f5 h, u1 l. iRIBBON_STYLE SMALL_IMAGE_AND_TEXT
7 r4 D% @4 b' W% o1 V
# Z  w" ^4 L) uBUTTON CUSTOMER_BUTTON_4
3 J! G3 F" Z( U9 g( HLABEL Toolbar(Alt) Button4! O4 b. M/ ]+ q
RIBBON_STYLE SMALL_IMAGE_AND_TEXT
/ @( o  @4 v) h$ A# s1 E$ s4 r7 F  M% H% n# Y
BUTTON CUSTOMER_BUTTON_57 |2 O: v5 l) P6 Z$ l# y3 o
LABEL Toolbar(Alt) Button5* ]5 v6 N9 I+ j- x% m
RIBBON_STYLE SMALL_IMAGE_AND_TEXT
/ m/ Z! Y$ L9 [
: t/ m4 {7 @) {
: q2 A! p5 ^& p8 U$ K/ U( \/ j* E8 P) Y7 }
customer_group.grb
6 U$ @. r8 T7 r& k!
3 |3 M  w9 v5 w1 c3 y6 V% T5 m6 X!  Customer Ribbon Group File
1 k! h: u4 F  _% d( f!
$ g$ P! m+ @% S7 K: \7 l!  In Classic Toolbars mode - This group will be unavailable. z1 M+ U6 p3 q+ @9 d. ~
!
" K7 ?2 f7 c+ r! K. d8 H* ~7 A: e!  In Ribbon mode - This group will show up in the "All Groups" list4 `. H# E+ _; ]& m4 w' n! @6 j
!     in the Customize dialog.
. f, Y* `# Z/ k7 f!
, |5 d' o: @) r8 K( Z  T!  The labels of the buttons are defined using the RIBBON_LABEL token in the MEN files" @% Z3 ?6 |6 l
!
% v" A' v+ Z. X) l3 m& D' S% E+ E, U/ c3 N$ q$ h  Y
TITLE Group
1 @7 i) B" X) F8 G; l7 U, OVERSION 170; E( [' Y) f. f$ D5 k/ Q

" d0 ~4 d9 }/ J6 D  d' b!  No LABEL defined, using RIBBON_LABEL defined in customer_men.men4 {$ v+ b( ?- q! e+ N
BUTTON CUSTOMER_BUTTON_1
* o6 ~6 A; m1 c+ K+ ~1 {RIBBON_STYLE LARGE_IMAGE2 K4 z6 ?" j, B2 R3 G1 [$ n

2 k' ]5 d- ^9 W* Z( g' [!  Example of a gallery defined in a GRB file.! {% H% H3 u: F# L
!
1 {' Z( _* D& o7 [0 i6 A!  If this gallery is to be used in other places, then it could be
$ j* Y1 N. Z1 \, g. O9 a!  defined in its own gallery (GLY) file and referenced here
8 C+ \; O5 l: J( S9 j2 A( c7 c!  Example:
, {% H6 g6 e* W; x" |) M& c!    GALLERY customer_gallery.gly
$ Y' b/ D+ V" w5 r% i5 Y!
3 o, Y! T( s! s1 QBEGIN_GALLERY  CUSTOMER_GALLERY" Y$ }5 X; T5 R" J& [
COLUMN_IN_RIBBON 2+ _6 W9 H% f7 h/ D
COLUMN_IN_POPUP 2' l* J2 k$ X1 z3 S
LABEL Gallery
+ y- U  d  v) _GALLERY_STYLE MEDIUM_IMAGE_AND_TEXT
, A% R: ?5 q; l0 ]5 [5 |! f
. V4 H* {/ N+ l    BUTTON CUSTOMER_BUTTON_2
, t" k4 S0 {6 l9 H; y6 ~2 V  j* U5 ~* g- x- x8 f# p# x
    BUTTON CUSTOMER_BUTTON_3# Y7 \# Z% r) J# [

9 F' y, }& R+ r7 Y" z4 \    BUTTON CUSTOMER_BUTTON_4
- j! B. \4 L: l; o7 E, g' I: N( \2 ?4 A" h
    BUTTON CUSTOMER_BUTTON_58 ]1 T. }& @/ a6 v& u

4 x6 @6 A5 G; i, r# KEND_GALLERY
5 w. i- J! E/ F7 `5 d; d
+ N4 a0 W1 q5 F0 L  {% G! \2 L4 O3 `4 J0 _4 f# {- A9 u
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.doteam.tech
回复

使用道具 举报

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

本版积分规则

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