查看: 4882|回复: 0

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

[复制链接]

2477

主题

1280

回帖

8万

积分

管理员

PLM之家站长

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

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

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

×
关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧" }0 ]+ a. B3 U  P9 N% D0 ?

经典界面到RIbbon界面转换

经典界面到RIbbon界面转换

9 o& `& M# _! @( t+ J9 u在经典界面下,需要的文件
) L* E4 ^% w7 \. {* K
  • customer_men.men
  • customer_toolbar.tbr
    2 y; |( {5 \9 T. q& r
在ribbon界面下你可能需要的文件 ' v, z7 X$ R# Z& x! z
  • customer_men.men
  • customer_tab.rtb
  • customer_toolbar.tbr
  • customer_toolbar_alternate.tbr
  • customer_group.grb

    1 j; _6 ]+ a0 [: h( b
( |7 u. s% e, i

- T" g4 p7 r  ]+ H, H8 B$ \7 m) b举例如下:! ?/ k9 \9 i! M* R4 \
1 J) S2 O* N/ v2 ]1 n

5 ]! @/ B& ]% R' y8 |& lcustomer_men.men, C' L- z  i  x; |5 M
!
  \( j# w* p* K2 l1 T% Y, O: A* F7 V!  Customer menu file
9 {) b2 ?- H8 y% c7 F# n!
( o/ q5 @1 Y2 h9 Q; {8 d!  Contains button definitions to be used in * ~9 q' B( \, v* @$ e
!  toolbars and Ribbon files
1 u: l: s; T: \3 x! T  X!
9 z0 n0 s$ t% K7 {* [* z/ O/ p7 b! e3 }1 c; I- {
VERSION 120' P8 i. Y. C6 c  {8 v  K% s) m6 p) ^

/ f! t2 b# C3 NEDIT UG_GATEWAY_MAIN_MENUBAR
- F; y: t' ]% v! i# Q2 x, a8 q
4 k+ }1 y. n. b$ W! @/ U2 ~; M1 KTOP_MENU
0 U; y7 \) i- Y  L3 E5 v) J$ A" n    CASCADE_BUTTON CUSTOMER_MENU; r& L. U9 G/ d  I& Y
    LABEL Customer Menu5 W) I; [$ ?( Z+ F9 R
  {3 y# K1 ~' M2 h; F6 Y
END_OF_TOP_MENU( a/ q9 ^, e+ n7 V

) I2 c0 C) H( D% Z  UMENU CUSTOMER_MENU' A+ T7 K$ \/ R! \3 ]

3 G9 _9 {8 O1 Z2 ^4 m! {    BUTTON CUSTOMER_BUTTON_1" j4 c1 J7 H" E' t2 Y: y
    LABEL Menu Button1! c$ e. I! w' j; b* J% M  r- |5 u
        RIBBON_LABEL Ribbon Button1- U; {/ p! t$ a8 V8 n
        TOOLBAR_LABEL Toolbar Button1
+ [6 c, o/ r) K$ {( W$ F. d. J    BITMAP fileopen
% n) A1 j; ^5 i, _/ O7 v
- c( C# }1 ?: v6 u    BUTTON CUSTOMER_BUTTON_2
& J  j, o# [) b1 z5 G5 g    LABEL Menu Button22 }( e# r- @# ~2 W: U* N
        RIBBON_LABEL Ribbon Button2$ t! |1 J9 m" ^5 _! \
        TOOLBAR_LABEL Toolbar Button2  I* m* E, r) Y7 g' v3 K
    BITMAP filesave4 U* B6 W+ e' Z
/ S" j- M8 N  l2 Z3 d6 O
    BUTTON CUSTOMER_BUTTON_3( j  p! Y$ O; D, b
    LABEL Menu Button39 y8 o* k: u' r! p3 R1 ~2 a
        RIBBON_LABEL Ribbon Button38 \* F# b: s- k2 i6 [2 S
        TOOLBAR_LABEL Toolbar Button34 k* B2 Y" L5 o% ~
    BITMAP current_feature
8 H, Q+ X2 i3 D% _  Y2 O" e1 w. g. e+ ?0 Q8 s
    BUTTON CUSTOMER_BUTTON_4
# v9 D) h5 ~% M  i7 x, G0 A7 A    LABEL Menu Button4- ^8 ~; f) x4 c& k' x$ R  ^2 Q& {
        RIBBON_LABEL Ribbon Button49 M3 i8 [3 `$ f! Z8 ?
        TOOLBAR_LABEL Toolbar Button4( C* Y1 z8 _% X$ @% V3 e
    BITMAP block
( M+ q# U5 f: l; m1 q# W9 i$ l9 j
) m/ V8 O, @) V9 H    BUTTON CUSTOMER_BUTTON_5
' I0 l* C* \3 E7 U; Y$ S+ \8 x# a    LABEL Menu Button5/ L! j* h6 D4 v0 l9 G0 C9 x# ^; s
        RIBBON_LABEL Ribbon Button56 Q8 n0 y* Y7 V% A+ w; ?9 x
        TOOLBAR_LABEL Toolbar Button5
  ^/ B+ z1 e* M# d6 K9 D    BITMAP checkgreen/ F% }; H8 W1 G9 g, {' k( W

