PLM之家PLMHome-工业软件践行者

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

[复制链接]

2015-1-9 10:37:48 4481 0

admin 发表于 2015-1-9 10:37:48 |阅读模式

admin 楼主

2015-1-9 10:37:48

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

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

x
关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧
% h" s* R! y6 p  S4 r8 U

经典界面到RIbbon界面转换

经典界面到RIbbon界面转换
- H& `# X; V. Y' E$ O* v
在经典界面下,需要的文件; j! x0 H% i' S  j
  • customer_men.men
  • customer_toolbar.tbr& X3 D- z) v& e/ l# s" M
在ribbon界面下你可能需要的文件 # @  d4 I( A- {) Y! d: [8 ]
  • customer_men.men
  • customer_tab.rtb
  • customer_toolbar.tbr
  • customer_toolbar_alternate.tbr
  • customer_group.grb

    " O  q$ m/ b- u: Z

9 n/ z- Q; Y9 j% t7 j
" v6 e0 ^& S3 C4 g' d  j- E6 F+ J举例如下:
( j0 M, I7 C  ?6 s3 |6 X7 q" `8 C8 [  k; X
8 X/ u7 m! P7 [4 l1 g
customer_men.men6 o' }$ _: h. w! g- K: S5 m2 b# p. x
!( @0 }0 R4 p! n/ j
!  Customer menu file  V2 w3 x: f  T/ a; C
! , u2 K2 t. n5 k- H1 |
!  Contains button definitions to be used in
1 W2 V/ p- D* T!  toolbars and Ribbon files
. V% [+ \9 l" B- _6 a" ^!
$ H* H& K9 Q, V* b9 A  Y, j9 i
+ S; U8 n) |2 ~- U' r) u3 RVERSION 120
3 l3 }1 H, m5 r% e$ g+ }
1 `- I: C6 l/ a1 _EDIT UG_GATEWAY_MAIN_MENUBAR
9 ]* T# o2 d; `7 {
8 e6 f5 n" |: `: M3 Q9 C) Y8 PTOP_MENU! N$ R* D: R/ M& `' L5 f+ F% H! h
    CASCADE_BUTTON CUSTOMER_MENU
5 M. ~! r4 J( S6 \# I. N    LABEL Customer Menu
  n  C( y0 q  Y: m; o
: G; B( t" y2 i/ M: W2 IEND_OF_TOP_MENU
& V# C" `* n0 T, {( U- ~* g$ G+ \
2 a. P7 |) t6 s3 H/ `8 l+ iMENU CUSTOMER_MENU/ K( Q$ Y5 b& _+ Y2 i2 f
' r3 [" E0 T+ O
    BUTTON CUSTOMER_BUTTON_1- m1 j% y% f; i- A" E* M, U) y
    LABEL Menu Button1
" l- _4 J7 k' y         RIBBON_LABEL Ribbon Button1" n7 @( P, F: t5 ^  Y: \9 }7 u1 L/ g/ c7 d
        TOOLBAR_LABEL Toolbar Button1( a/ x* Z6 a/ m$ b7 Q4 C; S
    BITMAP fileopen
( Z9 f  m+ s$ D2 }" P7 c) @8 m4 e2 D# k( P/ P# ^: F0 l5 ?: g
    BUTTON CUSTOMER_BUTTON_2
, i! W# Z. Y4 f8 W+ F9 J    LABEL Menu Button2
9 c1 r* I3 V" E9 b        RIBBON_LABEL Ribbon Button2
% ~9 g, L8 e3 G. o* L        TOOLBAR_LABEL Toolbar Button2
+ g) m  b6 k' o7 c    BITMAP filesave
4 L0 _) {' S3 l1 N* h6 F1 c( t( @8 O3 n$ W/ {2 J) E. M, r) {8 Z
    BUTTON CUSTOMER_BUTTON_3
- M; L0 {8 c2 C. ^2 j& |* i/ p* [    LABEL Menu Button3
+ g& p3 m3 Z. w1 B0 x& O5 i        RIBBON_LABEL Ribbon Button3
' m5 G/ c8 b. h' C  B5 b+ \9 {2 `5 G        TOOLBAR_LABEL Toolbar Button3
* i# p0 s' O# W* _! v    BITMAP current_feature
7 x: r2 `! n* ], F4 r; D7 M2 [  M. L/ [7 x3 }9 I1 Q  x
    BUTTON CUSTOMER_BUTTON_4
" I# B2 p/ O' g, j6 `! B! M    LABEL Menu Button4) ?6 [6 ^% o, g5 C2 d  M" L+ [: y
        RIBBON_LABEL Ribbon Button4, Z8 h+ J4 X' G- U& ~* m
        TOOLBAR_LABEL Toolbar Button4
) a( s6 w7 O: a& `& E! K    BITMAP block
! E/ P. N0 @( k& v$ f+ V2 x: T/ E0 N" D; D7 F7 E
    BUTTON CUSTOMER_BUTTON_58 u' q. I* O/ X' d2 e) F" D5 \
    LABEL Menu Button5
5 ~6 R6 }/ c& l# _# n        RIBBON_LABEL Ribbon Button59 I4 `! d) d6 R' i
        TOOLBAR_LABEL Toolbar Button5
1 H8 t; t, o2 m8 V    BITMAP checkgreen
3 h+ v: O( Z5 J) }. |& i7 t, U) L9 D9 Q+ |. ~
END_OF_MENU
0 K' H. N- {+ A% Q8 l
# R3 i( J: @6 o1 z( d9 r( G, ^! a9 Q1 b# p

