PLM之家PLMHome-工业软件与AI结合践行者

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

[复制链接]

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

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

admin 楼主

2015-1-9 10:37:48

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

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

x
关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧% i. J4 u5 s; c" j* l( }; {

经典界面到RIbbon界面转换

经典界面到RIbbon界面转换

: Y& \9 ?  K/ P+ O* P! Z* T在经典界面下,需要的文件/ W' k$ z- r/ g5 A* f
  • customer_men.men
  • customer_toolbar.tbr1 J5 ?9 m- f+ N; @' b
在ribbon界面下你可能需要的文件 & s- b8 Q+ d7 q( c: i" T
  • customer_men.men
  • customer_tab.rtb
  • customer_toolbar.tbr
  • customer_toolbar_alternate.tbr
  • customer_group.grb
    8 t# N! N2 S6 X& T% B9 T

& j2 A1 o; B: e4 D+ w3 m0 G# _9 [; o+ d: e! A
举例如下:! P; v* Q1 h/ ^$ T' ]
4 k- l! o. p1 o

/ f) O, {6 Y' J5 x. Bcustomer_men.men
8 R- T( ~. I1 V; c2 k; M& H8 y!! \. ~/ w: Y- |, f# E
!  Customer menu file
% a: O6 G4 r+ B7 a7 G& G!
3 {1 w) |8 C/ J!  Contains button definitions to be used in
- \# Q2 `% C/ Q; \9 {; j0 V!  toolbars and Ribbon files" L( L5 B* y7 o+ R
!/ j" E, I3 W  A9 e

5 t+ d* f+ p' X9 HVERSION 120& [& @* R0 h: Z* t+ I! t  \
+ f% G% c  b4 T! E: N' R
EDIT UG_GATEWAY_MAIN_MENUBAR
1 T$ u4 A$ b9 ?3 a3 e- Q
& G  a! h5 e" M1 }  r% A  P. @# DTOP_MENU
7 m: ?+ z3 r$ k3 l, H    CASCADE_BUTTON CUSTOMER_MENU9 b$ h, @) i" n
    LABEL Customer Menu* N, f( F. \' q7 W9 F5 H( |9 h

* E2 ^  G" }5 L% s) O' fEND_OF_TOP_MENU% h% L9 T  L+ y  _3 r
* f2 \0 x0 I: M' t+ l; O
MENU CUSTOMER_MENU* y1 e7 s3 B2 v; x& p; U% M

) F1 P7 X; C/ i, f    BUTTON CUSTOMER_BUTTON_1
' L/ i/ u* q& M+ J) q  P    LABEL Menu Button1) A& p' r: d- U+ R
        RIBBON_LABEL Ribbon Button1
& P' N8 i  r% B. c& D' `        TOOLBAR_LABEL Toolbar Button18 k2 T: W5 d* N
    BITMAP fileopen7 n) x1 c5 y2 h2 x

% Z! q* e+ z6 T3 A! b( r5 O. U' ]$ ^    BUTTON CUSTOMER_BUTTON_2
; i! n, G$ t) J& X* v+ [; u    LABEL Menu Button2( g9 M0 s7 O  T& f( V1 m- f( `
        RIBBON_LABEL Ribbon Button2
* [" d9 }4 W% s# R& T        TOOLBAR_LABEL Toolbar Button23 _, D9 k& |" b4 r5 `  o- J) V$ p
    BITMAP filesave
* w$ I' h8 B! |2 Z" \
# p' P5 Z1 c: m3 T    BUTTON CUSTOMER_BUTTON_3, G8 l) B( `6 k; l& Q
    LABEL Menu Button3
3 W0 Q0 @: r4 u& j% L5 U0 @0 y        RIBBON_LABEL Ribbon Button3
: d# Q7 _4 t9 H; N        TOOLBAR_LABEL Toolbar Button3
: \" ^& ?, M, C: z! Y) v: B    BITMAP current_feature5 I; w; r% P/ w

3 I; J' {+ U  f4 w( q) C5 f5 x' x& [    BUTTON CUSTOMER_BUTTON_4* P, A- e- q( z- ^
    LABEL Menu Button4
4 n6 ]/ n8 N  f* B$ y; n  G! c        RIBBON_LABEL Ribbon Button4
. X* Q, x: T2 _& f        TOOLBAR_LABEL Toolbar Button4
3 L3 K, y, B) Z' z- {* Y    BITMAP block
$ u8 M* P) ]4 `  W4 C
, w7 N) ~$ D" Z/ h; R0 g1 m    BUTTON CUSTOMER_BUTTON_5) P* ^, ]- Q! V& ^5 H
    LABEL Menu Button5
9 `2 ~' B8 Y; t- q- c) D& s        RIBBON_LABEL Ribbon Button5# R+ m- I8 B& ?# j8 Y0 u+ z" t1 B/ j
        TOOLBAR_LABEL Toolbar Button5( ?+ |4 T4 s: H& i
    BITMAP checkgreen
1 b& }6 v8 {) Z) X6 c% c5 x" K* S3 v5 J# U1 m* }
END_OF_MENU( s, t( O8 D; c! I! p+ F

* w  p, A$ b) x* R- d, r: F; g4 @1 c) _7 y

