查看: 4962|回复: 0

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

[复制链接]

2480

主题

1280

回帖

8万

积分

管理员

PLM之家站长

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

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

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

×
关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧5 E9 }& X# E: }9 z" U# i' \9 X

经典界面到RIbbon界面转换

经典界面到RIbbon界面转换
4 H6 {" B/ L  E3 C# U' R' j
在经典界面下,需要的文件% _- `. P; b) l/ s5 ~/ L( Q1 N
  • customer_men.men
  • customer_toolbar.tbr
    # G* o, f5 `' h: t
在ribbon界面下你可能需要的文件
  B( ?3 ]. q6 w  u! L. Y
  • customer_men.men
  • customer_tab.rtb
  • customer_toolbar.tbr
  • customer_toolbar_alternate.tbr
  • customer_group.grb

    ) e/ ]' ]/ D3 ^" ^/ k2 F  M3 a

$ S  ]- B4 o$ s. O9 V9 o* r) e$ T/ d6 D- S7 C/ u2 G3 }
举例如下:. N0 ?4 k) x. v) M
! ]& l8 ^4 k( }* @3 _
# `- T: _3 ?  W4 L, j9 i7 [
customer_men.men0 |* S; e4 y) A' d( n% {
!
: D( f- E( @# W: b0 L!  Customer menu file
, C( w& s/ k- x% [% G+ o. T+ j!
5 P  @( P6 ?- e- O/ z!  Contains button definitions to be used in + H( {& n7 _; _
!  toolbars and Ribbon files
2 X, Y7 C' D2 {9 e!2 l& _- s% [2 q/ Q! f/ r1 B
6 o! c) |( a' |- E( k- o
VERSION 120
( S: e5 H$ f7 R( P& \0 u' i7 e% q. {: c$ p- W6 f0 d6 a" a
EDIT UG_GATEWAY_MAIN_MENUBAR' K3 \4 R8 b" s6 ~1 M
7 v. J" a- a! S- H/ E
TOP_MENU' L9 z9 R5 i+ u6 m5 |
    CASCADE_BUTTON CUSTOMER_MENU
* F2 Q) h. t* R4 V* V- B& ]    LABEL Customer Menu( A4 P  }  h, X

* C0 L4 K  C& z& C. Q; Y" |END_OF_TOP_MENU5 o" W3 ^. b6 f. C. E# L% e* E

* f  Q2 P9 G3 X8 R7 k7 a8 _  lMENU CUSTOMER_MENU
; `; l" w2 a2 ^7 P% O1 f0 ~4 q* N
9 ?2 Y" ]. U1 k: d' r! j7 g  y    BUTTON CUSTOMER_BUTTON_1
2 h6 U- m8 O1 u& p! x    LABEL Menu Button1
( v9 B5 {) U2 W. A4 t         RIBBON_LABEL Ribbon Button1
: M# O% j5 h$ J. q& m5 A        TOOLBAR_LABEL Toolbar Button1" n4 U% w+ o1 g
    BITMAP fileopen6 @2 D9 Q2 a0 g8 D/ H

& z8 F5 U# X  \& P9 c- n. [% W; g    BUTTON CUSTOMER_BUTTON_2
' k& }# P3 w1 }" \. G0 n6 T) J    LABEL Menu Button2
) _  O' w& Y, T/ _! h        RIBBON_LABEL Ribbon Button2+ f9 h4 \( t8 }$ R
        TOOLBAR_LABEL Toolbar Button2
- u( z9 A! l; U    BITMAP filesave# F" |! B! J& K+ p  [: |0 m$ _+ W

0 X' }0 p! j( U+ l* M    BUTTON CUSTOMER_BUTTON_3
) b+ d* @( b3 c* \    LABEL Menu Button3  U0 S; \$ B$ X# q, J* v+ ~  R3 [
        RIBBON_LABEL Ribbon Button3
; l* k$ [/ p/ L$ F4 `2 o8 C        TOOLBAR_LABEL Toolbar Button3& ?% P8 n, v' S: H0 c/ A
    BITMAP current_feature: j9 U  H' O3 J/ V- e0 m

  U  K. R' ^. i/ M+ b    BUTTON CUSTOMER_BUTTON_41 _9 C  J4 g+ f# ^9 p& _
    LABEL Menu Button4
! a3 O: j& @, m; L9 H& A        RIBBON_LABEL Ribbon Button48 m2 h4 C; e: X, M
        TOOLBAR_LABEL Toolbar Button4
$ R8 k4 r4 j  a0 \+ h8 V  |    BITMAP block' ]3 Z: Y( _6 l

+ [( }+ G  o1 o' }    BUTTON CUSTOMER_BUTTON_5, S' j7 B/ ~' c3 _4 Z) i
    LABEL Menu Button5
2 v9 a3 O7 u0 a0 ]" w        RIBBON_LABEL Ribbon Button5: E$ {7 M# a. L
        TOOLBAR_LABEL Toolbar Button5
4 U4 U$ `: |6 Y) I; H' l3 \; ~    BITMAP checkgreen! e3 f0 E3 }/ W
$ H* K9 o* e6 A/ O7 @1 S' [
END_OF_MENU
1 P+ H6 V! b$ [5 U6 z2 _1 ]" u
- @' J7 R' v7 U# G2 ?- p7 n9 E; \) ^9 B
. \( o* f$ L4 G) w" u" v
customer_ribbon_tab.rtb
. y% F$ L- a. Q# [!2 X2 b( @6 s4 q  z  k
!  Customer Ribbon Tab3 ~% L' t5 L8 F" d+ l1 F0 [: P4 S
! ( f8 K& s3 N; w7 ~! G8 a* Z
!  This file will create a new customer tab containing three groups and8 W6 w: D6 r! @6 W* @! ~) h$ L
!  one top level button." }' A# ?6 D7 {: `! C  J8 ~
!
' b2 H% y) [; o( \# Z& I( Y$ q  m$ H6 b: V
TITLE  Customer Tab  P/ A+ s- u, F
VERSION 170
0 c9 \% S! R/ X, |7 v* E8 E
! b$ G* T& b$ L4 j' O6 `!  The first group represents a Ribbon group that references an existing ) \1 h1 R4 J% v9 J* H) U, Z  d: g" A  [4 H
!  toolbar with no Ribbon style changes.  
8 k6 e) m: `5 `, @- J8 B+ e!
* }! ~- H! Q' `$ n4 U!  This is the quickest way to add existing toolbar content into Ribbon mode.$ q0 F. j" Q8 }1 S
!) s: X6 U3 r9 P1 A  \6 I- a* t0 Q
GROUP  customer_toolbar.tbr5 n7 l4 x6 O5 e2 C2 r3 C6 }$ n

! s5 D& J( M8 |6 q; z4 j+ |!  The second group represents a Ribbon group that references an existing : z. |9 m# D. t7 w8 j
!  toolbar with Ribbon specific style changes added to it.  There is no difference
" t. y1 R7 a3 r) g3 a5 n!  in how this toolbar is referenced in the .rtb file compared to the first
$ \( t1 L1 x* a!  toolbar as a group.  The only differences from the first group exist within ( z9 F" P# z5 F" p. w4 V. B/ v8 Z
!  the .tbr file itself.
% z, x' m% R$ o0 ~( j  s5 e!
7 j- \8 ?8 q$ {% r) J  C!  This approach has advantages for customers that will deploy both Ribbon and- `- F# e  u# K: t
!  Classic Mode customizations since all the content is defined in the .tbr
- V, @. a& _& m3 C/ `1 P!  file and it will stay synchronized in both modes.  Only one set of customizations
" f. n7 D; p" @1 U0 z!  will need to be maintained while still making use of RIBBON_STYLE to
/ I+ C& k8 Q- a( x( @! ]* Y  P2 G!  control the presentation of the buttons on the Ribbon.
! w8 h' s7 c% t( A7 W* s!6 W* S3 b) |. _: \  Q; N/ w
GROUP  customer_toolbar_alternate.tbr
4 |7 Z) Q' M  }7 Z2 u- D( t5 k- i: v% c: t. Z- Q# S8 A6 T
!  The third group represents a Ribbon group that has been created explicitly
, c% v5 N; r; ]  e* o$ f5 R- w( m/ C!  as a Ribbon group and will not exist in Classic Toolbar mode.  This is the
: N( ^6 A' e! S4 t' g( H!  preferred option since the user will be able to take advantage of all the ! `& t, g0 w* v4 i. F! h
!  layout styles and containers offered by the Ribbon.  2 J7 W) `! Y+ F  Q7 A
!
) m! [6 O- u9 {+ N!  For customers that will deploy both Ribbon and Classic Mode customizations,
, h3 g6 s2 p* t6 b: L9 Y, |!  this approach will result in no synchronization and two sets of customizations
6 v/ G1 m9 a/ \. o" G% O& d7 n!  will need to be maintained.
; K& o, s- L8 m0 o$ O) q!2 ~3 w. x  ?/ S$ r' o' q
!  A group can alternatively be defined directly inside the .rtb file by using the- |0 J+ L' u% T) U& g; H
!  keywords BEGIN_GROUP and END_GROUP.  8 g6 y8 C- z* {/ |" ]% O
!7 t2 g1 X+ G$ C& z
GROUP  customer_group.grb
: ?3 N2 l! }. o4 E1 m+ g) J/ T* v7 x  T
6 x4 I6 \# n/ ?; n0 b- D!  Example of a button that is placed directly on the Ribbon without being
5 Y6 G3 ]4 n, l, s: b1 w. j7 `2 ]3 ~!  contained in a group.  This is a simple way to add a button to a tab4 i& h4 c" ?4 q) Y
!  but is not recommended for many buttons since groups have advantages.$ P( I# ~# [  A6 W4 e8 Q6 Q
!  ' S* I' t- D5 t" ^0 H, j. w
!  A few advantages of groups:1 G2 C3 y% N* x$ g, Y
!     1. Easier to move many buttons around together in quick customization.  
3 ?- L: r8 U( X7 \/ F6 r. H6 L7 L* C!        For example, MB3 on a group and choose "Add to Left Border Bar".  ( V8 d: a7 N( K# }" b" u# u
!        This will move the whole group to a new location.  If buttons are ) Y8 b  `7 c9 d3 V" ~
!        not in a group, they need to be moved one at a time.
% }! @3 e/ }6 \% a0 w& P!/ k* C% B& z6 X: A
!     2. Provide a label to describe its contents.
5 T+ z7 A, h# u4 N. {) S9 j!
5 _7 H* _3 e0 a: S- v& ~) sBUTTON CUSTOMER_BUTTON_1& g* M6 @- r* `. `' r0 ?
LABEL Button1 Directly on Tab2 x3 r; \1 O9 E$ {

# D3 W& |) ]! T7 k: z; k' i6 H) S/ ^- e" ]' I$ r' f; {

$ D4 h# z1 v( L+ U+ C1 Dcustomer_toolbar.tbr
- q5 O9 ^/ q/ ], e+ z!7 F+ c6 T( Z+ x8 m! I: h
!  Customer Toolbar File
8 R, H* [$ v' L8 i: L, V!; X: E) r, f* o
!  This is similar to an existing toolbar file containing0 H& u# }, C. ~2 ?) A
!  no Ribbon changes.. L$ a. N3 y; H* O& T  D' h
!- s5 S' \) e- B) Z/ Y5 V
!  In Classic Toolbars mode - This toolbar will still show up in the " a% o2 Q/ l: g' n
!     toolbars list.
$ y6 @" J' ~" D" G% h/ M1 @0 z1 ?!
; Q. E! E! `6 m- O. i!  In Ribbon mode - This toolbar will be automatically converted to a
! c  v5 J+ S* u1 K, \! p!     Ribbon group and will appear in the "Classic Toolbars as Groups"+ `0 D) {9 l/ I7 U, T1 R# }: G
!     section in the Customize dialog.* Y' [0 w" j4 v
!  3 I) z: W/ z: C; B; x! Y. D
( l" o4 f" t7 [; O
TITLE Toolbar
0 v2 w: Y- x5 g3 m' U& IVERSION 170
7 P2 X% Y. F. @* `, S
* K* h+ T$ T' N7 {/ c. _  x8 lBUTTON CUSTOMER_BUTTON_1- c+ I8 B5 N/ I4 j7 }# R; D

4 y; P- p9 h& C$ p8 q% ~$ m5 w( RBUTTON CUSTOMER_BUTTON_2
; v9 B0 T2 j! j7 d$ Z2 P% x' A) S; Q7 l
" B8 @; G9 {, B% pBUTTON CUSTOMER_BUTTON_3
$ L* {; U' c$ K
4 r/ v) Y6 t/ q! i1 ^BUTTON CUSTOMER_BUTTON_47 S8 p% h+ u2 x" |! O& w* q0 n
) P( U; |8 z  Z' I: y! O6 ^
BUTTON CUSTOMER_BUTTON_5$ \, K  J- Y) J! U, i) t3 g6 V
$ W# z4 n- l7 y/ }9 B& n

9 ~. z/ x1 ~: M, \
: B$ n( Q6 K" }customer_toolbar_alternate.tbr+ v9 ^: e3 R$ ~
!
, Z2 A+ B% P% I* `4 Y$ [" Q!  Customer Toolbar File (Alternate)
  y( Y' }. ]! k!* a+ g2 D! C1 }; c' w/ p
!  This is similar to an existing toolbar file with new
! i8 R" Y2 L6 ?1 d" M!  Ribbon styles added.
  K  W3 C$ `2 O) V, t' P3 _0 O!  2 F# m2 a; I' y6 [- U
!  The RIBBON_STYLE will be honored when the toolbar is loaded 7 e: z/ H+ X2 o8 _* a5 e. e
!  in Ribbon mode as a group but will be ignored when the toolbar / l9 [1 @0 `% `0 F( B. ^
!  is displayed in Classic Toolbars mode.
6 u- B8 V2 O( |" i' K" b6 b/ U!6 q! ~/ L% n( [" S8 M) W6 b
!  In Classic Toolbars mode - This toolbar will still show up in the
" m5 ^9 P! \, }9 {4 F: k!     toolbars list.
: B( k( H3 g* ^# }, [' m5 I!) _" |% `% ^4 m" i# X
!  In Ribbon mode - This toolbar will be automatically converted to a
( j& A  j, X* t& e+ h) |% I!     Ribbon group and will appear in the "Classic Toolbars as Groups"5 w$ `( ]+ n. k# r1 j
!     section in the Customize dialog./ I1 w+ U: j6 P* y4 p' d* p
!
6 q! h0 J5 C' V! i; q
/ u. K% I  w/ M/ B) I7 b& B9 kTITLE Toolbar (Alternate)( m# I$ S, N+ G6 h4 _/ h) ^1 P
VERSION 170
7 X* M9 g0 q# q; e, s* c  [; C' E6 q9 y- |7 x/ M
BUTTON CUSTOMER_BUTTON_1
2 ^& C% V6 A9 g9 sLABEL Toolbar(Alt) Button1. i/ ~5 o3 S! m5 l  k
RIBBON_STYLE LARGE_IMAGE+ D1 e$ Z$ v, l4 J5 B; G. F

! a. H3 O7 Q- H9 }BUTTON CUSTOMER_BUTTON_2
4 F- X3 z/ a0 D( w( E# r+ d( i* b9 cLABEL Toolbar(Alt) Button2
2 L5 F' }7 p* \RIBBON_STYLE LARGE_IMAGE
8 j/ ~1 d2 W3 |5 z- [, T7 D5 O/ E( @# n3 F
BUTTON CUSTOMER_BUTTON_3) y7 f" L) K) G3 k1 f/ V
LABEL Toolbar(Alt) Button3) |' F& w, O: J: I. d
RIBBON_STYLE SMALL_IMAGE_AND_TEXT- S" z2 B$ n" O0 H1 F/ u
' D1 P8 N) s6 X
BUTTON CUSTOMER_BUTTON_4
0 r5 w& h5 V% LLABEL Toolbar(Alt) Button4' a: x4 H$ ^, ^4 p5 |( D/ a! Q
RIBBON_STYLE SMALL_IMAGE_AND_TEXT
: C* A: x  N% \& @  B* ?2 I
( O% V" f1 s( u$ c' ^BUTTON CUSTOMER_BUTTON_5
: {$ x, Z: T, l# Q  m3 B+ cLABEL Toolbar(Alt) Button5; n* f7 P* p( W; \% b5 R
RIBBON_STYLE SMALL_IMAGE_AND_TEXT
( }& i8 {$ M: i; @' v" t; y9 Q
9 L0 K4 r' m1 B4 U/ T# _( R) j1 s/ e; ~  ?

& i! ?: @6 U! j3 P2 _customer_group.grb
( s3 C& y9 H# `3 F9 z! S!
) z& l. U$ ]& t) c' `8 P. s!  Customer Ribbon Group File2 k0 F2 v9 u2 k( z
!
/ n7 P+ ^+ y: j* U: @) k!  In Classic Toolbars mode - This group will be unavailable  j5 L7 n3 u' @5 U( B. w
!# f0 M: |& O. {6 V$ [, ]; D
!  In Ribbon mode - This group will show up in the "All Groups" list& G+ S4 {+ {" i
!     in the Customize dialog.& t( _9 _7 T  [0 ^
!- E& W6 F$ Q# j* Z6 u$ X/ d
!  The labels of the buttons are defined using the RIBBON_LABEL token in the MEN files
0 V& d& Y/ o8 i!, `4 L- E/ W$ N( d$ K( E

  v) X5 m; m. t* ZTITLE Group
, {1 d2 h" `* LVERSION 170
# y' A6 X" j& {' l( j' ~0 P# Y: S' n* y' s3 ?
!  No LABEL defined, using RIBBON_LABEL defined in customer_men.men
' M% r5 C5 G4 L5 A- `) [/ ZBUTTON CUSTOMER_BUTTON_1: l$ {" ^3 g( w: U' i
RIBBON_STYLE LARGE_IMAGE
0 z3 u- X# C0 @" X% ]" C8 I8 A7 D
!  Example of a gallery defined in a GRB file.5 T6 f0 x1 s# w! i
!
9 V2 H- E' W( A, p2 E!  If this gallery is to be used in other places, then it could be 1 t& ?! {! z6 |( ~, g& R
!  defined in its own gallery (GLY) file and referenced here
8 _" Y3 d) l5 K3 ^8 G. B!  Example:- I' \( @  n, ^$ Z+ {$ K# q
!    GALLERY customer_gallery.gly
: W! e6 h- `( ?, F$ R$ N!
4 q& L% |: b. OBEGIN_GALLERY  CUSTOMER_GALLERY
# {  w5 |! g- cCOLUMN_IN_RIBBON 2
- Q6 \4 K, M- f. y$ P0 u# jCOLUMN_IN_POPUP 2
' b, x( W6 a; {( eLABEL Gallery
1 Y( x1 e" p; n: i+ }8 vGALLERY_STYLE MEDIUM_IMAGE_AND_TEXT3 }2 t' G6 M7 W( F- O
" B2 [; l. s! ^4 s# i) h2 v
    BUTTON CUSTOMER_BUTTON_27 K- a8 V1 ]( E% r2 F1 g5 Y
, E; s5 w* U4 _! K
    BUTTON CUSTOMER_BUTTON_3# t$ P- K) N( I& L" z

* j5 A$ }, I3 r( G, F    BUTTON CUSTOMER_BUTTON_4  |: }. K2 E% K% k

2 t8 @. Q6 }2 k& i  }( p    BUTTON CUSTOMER_BUTTON_50 ^5 [2 T1 t! M- t+ ^

1 Y% R" W# |7 J; V3 E+ bEND_GALLERY4 `$ p$ O9 ]' V7 f6 @! m$ l" [9 D
3 t& S% Y2 D3 h$ w, Q
4 y1 E8 S! Z9 Y( A( }  Z& t
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

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

本版积分规则

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