3 V1 V7 T# `, S0 q2 B8 ^  n8 Lcustomer_ribbon_tab.rtb# o: J9 i5 r* P  z( Y" v
!. P/ P; H9 N& f2 I. z/ @
!  Customer Ribbon Tab
$ T7 i  [/ }! D9 m- z$ d, `!
+ u- E& {! U* [4 |$ g. O!  This file will create a new customer tab containing three groups and; t" ?8 W! \6 I
!  one top level button.6 J, v, n* L+ G0 t% V% {
!/ _( ]: h/ N7 i9 J8 i' `
: N) V& ]  K6 s. s$ F; r
TITLE  Customer Tab
9 ?6 `" f4 J& H  H, ZVERSION 1705 ^! `5 `1 i7 |& ~$ N( K  y

1 G/ |9 b3 K9 A4 W- C+ m3 N5 C+ K!  The first group represents a Ribbon group that references an existing
0 J: b9 M( A4 B, M; ]$ {!  toolbar with no Ribbon style changes.  # w8 N" W# t! |/ p8 ?/ c- q; C  X
! ( H! T. [) n7 ]$ y# n
!  This is the quickest way to add existing toolbar content into Ribbon mode.( o3 e% w) T/ X" r+ M
!! N; D5 f3 b& t2 {
GROUP  customer_toolbar.tbr, \* c. s1 F8 ?- j- x) b

* r8 r1 i1 Y7 O  Q. l!  The second group represents a Ribbon group that references an existing
: h1 g9 A4 W/ l; e!  toolbar with Ribbon specific style changes added to it.  There is no difference5 W7 K9 Q; {5 ^0 X1 |, }0 J4 ^
!  in how this toolbar is referenced in the .rtb file compared to the first
, K7 z1 V0 Y3 @$ `8 ^3 d!  toolbar as a group.  The only differences from the first group exist within
3 L6 a  b' k' z2 c  D!  the .tbr file itself.0 x  v5 h" r3 S! _0 G3 o+ p& M
!2 o4 ?7 B4 E% Y+ p
!  This approach has advantages for customers that will deploy both Ribbon and
5 @0 X, b  r5 [! f!  Classic Mode customizations since all the content is defined in the .tbr
* H) d2 Q/ a' X* X2 X0 o!  file and it will stay synchronized in both modes.  Only one set of customizations
. |8 t+ @- }1 g0 d1 n1 d: |!  will need to be maintained while still making use of RIBBON_STYLE to
# M. h' L7 l& C9 t5 i( g7 N!  control the presentation of the buttons on the Ribbon.
2 }$ L! _+ Y3 P; a% m/ m/ w( V: P!
7 f/ b, r! t, E+ O3 Z( |GROUP  customer_toolbar_alternate.tbr/ v0 e7 M$ W, U7 c( W9 U, A

5 d, I0 B* R& Z2 h, ?6 u1 i( \+ C!  The third group represents a Ribbon group that has been created explicitly& G, i! y: w% c
!  as a Ribbon group and will not exist in Classic Toolbar mode.  This is the. r5 [3 ~, g! {" G; u2 m; B6 n# |0 Q5 @
!  preferred option since the user will be able to take advantage of all the , m( [" X/ ]. V* r
!  layout styles and containers offered by the Ribbon.  3 l2 }- `* I: U9 q4 |3 `7 b
!
) b1 G9 L' t# s- `, Q+ ~, F& b!  For customers that will deploy both Ribbon and Classic Mode customizations,
! @0 v: q6 r2 [! J8 q!  this approach will result in no synchronization and two sets of customizations   c& A) I3 x( h
!  will need to be maintained.% u7 t! `  Y! L4 G6 O
!
) A0 J) M- S: c$ f$ R!  A group can alternatively be defined directly inside the .rtb file by using the3 k! L0 a3 A0 T) }" ~4 l
!  keywords BEGIN_GROUP and END_GROUP.  / W& \# G7 w( |6 {
!
# t  {+ D7 Y2 HGROUP  customer_group.grb+ Q5 K  y8 N  X7 x6 _

: T& _+ m8 F. t!  Example of a button that is placed directly on the Ribbon without being! ^* ?# P$ N. C" w
!  contained in a group.  This is a simple way to add a button to a tab
9 X* W8 z7 {# ]( f# z6 G+ w9 |!  but is not recommended for many buttons since groups have advantages.
6 |- g  y6 G+ r. b( L/ J' M!  
0 u+ ~1 x$ Z9 l' a* u5 m( R6 A!  A few advantages of groups:
/ f/ e7 L% S: r: C6 \* V' \, g; P8 f!     1. Easier to move many buttons around together in quick customization.  7 q: n2 y; E2 E2 L; t% D9 C
!        For example, MB3 on a group and choose "Add to Left Border Bar".  9 j# p2 E0 j7 V1 U; A3 {
!        This will move the whole group to a new location.  If buttons are ; p3 D" t: A5 z# |3 R
!        not in a group, they need to be moved one at a time.
# I8 v( G$ h5 s!
' h) @! A7 e7 I( l* g!     2. Provide a label to describe its contents.
! K, ~+ ?6 S3 e5 J, V( H8 ]4 m' Z!/ Q+ J. f, ?1 Z! r- I, D
BUTTON CUSTOMER_BUTTON_1
- W5 Z/ T% b4 b1 F. R: x1 CLABEL Button1 Directly on Tab9 Y) @. |% W1 `- C( n4 D
/ u. @  p& i  O! D
2 y+ Y+ o$ {4 o$ ~: e! s1 t% f- N
! ?2 I% i) a3 I+ z  V* s) S; ]- K
customer_toolbar.tbr5 c+ O+ v5 Y7 v' A3 S* A+ {" Z
!& l4 N8 j5 e2 V& |+ F5 |1 D
!  Customer Toolbar File
) b( c4 g9 z# U!* }* W+ }$ F2 d8 u+ F, W
!  This is similar to an existing toolbar file containing6 V8 q$ ^5 C/ F# }
!  no Ribbon changes.4 D9 ^( c; i6 x  {
!1 V: s2 q9 k1 C/ H4 t
!  In Classic Toolbars mode - This toolbar will still show up in the * E) E0 ?: W) V1 }8 R( z+ M
!     toolbars list.+ M1 l$ s* R5 Q+ a3 O
!# F( G* h3 t: _3 _- B
!  In Ribbon mode - This toolbar will be automatically converted to a
- j1 r( q, M6 V3 X!     Ribbon group and will appear in the "Classic Toolbars as Groups"
5 r$ m4 l% h6 R% r7 ~!     section in the Customize dialog.
2 ^6 Y* J/ H  ]3 t* t  s!  : m, [5 }, }! R
  \  _: T- v/ L% B7 [5 ^, R+ }' H
TITLE Toolbar" y7 h# f& Z$ f# n8 _/ [
VERSION 170# p- ^& E3 r; m( U4 w
+ {8 ?- Y; m$ M5 w& T( Z% ]
BUTTON CUSTOMER_BUTTON_1
# h; u) W  f5 s/ n: l' A5 h. u# V. [8 v
BUTTON CUSTOMER_BUTTON_2" B( b) F7 L4 W) d" p

2 `- i8 K! Q+ F. H! ]% F- L9 a, HBUTTON CUSTOMER_BUTTON_3; S- p( O2 ]6 w: K- x$ B7 ?5 l% ?8 O4 Y
" y* W% v# \# S, X, F
BUTTON CUSTOMER_BUTTON_4) K/ p  j( ~, R6 ^% y
) K& `6 i  ^5 P( c5 a- a
BUTTON CUSTOMER_BUTTON_5
& n6 }: l. z8 p. B; P1 h6 J* R/ z, }( P' }1 l

5 W4 j8 H4 J( v8 d) `
# f- o$ E8 w0 T0 g( [$ l0 Q6 M  Xcustomer_toolbar_alternate.tbr* o1 ?5 z; E! f
!$ M$ V1 J, i# |8 F7 p/ }' j* K
!  Customer Toolbar File (Alternate)6 `! r+ Z, I3 J
!
) T' R0 e! s) e!  This is similar to an existing toolbar file with new5 E. {' \& c+ n: w2 t% ~
!  Ribbon styles added.+ Z+ l' F* r* ]8 V4 C: \, T1 B$ e
!  9 l. c2 n1 b- m; f
!  The RIBBON_STYLE will be honored when the toolbar is loaded 9 m; o( w4 x8 l; _/ u
!  in Ribbon mode as a group but will be ignored when the toolbar
/ n  O/ S$ R: d- u!  is displayed in Classic Toolbars mode.1 L9 i9 E! E! @) }6 \; ?. `
!
  K- D$ S! ^+ z0 k1 m3 G+ h!  In Classic Toolbars mode - This toolbar will still show up in the
& v6 }0 y6 [( J  i!     toolbars list.
& K/ E& K0 J$ t; X# ~& }- M!
6 `2 }, z1 t) S) G0 }% E; s!  In Ribbon mode - This toolbar will be automatically converted to a
  C( q  d8 p% G!     Ribbon group and will appear in the "Classic Toolbars as Groups"& }0 u. i" B- z9 n! M