- z0 O) k! ^! t& z8 scustomer_ribbon_tab.rtb# U9 M8 z3 X. n4 {
!
% _! f# Y% y2 m!  Customer Ribbon Tab
8 l9 X# w' W3 O8 ]$ J* k! ! I0 A- L: R: Q
!  This file will create a new customer tab containing three groups and" G: x' l$ N0 U+ B+ f. U% K
!  one top level button.
0 V4 t, H3 i' R" q! p!6 S7 w: [( v" S1 J

( K! U* S8 U' BTITLE  Customer Tab
2 t- J: f1 M0 |! R7 lVERSION 170
/ ?' u/ u" `+ n2 ]8 W& s; s( I% J; _' z: ^' W  h# R
!  The first group represents a Ribbon group that references an existing
- I! d7 o: z. _6 y0 ~8 |( u!  toolbar with no Ribbon style changes.  
' ]  x) w) m: i" C!
) D8 J$ p: x' B* @0 ~!  This is the quickest way to add existing toolbar content into Ribbon mode.
7 U, \. ~  k( P9 ~. p, y, b- u!& a+ t0 l  B. Z2 T2 o5 G7 u
GROUP  customer_toolbar.tbr
  r* g, [9 S" G1 p5 M/ C8 P$ l. l6 }. a4 u5 d9 X
!  The second group represents a Ribbon group that references an existing
7 I8 R# `  L& M. U!  toolbar with Ribbon specific style changes added to it.  There is no difference
& W" ^. c) T) d% I!  in how this toolbar is referenced in the .rtb file compared to the first0 z! _% r9 V2 K: z" v
!  toolbar as a group.  The only differences from the first group exist within
9 @. M8 z- y: m$ m!  the .tbr file itself.
! b, X; x/ x. C& t% s) m7 @; m!
; a7 J0 m) J  C; `!  This approach has advantages for customers that will deploy both Ribbon and
8 J3 w# C& y' `2 m2 T% _!  Classic Mode customizations since all the content is defined in the .tbr
  i- J, W3 @. D( Z% \* x5 ]!  file and it will stay synchronized in both modes.  Only one set of customizations  e$ J4 y& H9 R  I/ P( G2 ^
!  will need to be maintained while still making use of RIBBON_STYLE to 1 i1 K( ~+ h) _, K) `, ?0 o1 C
!  control the presentation of the buttons on the Ribbon.
. w) z8 V# }" e7 y6 C/ w# b3 V9 `!2 u, ?  t$ v, x: @
GROUP  customer_toolbar_alternate.tbr
7 Z* @. J4 r2 f: l$ G- r" {) j/ u
' j7 k) l& Z- L. f9 J! y!  The third group represents a Ribbon group that has been created explicitly6 h% T7 I/ j' R) ~5 i  S
!  as a Ribbon group and will not exist in Classic Toolbar mode.  This is the5 g# ^6 H8 l  x4 {
!  preferred option since the user will be able to take advantage of all the
! C# g/ o( G, V  n) R, |, U!  layout styles and containers offered by the Ribbon.  
; v  q3 m" a& e/ m9 p% \6 @!
$ K6 R7 n( R; b. }!  For customers that will deploy both Ribbon and Classic Mode customizations,   O/ Z3 }8 u$ O) g
!  this approach will result in no synchronization and two sets of customizations
! y# E" |- W/ Z( _9 u& G!  will need to be maintained., A7 V  t* C) b( _5 s% [: I
!: j# j3 v" V3 e' N6 R- i
!  A group can alternatively be defined directly inside the .rtb file by using the' r8 x9 F  k2 b+ A8 g
!  keywords BEGIN_GROUP and END_GROUP.  : E, a# Y5 B- Q4 V* Y  y% ~5 u/ H
!
5 Z7 x4 T& }7 k+ }  n0 s4 m9 GGROUP  customer_group.grb
; {3 R: S. h) S( t5 X5 j! T6 b4 O( `- a
!  Example of a button that is placed directly on the Ribbon without being% B+ Y# m) M* b7 L. V: x4 _7 s
!  contained in a group.  This is a simple way to add a button to a tab
9 c6 D. W3 e1 G) ^!  but is not recommended for many buttons since groups have advantages.+ F" Q8 S. P/ u
!  
' m% `: c/ N1 A/ i+ _, M/ F& D!  A few advantages of groups:( ]' J( i$ d" U$ f- C2 `  p
!     1. Easier to move many buttons around together in quick customization.  8 ~& T9 t) j# \0 |# ]0 F/ {
!        For example, MB3 on a group and choose "Add to Left Border Bar".  " p/ V; i/ g5 K: W
!        This will move the whole group to a new location.  If buttons are
7 p4 n5 }9 J; k0 w!        not in a group, they need to be moved one at a time.
' D  _2 R0 X5 Y- K1 t- u!
- I% C* t1 Q1 m" L( I2 Q0 M!     2. Provide a label to describe its contents.
% b6 |3 T( I  b: P4 t!
: _' ?& t; b* P3 J: wBUTTON CUSTOMER_BUTTON_1# s2 Q4 x# r; ]1 G
LABEL Button1 Directly on Tab
9 v/ T! N1 B- S: s$ B: V+ ]; e0 L$ F) m
1 ]% {9 J# k. ~' x# K4 [+ @
: K# b% p4 N6 q/ N' W
customer_toolbar.tbr
' _& z% z9 q$ c, l' I!
. ~% p+ E' E& v: U, ^!  Customer Toolbar File
4 `+ p9 `* m" ~4 z% c- |!6 a/ v/ z: d* _0 v( R: z
!  This is similar to an existing toolbar file containing5 X0 T! e- v. B0 Z6 K) J* Y
!  no Ribbon changes.* j; i) U& ]" M  \- m
!% b) r* n7 r; \. b/ @; M( v4 q6 Z1 e
!  In Classic Toolbars mode - This toolbar will still show up in the
1 P7 I9 ?7 B9 d# U!     toolbars list.0 _4 f9 X1 q% I2 w1 q4 j+ l
!  @3 j4 v, x6 d0 B
!  In Ribbon mode - This toolbar will be automatically converted to a 5 H6 \9 W8 i# v4 z. a
!     Ribbon group and will appear in the "Classic Toolbars as Groups"8 S) o1 A0 v7 I% E2 g' e6 U* {! Y6 _
!     section in the Customize dialog.3 G" y# a- O/ `
!  
. {( M3 X+ k/ R' \4 m$ P+ x
" X* {" ]% C( |% ETITLE Toolbar
$ G0 z# `- [4 D9 ]# {* oVERSION 1704 \/ C9 W( H- P( q* J# j. A# u

1 R) E( ?, G' P1 J- ]6 XBUTTON CUSTOMER_BUTTON_1
  C4 e3 V5 N6 e! Y  w& @
3 O5 ]( \' Y) ]0 v% V+ QBUTTON CUSTOMER_BUTTON_21 W* o+ R2 ?3 E8 S- D
  h  i  P2 \" j* p2 B! H  ?
BUTTON CUSTOMER_BUTTON_38 \2 h1 S1 [& B, G! ^9 S' [

# F6 {, c. @, C  mBUTTON CUSTOMER_BUTTON_40 ~( {1 x% C7 l: {" {- K4 b

8 @" i6 x; ]. E5 S: vBUTTON CUSTOMER_BUTTON_59 |9 |: O3 c' |  K/ v
5 ^4 Y! I5 H' p% l6 X2 b0 m: c

9 O7 ~4 |7 Y; K0 r/ k
# V" }) Z6 x3 j0 R+ Q% V. o8 Ccustomer_toolbar_alternate.tbr
- G& U1 t. d4 F1 O# d% f!* M" [2 x. G% h
!  Customer Toolbar File (Alternate)# G/ [9 b% H, n
!
  e! E* L3 d& l! \4 s5 G!  This is similar to an existing toolbar file with new
: s7 p# I% }+ V9 e2 n: v/ g# {4 e!  Ribbon styles added.+ b) }) W$ |6 h0 c
!  
9 A3 V/ @) Q- L( w!  The RIBBON_STYLE will be honored when the toolbar is loaded
& M! x* V7 `* J/ U/ h; }!  in Ribbon mode as a group but will be ignored when the toolbar 2 {9 [0 H* W8 s
!  is displayed in Classic Toolbars mode.
. j6 x8 e: h  [, C+ G4 e!' L+ F% v0 a/ b& z  K' a: H" G
!  In Classic Toolbars mode - This toolbar will still show up in the ' A, ^6 w! |. o2 ]8 y! [1 \
!     toolbars list.3 b2 A6 d/ N3 B, {
!# B( l; i$ v/ F; {7 _3 ~0 M/ b. O2 F
!  In Ribbon mode - This toolbar will be automatically converted to a ( M1 a% V3 G: |! l, `
!     Ribbon group and will appear in the "Classic Toolbars as Groups"
$ n0 n/ W+ W( C; c5 D!     section in the Customize dialog.
- T4 ?! M7 q" m0 j1 I5 H, S  @!, |; @2 t. I5 B7 W- J) d! T

  V6 o  [* q+ o' ?9 F3 WTITLE Toolbar (Alternate)
& B$ Y- w. E6 |% xVERSION 170  K% D6 H4 b# h+ w
" d* n" i1 K, D& b2 X" Y  k
BUTTON CUSTOMER_BUTTON_1
! U$ R* W! I4 }* X; S; ]LABEL Toolbar(Alt) Button1
" g9 j! S+ l. Z5 ]7 VRIBBON_STYLE LARGE_IMAGE- J4 [9 R; t. s2 }3 G2 Z0 V3 R

8 O' o2 C7 r, r- i$ ZBUTTON CUSTOMER_BUTTON_2
! g) s; [% G" h8 R) fLABEL Toolbar(Alt) Button2! G. e7 J0 W2 u+ f
RIBBON_STYLE LARGE_IMAGE# b( `: X2 ~$ ^0 _: `, C' ]
6 V" S) T: ^9 P* O, d
BUTTON CUSTOMER_BUTTON_37 R' d, u% s: L1 e% ~/ n
LABEL Toolbar(Alt) Button3
- G6 p& }. a6 x$ ~" xRIBBON_STYLE SMALL_IMAGE_AND_TEXT
7 G% q0 F7 Q7 o6 C+ E& ^9 @7 {* X! L% O) a8 j  Z, r0 F, A
BUTTON CUSTOMER_BUTTON_4/ R  P2 I; J! I0 G8 q7 P. V) z
LABEL Toolbar(Alt) Button4/ P0 R+ @6 e1 C( N9 r% I2 j7 c
RIBBON_STYLE SMALL_IMAGE_AND_TEXT3 F) E" p* m! I( `! K: E) H

. Q4 M/ S& P8 t1 o; [- x$ x0 ^BUTTON CUSTOMER_BUTTON_5
8 g8 O* |/ @8 E9 L! ]( vLABEL Toolbar(Alt) Button5/ I/ Z9 A0 L9 C& g3 R! A7 E
RIBBON_STYLE SMALL_IMAGE_AND_TEXT
& l1 n/ R. ?. A9 i( E
" T6 U- d1 `! l* h0 X0 ]* x
. D: y4 d% X) F- w2 u' o) E% {9 ~: N
0 J/ |/ }. l  v% }# @+ fcustomer_group.grb. E! U2 y+ P/ u: `7 B6 j
!
4 H, A' W. D0 U0 I5 ^7 h. q- I+ v# y' [!  Customer Ribbon Group File" d+ }* U' ^8 X$ W0 j- |* Z
!) l' b& a* x  X- w
!  In Classic Toolbars mode - This group will be unavailable
* C8 c5 H" `; {( {!
$ [2 J8 r0 D, ^- i/ \!  In Ribbon mode - This group will show up in the "All Groups" list. f& V4 Y9 ~6 a
!     in the Customize dialog.
& R9 R5 a# A7 S  I!
9 d# u. _' {0 ?# Q!  The labels of the buttons are defined using the RIBBON_LABEL token in the MEN files. q  J. X+ j* s  c
!3 G* }. d& |& F* F% g4 w* D: E

) @% Y# G- Q  a; O. _# ~TITLE Group; x  d7 _5 S( Q9 C" Q& v
VERSION 170
* }& Q# @; l: ^4 g# [: g  u  X+ @. b) P. I! z, i. F. `. ^4 H
!  No LABEL defined, using RIBBON_LABEL defined in customer_men.men7 O$ Y; z3 m+ J
BUTTON CUSTOMER_BUTTON_15 H, e+ P$ B4 r/ b' Q, S) Q3 O1 G
RIBBON_STYLE LARGE_IMAGE
; Y! g' l, |; Y% Z
0 ^; v. Z; l7 ?, V& e!  Example of a gallery defined in a GRB file.
+ k+ y+ F( E) d) b6 L! V, A0 V!
/ B4 {/ G' `5 L0 M& A!  If this gallery is to be used in other places, then it could be 5 U9 [+ |" n) u" `5 c5 v
!  defined in its own gallery (GLY) file and referenced here5 P- h: h/ z2 h4 x* ~- P% I8 r
!  Example:
  Z. a8 u1 [( _. F' X!    GALLERY customer_gallery.gly% q* L& k2 |9 y5 h3 W% j# t
!
+ L+ Q* s; `/ F1 M$ ABEGIN_GALLERY  CUSTOMER_GALLERY
. S3 K/ D9 Q3 r1 r( j- Z/ nCOLUMN_IN_RIBBON 26 M8 }, u2 J9 d9 l' Y8 ?9 ~
COLUMN_IN_POPUP 2
# O( I0 n1 k4 V6 Y+ \$ TLABEL Gallery0 A5 v( u3 Y: ~) @
GALLERY_STYLE MEDIUM_IMAGE_AND_TEXT
/ R: g% x3 h: v; o5 }3 R/ T3 e" t- I: W
    BUTTON CUSTOMER_BUTTON_2
/ z+ q" {$ A# o1 h9 L, @$ Q: f+ c$ _3 _# g1 I, {, \
    BUTTON CUSTOMER_BUTTON_3
" N% m; B. q1 ]; i; U; u" Z5 o& a' }" Q( q2 q, y8 L
    BUTTON CUSTOMER_BUTTON_4
/ a* s/ N' ]$ Z: J. Z
8 _7 G  J3 G: c7 Q    BUTTON CUSTOMER_BUTTON_5
2 j. i7 J, ^, D# A+ q' r+ e; t* F) [3 k$ U0 C1 K( M
END_GALLERY# ~# I- M: O: h+ _  `
# e- ^. F: z" L2 U
# Q' K! e- {9 z% I& ~; f
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了