. R" Z/ c0 Q! i, ~9 ]+ m, ~END_OF_MENU( h6 {& ~% g. c4 I; O. {. ]) @

$ \  e4 L, Z% T+ v
; t% x% E$ J+ [- T4 L4 q: @) G! h
" @& {) S: E/ j0 W% qcustomer_ribbon_tab.rtb. Y/ d! ~  M: c0 x
!* Y/ e8 W* i% E+ `8 j7 z
!  Customer Ribbon Tab
7 v) c) e* E" S4 o+ N0 a2 y/ C* |!
  H$ l! n2 k, Y. R: |1 q* T!  This file will create a new customer tab containing three groups and# W, T! H0 M6 y" i7 C" _3 j; Q. ^
!  one top level button.
' e# C0 x/ }+ v+ L& r; L3 [!
9 V2 g) C( X2 B# ]& E* L
4 {- K$ R' ^) w1 Z5 F, M; [TITLE  Customer Tab
& j% a- g% y* o. y) B! `7 _VERSION 170# u- a6 A+ S: h" }# J

6 O% f% x2 y$ A- J2 z  }9 g  {!  The first group represents a Ribbon group that references an existing
3 d  C4 x* e+ q2 j% h! P9 d!  toolbar with no Ribbon style changes.  ) f5 O8 l  U. Z, e: T
!
. F+ T" j0 {7 p! o0 v+ n!  This is the quickest way to add existing toolbar content into Ribbon mode." v$ m: j9 }' u/ N/ s
!2 p7 Z: }8 D7 f! }) d8 Y* W
GROUP  customer_toolbar.tbr. k+ _4 o0 R- D- ^) ~2 R$ L' D' G
* m) A; B( l2 W
!  The second group represents a Ribbon group that references an existing , d1 b0 ]- e) I* k5 O5 k# Z$ Y* S
!  toolbar with Ribbon specific style changes added to it.  There is no difference
) H1 S: ]" `: J/ p. K0 U!  in how this toolbar is referenced in the .rtb file compared to the first
6 b% Z4 V( A4 P1 R!  toolbar as a group.  The only differences from the first group exist within + Q1 z4 [  a- I5 G9 H
!  the .tbr file itself.
* G) i( o( D, J4 ]' @+ x1 O!/ K6 ?0 n6 X8 r' v9 |9 Z3 W
!  This approach has advantages for customers that will deploy both Ribbon and) z9 e2 n) Y5 g( e3 Z& e
!  Classic Mode customizations since all the content is defined in the .tbr
; |1 l3 z2 H4 N!  file and it will stay synchronized in both modes.  Only one set of customizations) `& S; l; h8 z
!  will need to be maintained while still making use of RIBBON_STYLE to / n! S7 F: P1 S2 E$ y
!  control the presentation of the buttons on the Ribbon.  k% z/ d: G/ a9 H8 m5 F
!: r4 @, e$ K  Z9 H. ^6 ^: I3 q
GROUP  customer_toolbar_alternate.tbr
9 R( u( g1 t- n) u+ t% }- x  L6 I* S- h( O
!  The third group represents a Ribbon group that has been created explicitly3 l) s) ?0 L/ i2 a1 u4 D
!  as a Ribbon group and will not exist in Classic Toolbar mode.  This is the7 M4 U8 J. g9 d- n) @. u" U
!  preferred option since the user will be able to take advantage of all the 4 U5 Q8 l- j$ A; L4 B
!  layout styles and containers offered by the Ribbon.  
; E* }% ^7 V: L" \, n!
) t9 W0 @; p7 V' t5 R!  For customers that will deploy both Ribbon and Classic Mode customizations, " t2 \) v# N0 [
!  this approach will result in no synchronization and two sets of customizations 2 q( P0 }$ v; S: K9 z1 _& r; q+ Q
!  will need to be maintained.: a+ j' S+ n7 M
!
; l+ |2 U& r: E!  A group can alternatively be defined directly inside the .rtb file by using the
/ x  ~1 c7 M0 e. q, K9 M!  keywords BEGIN_GROUP and END_GROUP.  : {7 P$ c& {# Q" u# b, Z
!
  Q8 N0 q' o0 y1 H  v( P6 V6 s7 b; c' kGROUP  customer_group.grb% Z) g+ I0 d7 J; z. V
0 m( ^: w3 `3 n0 H/ d( h! @& ^" J% q
!  Example of a button that is placed directly on the Ribbon without being
" W" x$ }3 y$ h+ g. @!  contained in a group.  This is a simple way to add a button to a tab; e0 t* ~. R& e  S; c; u; ^1 g
!  but is not recommended for many buttons since groups have advantages.# h- I! B3 M% Y3 G
!  
6 }- M( _1 t7 y3 H. f% a!  A few advantages of groups:, R8 q0 g5 S6 m+ O
!     1. Easier to move many buttons around together in quick customization.  # }: B" m+ F4 G/ ~9 n2 {* q
!        For example, MB3 on a group and choose "Add to Left Border Bar".  0 Y% ^$ w8 N$ C4 b  R, ?4 w: _
!        This will move the whole group to a new location.  If buttons are + t# J' o+ x3 a8 o2 a" Z
!        not in a group, they need to be moved one at a time." L- x$ e8 M& d3 G9 u( E) C
!9 v3 V3 C2 t: C. L/ |1 g* h
!     2. Provide a label to describe its contents.
1 t6 }  |% l5 B: C  \/ C; V. C3 {!7 z3 }3 D1 M3 U9 J7 E5 ?$ u% s
BUTTON CUSTOMER_BUTTON_1
$ C2 e  k! c5 i3 n+ ?& t0 T9 ELABEL Button1 Directly on Tab
! |$ U0 E" ^8 d, e, T$ O  j, X& y7 \$ W$ J2 ^
+ O/ ^8 Y! L" H% {4 W- T1 E