!     section in the Customize dialog.
6 q& o; _' h: v3 R. ^!
  X% Y: H$ Y6 P. K' G: p5 N, @
) U" c# m) ^+ o: g8 n- e& X' {+ \TITLE Toolbar (Alternate)
% [* _0 V4 }( i6 M/ v* Y' b/ [VERSION 170) p$ g6 y- e. T

0 b) x" @! |& x7 q4 p2 u5 \3 z/ ^BUTTON CUSTOMER_BUTTON_1
1 x( |1 n+ _' A  i' w0 m; p  HLABEL Toolbar(Alt) Button1: I, o$ E. P  f
RIBBON_STYLE LARGE_IMAGE
( W: \0 ?0 T; H( f/ `7 ^! ?0 n- e% _& w- V
BUTTON CUSTOMER_BUTTON_2
/ Z9 Q9 p: x* v. g7 P8 KLABEL Toolbar(Alt) Button2
7 P+ P- o8 v3 W2 ^! M# B: U0 t; L2 GRIBBON_STYLE LARGE_IMAGE1 }' _! A! k' B

2 ]1 ]* i+ G9 Z/ M, \. h& uBUTTON CUSTOMER_BUTTON_3
1 h2 i- d9 N  b5 p: G: zLABEL Toolbar(Alt) Button3, {# |- E( \7 j  G" ?! N2 ?; ?
RIBBON_STYLE SMALL_IMAGE_AND_TEXT( w. a# U7 [1 A5 I$ B' t
2 j* E2 e8 x. k) {8 T, a$ l
BUTTON CUSTOMER_BUTTON_41 t' i$ y' s# a* L! ]. i9 B) M' q! c
LABEL Toolbar(Alt) Button4( W9 j8 d+ H! w/ K( @3 ?
RIBBON_STYLE SMALL_IMAGE_AND_TEXT
, T8 \) \1 z0 y9 {4 p, P6 r, l8 r/ T0 u- ^; p! ?5 W
BUTTON CUSTOMER_BUTTON_52 T: r7 u' c. w1 b4 x" |3 f
LABEL Toolbar(Alt) Button5: {* t2 a6 G: t$ y. R1 u
RIBBON_STYLE SMALL_IMAGE_AND_TEXT3 K- `0 |4 [1 d7 R

' z; ?" s- @# _: F- T3 U. _
( x3 U+ `( n0 X8 |# p0 r0 _
' u* s+ l2 V, Z7 |9 G; Z) Xcustomer_group.grb
$ r  A' z9 s0 x7 C7 ^$ [!1 j. A( S; Z$ S4 o, q! i. }9 y
!  Customer Ribbon Group File" e4 C) y, ]  b( w
!3 `! a* Q* J# U5 N# Y9 z; Z- d
!  In Classic Toolbars mode - This group will be unavailable
  C$ F7 v8 A2 T. Z: R3 `6 u+ L!
( O# z" G" ~, G7 x8 G4 w3 L!  In Ribbon mode - This group will show up in the "All Groups" list
) Y" Y/ G( a+ H; M' x$ q!     in the Customize dialog.$ ?' o! A8 W2 y! p) v
!
# S1 V. e; S+ Q; S5 t4 U0 A% G!  The labels of the buttons are defined using the RIBBON_LABEL token in the MEN files
. f! E8 C: K" e" O!# Y" w+ N. F" }- N
: I7 K+ ~& N. G! R
TITLE Group1 O$ C, ]5 N) @" g0 }4 `4 Q3 \! K
VERSION 170# ^$ Y4 C2 }/ W( `' t: r9 Q8 q# X
9 P# L: S1 q' d5 x) U' m# b# H  }
!  No LABEL defined, using RIBBON_LABEL defined in customer_men.men" }$ [* B7 g7 Z- h/ A
BUTTON CUSTOMER_BUTTON_1* p/ ^3 q" x: }' q- L
RIBBON_STYLE LARGE_IMAGE
1 o) a0 j5 N4 M6 R: I+ p5 c( \( T! L" E  t
!  Example of a gallery defined in a GRB file./ M* A# W" u$ q6 ~! _, b5 ~: I
!
5 M7 H& B$ P, V+ d3 a2 q% s!  If this gallery is to be used in other places, then it could be
: V7 K# o4 A! c! Y  f!  defined in its own gallery (GLY) file and referenced here$ w3 i& y: J( F1 v+ x
!  Example:' T8 B& D( ]" A. I$ p
!    GALLERY customer_gallery.gly
. t+ B! x( ~; {0 D!0 t  ?( ^! K: u4 t* i7 J
BEGIN_GALLERY  CUSTOMER_GALLERY$ j# s0 a/ k3 Q# }; ^/ b& e
COLUMN_IN_RIBBON 2
* \* _5 J' ^3 ]COLUMN_IN_POPUP 21 ]+ g+ m/ U/ R/ E" m- Y3 ]7 U
LABEL Gallery
& L" l( d+ }1 Q+ R* hGALLERY_STYLE MEDIUM_IMAGE_AND_TEXT5 Y+ f& Z. X" q* l8 _4 V2 X
' }5 I# v6 @* w/ d# n* j; Z
    BUTTON CUSTOMER_BUTTON_2! p( r0 O! _- Q' E+ P! X6 H
1 c; h, t9 N1 O6 T. N  U; k- R
    BUTTON CUSTOMER_BUTTON_3
2 w  M8 D; ?8 R& l4 P1 W  ]3 \- G3 ?# b& l
    BUTTON CUSTOMER_BUTTON_4
& c, o# n( S% I) V$ L) p0 o
- Z) S5 [% h, b! e" ~- P. J1 t    BUTTON CUSTOMER_BUTTON_5
6 l- L; h: y5 O" K7 O+ y8 E' e( y. W  U3 W& k
END_GALLERY$ g( ^2 R# r: M& M/ a8 a2 J

8 w  l& p6 Q# C* x  e* ^" E/ A4 H) I2 v7 s* G) K
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

发表回复

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

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了