; L- Y' v3 \2 [, I, B; c0 r. O$ {customer_toolbar.tbr6 W4 n2 k/ ^8 y0 b! j3 ~9 N% \
!
2 S$ h6 ]6 b) J. K$ s!  Customer Toolbar File* n) k& V' V$ \( ]' _1 Z
!7 t. g- o* t3 O# w4 ?' r
!  This is similar to an existing toolbar file containing9 v2 ]$ I9 X. ~+ C0 R
!  no Ribbon changes.+ {0 h* _+ h0 \
!3 |+ S: [  C1 G/ E5 w
!  In Classic Toolbars mode - This toolbar will still show up in the
, q3 z( u) X" p; g!     toolbars list.% {6 ?5 Y9 P, U$ W
!3 L/ @3 a  m) ?6 M4 c) P. T
!  In Ribbon mode - This toolbar will be automatically converted to a
3 S+ M+ Y; ?* n7 J' G! H!     Ribbon group and will appear in the "Classic Toolbars as Groups"
, R( ^4 t0 q: A, ]/ v0 F& q!     section in the Customize dialog.7 ?$ R$ W  p& ], U; q: \
!  4 y  x7 }5 [5 G2 L

$ o; t1 ?5 h1 ^+ S) [" s  lTITLE Toolbar$ u" Z& N) F* M' {
VERSION 170
5 s) D2 ~+ P5 i2 c4 G
% o  F! S( r* A+ |5 q" E( |BUTTON CUSTOMER_BUTTON_1# ]6 T- }# E( |- s$ t

' F& F/ P% V- ^$ A5 hBUTTON CUSTOMER_BUTTON_2) D3 [0 J- n/ W% C9 q  Q0 S) k4 \. _
6 y4 |1 C& j/ v4 s0 S8 A
BUTTON CUSTOMER_BUTTON_3
5 K8 q' x- g' `( B6 }
2 j4 s1 B; a, A) @" j& {; q0 GBUTTON CUSTOMER_BUTTON_4' z7 E0 F% I! G. O& Q

% e' n- a- U% \5 @4 EBUTTON CUSTOMER_BUTTON_5& J! p8 v) b& d6 `  D
9 u/ |8 S, h9 M5 ~
% Z; k# [* ]3 H# i% Z% j6 p

5 {" ?, h# A  d& m- A7 bcustomer_toolbar_alternate.tbr
- i) g+ m( Y/ Y/ Y1 k!
! l4 |$ E, d. k4 y0 L: \!  Customer Toolbar File (Alternate)
( a$ C+ n3 L- m- @3 ]& `! r: @/ {!- h, w3 V+ J5 e: S& H
!  This is similar to an existing toolbar file with new3 d( x8 K( s  K. }* j
!  Ribbon styles added.
1 T% Z* ]1 y# ]$ I!  . I+ V- b0 D) @* v
!  The RIBBON_STYLE will be honored when the toolbar is loaded
! `: A9 s, ^6 H* `% Y! a!  in Ribbon mode as a group but will be ignored when the toolbar
, }. U/ Q! M8 y2 F!  is displayed in Classic Toolbars mode.9 Z3 K9 U$ x5 x& S
!
  A- D  R0 P5 \9 H8 A" [!  In Classic Toolbars mode - This toolbar will still show up in the
& n2 R/ X9 H9 W& J7 `: E!     toolbars list.# R8 t4 X+ O; z, D2 s: p
!
- `7 F7 o" A3 @% o3 a* y7 g!  In Ribbon mode - This toolbar will be automatically converted to a ; q# h: n" n# M5 X2 a
!     Ribbon group and will appear in the "Classic Toolbars as Groups"
2 f/ k4 J% ?, P& g$ K/ C!     section in the Customize dialog.
, }* s9 k. D$ {6 A' c!( `4 ^1 x8 Q, `- q; W& V
) C! `5 `& F6 R8 }; P) B
TITLE Toolbar (Alternate)
: G6 ~7 m3 D" ], x- u6 H+ SVERSION 170
$ f+ v' w1 Q0 L2 t7 F" N& }3 n7 t4 M! g) b' H: Y1 H* O6 J
BUTTON CUSTOMER_BUTTON_1
. _! ~0 v/ ]' U8 r3 mLABEL Toolbar(Alt) Button1
0 ?  c8 |- L0 FRIBBON_STYLE LARGE_IMAGE
' y9 p' s/ x5 z4 h9 Z" H+ `" X3 H
9 X( Z( E: ]8 Y6 JBUTTON CUSTOMER_BUTTON_2
" l& M# l5 d- G* lLABEL Toolbar(Alt) Button2, ]5 M( A) {% c) ^9 f
RIBBON_STYLE LARGE_IMAGE
, t1 U  p  j) a7 D* E% O0 g4 j( N9 l8 B
BUTTON CUSTOMER_BUTTON_3
. O% g2 K/ [5 A4 F7 x  Z/ ?LABEL Toolbar(Alt) Button3
' c9 U% e$ [  |3 d3 h& C) u/ GRIBBON_STYLE SMALL_IMAGE_AND_TEXT/ I! L$ H9 y& q% C1 y
, o2 ?* o$ y, R
BUTTON CUSTOMER_BUTTON_4; k0 ?: ]# h8 ^, B% z5 P+ J
LABEL Toolbar(Alt) Button4
8 W8 P/ L% U& ?% V9 z5 lRIBBON_STYLE SMALL_IMAGE_AND_TEXT2 _: d0 |( t# B- R3 V
, _3 Y" z: P5 @
BUTTON CUSTOMER_BUTTON_5- N! M# P$ ]3 x( c3 v
LABEL Toolbar(Alt) Button56 n  |2 L5 i7 L, j9 ]8 _
RIBBON_STYLE SMALL_IMAGE_AND_TEXT1 c( L1 J$ M" ?4 \3 p9 c) _

+ b8 b; S$ g3 M2 y- d+ E; A' l, K2 c
5 ]" d! ^8 @& |; N* M
customer_group.grb
( _) E4 [: I  T6 g$ ^!- F- ^: f) [; t' z) R
!  Customer Ribbon Group File6 k  z* }! `  `" v8 x* |8 @  W2 D
!" _! l' |% w0 H$ Q. b
!  In Classic Toolbars mode - This group will be unavailable
( H+ L! t' F6 g, v: p! Y* `!$ z# C! Q9 g! D  B. x( N2 C
!  In Ribbon mode - This group will show up in the "All Groups" list% K# B+ K4 T6 i( r. u- G) z
!     in the Customize dialog.6 Y4 g' T1 p9 {8 [; r5 K7 |
!
2 h2 ^% G1 @7 N: c0 N1 ]' d8 v; O!  The labels of the buttons are defined using the RIBBON_LABEL token in the MEN files
+ w& a6 j6 Z9 M; Y!- a0 t  e" \# y! F- H+ o; c- H

- u, W6 D' ^$ b8 x3 x0 rTITLE Group( ~* W4 n! H- E1 k+ Q
VERSION 170/ O' Z/ E, V+ j0 F/ M  m6 x/ P1 v
% {" a! F5 P/ T3 R7 R8 A
!  No LABEL defined, using RIBBON_LABEL defined in customer_men.men
4 W6 B* p: _7 B, S' k% ZBUTTON CUSTOMER_BUTTON_1
2 h+ f, P; S, J' pRIBBON_STYLE LARGE_IMAGE
5 }8 B$ H" A! C* q. }  ^; e2 L! q5 f" Q0 R
!  Example of a gallery defined in a GRB file.
* j6 S. F4 k, K!
$ }# I0 I  [* P; p2 R4 Z!  If this gallery is to be used in other places, then it could be 2 M' i7 J0 i  v# j) u! E
!  defined in its own gallery (GLY) file and referenced here
8 u; U( P6 I& h!  Example:9 w5 f3 A/ O, b  p$ ~
!    GALLERY customer_gallery.gly
/ m/ p6 M: T! h5 k/ V" J!! v4 B) @' w- L1 r9 ]
BEGIN_GALLERY  CUSTOMER_GALLERY; F! r7 V  K6 O$ n; L/ S9 l0 Q0 n1 L
COLUMN_IN_RIBBON 2
2 S' e6 T0 T) o6 lCOLUMN_IN_POPUP 2- N- H9 p) ~& s& d8 `* P: K7 |
LABEL Gallery
" {) K' N0 h3 G, wGALLERY_STYLE MEDIUM_IMAGE_AND_TEXT
6 E( a6 X; X- d4 l
$ c$ K! z9 \+ }) t. n    BUTTON CUSTOMER_BUTTON_2
) H+ B0 T* B5 Q! _3 c- [  ~  B  m4 D; M
    BUTTON CUSTOMER_BUTTON_33 l0 C+ {1 i* \1 a) b& [  F

% A/ |& Q+ k! G" z, g( [9 @    BUTTON CUSTOMER_BUTTON_4
9 O) z% q9 U" R
9 V# w: l' ~! }9 @* D. Y    BUTTON CUSTOMER_BUTTON_57 _: c# D# k% H* p* {7 v' T

+ w3 \0 }/ [- hEND_GALLERY5 |5 N4 k/ Z  Y
, W0 W/ `7 v/ h4 T0 @8 M0 v: n
2 v2 j& N; {! N, X7 U
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

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

本版积分规则

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