PLM之家PLMHome-国产软件践行者

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

[复制链接]

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

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

admin 楼主

2015-1-9 10:37:48

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

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

x
关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧
. t% O) C$ `7 G

经典界面到RIbbon界面转换

经典界面到RIbbon界面转换
9 d* @3 }1 r, g$ d
在经典界面下,需要的文件7 i9 A' J2 D1 u. j  E- k0 P! \
  • customer_men.men
  • customer_toolbar.tbr
    8 u& T+ z  Q2 Z0 t
在ribbon界面下你可能需要的文件
! i+ {' I! ~% z% U
  • customer_men.men
  • customer_tab.rtb
  • customer_toolbar.tbr
  • customer_toolbar_alternate.tbr
  • customer_group.grb

    : U0 |) w7 T) q) {& p

+ X$ I& L9 r5 [: Z/ i5 z4 q0 m! K, @
2 }# H* M0 A! k9 N, g# S举例如下:
$ S- M5 d/ c" i8 H9 X* S2 H  B9 z2 X

: T0 r- O/ u( o) z3 ?customer_men.men
3 V, a7 l( s& T7 D!
4 f# m7 k" `* n# I2 r; j: x$ X!  Customer menu file& M8 U/ p% m0 _* d/ J# F* N' h; V3 l
! 2 m: }3 v, |. l" i/ Y% c
!  Contains button definitions to be used in
& w' U) K* W3 A, q- v) f!  toolbars and Ribbon files8 F; A6 T, G$ `: s/ l" c/ C, q
!
- t0 U/ B1 q# O+ W% X
; B( h: }, F+ s* u# HVERSION 120$ l3 ~  f) B7 Y) n

8 @9 l% S; w. l3 L- Q3 |EDIT UG_GATEWAY_MAIN_MENUBAR
3 U% I9 d8 [% t1 I8 G2 v* g1 o
5 ]# v6 l) N6 zTOP_MENU
0 g% Q8 `; j+ p$ p6 R    CASCADE_BUTTON CUSTOMER_MENU, _+ Q- t/ V6 o  x+ S7 z2 R
    LABEL Customer Menu1 B2 B& V$ H: q( h

  i; S6 v. u: V3 J) U2 d1 mEND_OF_TOP_MENU
+ w0 }; R1 `+ M9 T8 o# L7 V
: m0 b9 r, r! \& k( QMENU CUSTOMER_MENU7 i! b" ^+ i$ @5 W" [' T4 X8 {( Y

9 M0 v4 h0 w1 |2 ?! |, Q# i    BUTTON CUSTOMER_BUTTON_1/ U4 Q5 m$ Q3 e
    LABEL Menu Button1# v* O- p. g' M2 h; J
        RIBBON_LABEL Ribbon Button1
  f& {0 S5 |2 p+ x        TOOLBAR_LABEL Toolbar Button1& j+ @$ u7 s: j2 [
    BITMAP fileopen! H& V! ^* i& y. ~& ~

# `5 n6 v/ \) H( B, u3 Z    BUTTON CUSTOMER_BUTTON_2
7 J3 \+ h' B4 D7 P8 r    LABEL Menu Button23 ]% X+ [( ?1 @3 a# [) m
        RIBBON_LABEL Ribbon Button27 m  G- T! e$ ~
        TOOLBAR_LABEL Toolbar Button2
  N* z2 {: N5 C: y3 C    BITMAP filesave( Y& A0 \9 T) |$ s0 _" p. e

% K& m) b8 O( B% u. b+ x: h    BUTTON CUSTOMER_BUTTON_3
7 s. a/ k! I  r4 k6 ~  \  r    LABEL Menu Button32 l' A: E& o$ ~+ S$ c# x
        RIBBON_LABEL Ribbon Button3
, f8 v  |+ E' N+ p+ T        TOOLBAR_LABEL Toolbar Button3! r: I' Y! Y8 Y( s
    BITMAP current_feature. F% Q, X1 k3 ?3 G8 l* W, P

' O; X/ L6 B4 L( m  n# ~    BUTTON CUSTOMER_BUTTON_4
8 n' D6 s' ]8 _& T- @    LABEL Menu Button4# m, `- X8 ^, }5 e8 v
        RIBBON_LABEL Ribbon Button4
- |5 V/ I0 C5 @        TOOLBAR_LABEL Toolbar Button4' g1 C+ y$ e& x9 v
    BITMAP block- u6 l+ n, X3 K' Z0 `; j
$ z% R4 m6 J7 Y) Y4 K$ c
    BUTTON CUSTOMER_BUTTON_52 Y3 c$ p$ o; _! e# p2 t
    LABEL Menu Button5
3 W- ^; ^" n' F1 r% l3 M! u- \        RIBBON_LABEL Ribbon Button5
3 _! ^; V, e( H' ?; B8 t        TOOLBAR_LABEL Toolbar Button5: Q- [7 |6 \. i# z9 a1 d8 C
    BITMAP checkgreen2 w8 w& M0 z5 i
& E+ R5 |2 V+ j) \8 r- T
END_OF_MENU
7 t) n' m: |! K, }+ ~6 a" _+ S2 T4 y+ p' I
7 k; }# h# x" O: o, G
( u' P; d. H7 w" I
customer_ribbon_tab.rtb
' d/ _4 h* K; W) a- t' G!8 N* x" |& ]; X
!  Customer Ribbon Tab7 N9 X" l( N6 T2 y7 J- x
!
" K, _* k$ r2 A, u6 N!  This file will create a new customer tab containing three groups and
2 n" k+ A5 n' N/ j0 E/ `!  one top level button.
; i/ S3 R7 f$ }. I1 k5 i/ i( l7 V!
. k& p% s) @( E$ q+ J
2 z" h: M! b, l( {1 T6 GTITLE  Customer Tab
  [) f+ ^% L2 n7 E. A1 u/ VVERSION 1708 c- R, F+ D$ J, N3 ?0 ~; y

: `# r" e+ a' g' W8 N1 |; H' G5 f!  The first group represents a Ribbon group that references an existing
" A# y+ L2 ^4 `!  toolbar with no Ribbon style changes.  8 u. ~/ {, Y$ n
!   {) _/ t1 b' H' y+ {# q7 j: P0 I
!  This is the quickest way to add existing toolbar content into Ribbon mode.
% p: c% u  s& M!
$ k0 D2 t4 s; {, ^GROUP  customer_toolbar.tbr' W2 Z& r2 S2 a: ]1 F. ?3 f/ G

7 b7 m# r8 {) C$ R: M. c. V!  The second group represents a Ribbon group that references an existing * R" V8 j8 ]& g, z- Q5 b; i$ L
!  toolbar with Ribbon specific style changes added to it.  There is no difference) u1 ]' P: p- w$ C9 H
!  in how this toolbar is referenced in the .rtb file compared to the first
2 ?; f9 `! `. `" Z) Y4 R7 i!  toolbar as a group.  The only differences from the first group exist within 6 o2 ], H- ^3 s- P: ^  [7 \+ C
!  the .tbr file itself., N9 t1 U3 x, K  m
!5 G' {. ?+ q1 B# u- D* Z: j# H
!  This approach has advantages for customers that will deploy both Ribbon and2 o, Z- x5 b. Z
!  Classic Mode customizations since all the content is defined in the .tbr % q; @% B4 W7 d% P* r2 ?
!  file and it will stay synchronized in both modes.  Only one set of customizations# P( E' d) m; y4 r% Y* k
!  will need to be maintained while still making use of RIBBON_STYLE to
  V3 h6 O; E- w) t!  control the presentation of the buttons on the Ribbon.; \0 E$ T& \5 i, ^3 ~
!
) c9 O$ T+ H3 n& D+ A" |2 BGROUP  customer_toolbar_alternate.tbr/ h5 q2 W( D* C
- }: U/ n3 Z( v$ M
!  The third group represents a Ribbon group that has been created explicitly
8 i) w+ u& a, H6 d+ `) K!  as a Ribbon group and will not exist in Classic Toolbar mode.  This is the
2 m5 T/ V- B+ D& F: D* b8 l!  preferred option since the user will be able to take advantage of all the
! d* A9 W5 M$ A7 {3 T2 J7 O!  layout styles and containers offered by the Ribbon.  
, X$ B, v! W' O, L7 i!
( d8 ~! y9 w! G) x2 h4 w/ ]!  For customers that will deploy both Ribbon and Classic Mode customizations, 5 C+ [! _  W6 q- E3 O6 u1 M7 `
!  this approach will result in no synchronization and two sets of customizations + ]% |; D3 {4 Z8 Q$ l% E
!  will need to be maintained.
8 l$ W9 T6 [. O9 J5 o+ \: r!
2 E, I' F0 c/ q- i  u: U, q!  A group can alternatively be defined directly inside the .rtb file by using the- X9 E" b& Y% _9 H
!  keywords BEGIN_GROUP and END_GROUP.  8 y0 }( h' }9 K: I
!8 m: ~& a, I8 |
GROUP  customer_group.grb
$ D$ j( t* \2 h# r' r% L: y5 [8 `; k' _4 g0 r( A; o: v& V, W) w5 l/ N) n
!  Example of a button that is placed directly on the Ribbon without being
4 J4 g7 l* u7 ^' N!  contained in a group.  This is a simple way to add a button to a tab
. Y. ]$ F- ^- d& {!  but is not recommended for many buttons since groups have advantages.
% I( h2 f; Z+ z5 Q: d, X- j!  
8 u6 u2 j. }# S7 w) Z' Y# F!  A few advantages of groups:+ l( Q1 v9 x. A  M1 f
!     1. Easier to move many buttons around together in quick customization.  
: P" r9 f2 u" M0 M& `) ^* m!        For example, MB3 on a group and choose "Add to Left Border Bar".  
, g, M9 h( M. a- O!        This will move the whole group to a new location.  If buttons are
+ }, S# B+ p3 |+ G2 _: z!        not in a group, they need to be moved one at a time.% R1 s5 ?! A8 F" [/ j' t+ u* @" F
!
: d9 l# z7 v) k6 E!     2. Provide a label to describe its contents.
0 D$ n# Q( m, D' F9 r9 t% U!
# `9 I; ^/ _5 d8 [' _1 PBUTTON CUSTOMER_BUTTON_1
, C) R2 e3 c1 C8 a/ o  R4 NLABEL Button1 Directly on Tab
% A& K- O: X- ^2 l9 |, ?/ P0 x' `& h2 U1 O: m
" g( j3 \' V7 K* J6 p. p

5 u% Y1 ~' _( h- p/ H  S7 f3 [+ zcustomer_toolbar.tbr
6 ]3 a8 V+ r, R. W6 D!
3 T  s) W* I2 G7 X!  Customer Toolbar File9 J2 r( J$ O0 A4 I  B2 @
!
7 u9 R6 m' V, o2 X( `; {!  This is similar to an existing toolbar file containing  D0 ?& s' B) P- |$ b1 K
!  no Ribbon changes.
9 z5 F- D2 H1 e- D4 {9 H3 D+ e!: g, G: T/ [" K
!  In Classic Toolbars mode - This toolbar will still show up in the
( z" U" t# k: T  O!     toolbars list.
& W% o+ W5 T# g4 W9 |4 y1 Z!
: g8 k3 J8 e* J) s# S* O!  In Ribbon mode - This toolbar will be automatically converted to a , H# W. M- n) o" g
!     Ribbon group and will appear in the "Classic Toolbars as Groups"
1 Q1 a" @* J6 \) m- i( p; Z!     section in the Customize dialog.7 d  o& }  d1 |3 P" p
!  1 h/ e0 H: P0 [  e4 A

- }- F; d* l3 f  J9 ^( ETITLE Toolbar
1 s5 T2 E/ q4 `. ]0 mVERSION 170
. ^8 t" i$ X8 {& v
( B: |5 X3 [7 J# D3 o3 f6 LBUTTON CUSTOMER_BUTTON_1! {8 S( B' Y+ V3 h9 g

+ |8 B4 i8 w; r+ _6 O7 Y4 v' L, SBUTTON CUSTOMER_BUTTON_21 ?  m& N, c$ D
: t, p. W" ^9 _! P' N$ |* r7 Q
BUTTON CUSTOMER_BUTTON_3
. ?+ q- B2 B+ M
# ~0 _' }6 I% N1 V4 V0 TBUTTON CUSTOMER_BUTTON_4
( K9 i) W, _/ N/ e. U. Q, O, {# t/ f) q/ {% ~5 P+ y! k
BUTTON CUSTOMER_BUTTON_5$ j/ Z  c" i! v3 y9 E

5 |5 [0 }" M' k
( i6 s% k4 N0 \: V
9 l1 o1 f, |$ p2 v1 K5 Xcustomer_toolbar_alternate.tbr
0 B' O1 c+ N6 T/ H5 a! E4 q& L4 N!
- f# m, y2 X2 g0 H% p  u5 |!  Customer Toolbar File (Alternate)0 Z7 P1 c- Y5 j& Q5 d$ Y' \4 {3 u
!
3 Y0 A6 u" A  i% E& m6 V. Z!  This is similar to an existing toolbar file with new3 R- K0 {, j7 }* i
!  Ribbon styles added.
1 n4 G: ?( j8 H* Y& h4 J0 D!  
3 M- M: M) Q: G+ Z!  The RIBBON_STYLE will be honored when the toolbar is loaded
; N+ t& ^3 t: C0 \: q7 n!  in Ribbon mode as a group but will be ignored when the toolbar
  S3 w9 Q# Z8 I0 c!  is displayed in Classic Toolbars mode.0 m3 ]7 K3 R5 x& M2 X3 E. t
!* h5 Q; J. ?' y; F4 v4 q0 K0 S# A
!  In Classic Toolbars mode - This toolbar will still show up in the ) `8 Q* G* `( a# H, T7 h
!     toolbars list.* I" f" @' _/ l( @) q0 o
!7 U+ {: d4 ]- s/ h) d1 w! s2 F
!  In Ribbon mode - This toolbar will be automatically converted to a
4 h) p& V9 R+ F$ I* ~7 u6 E!     Ribbon group and will appear in the "Classic Toolbars as Groups"! x1 @3 q. h8 I0 }, x
!     section in the Customize dialog.! b# S# k& u! e: T& ?
!3 _& W. D7 i+ `8 J7 _

$ ^! I+ h# h9 K, V+ vTITLE Toolbar (Alternate)' J$ G3 ^5 g5 x" r9 O4 E
VERSION 170
* ]) v! T3 `/ i% U" u2 Y
; G, y! r( o( i  w# _( BBUTTON CUSTOMER_BUTTON_1
! C7 m5 Z, E* o3 |5 r: W: uLABEL Toolbar(Alt) Button1
  r9 @) u) D% J7 ARIBBON_STYLE LARGE_IMAGE
( R) O) P# U* u2 g7 ~) X! A6 C8 r7 v( O, p# U7 N9 F) a/ ^
BUTTON CUSTOMER_BUTTON_2# w, n* f1 L  w( H( r
LABEL Toolbar(Alt) Button2
1 f( X- g1 }- w) ZRIBBON_STYLE LARGE_IMAGE
7 {# e9 D: E' Q1 Z2 d( b+ d4 H  V& w+ G" q' ~2 `% @
BUTTON CUSTOMER_BUTTON_3: _& T0 p# @. ]7 Z
LABEL Toolbar(Alt) Button3
+ h$ _  A- P. z# ]RIBBON_STYLE SMALL_IMAGE_AND_TEXT; z0 |. D- z, u1 l
3 E" |+ ^6 k0 k( e5 i
BUTTON CUSTOMER_BUTTON_4
, w& [8 M. ]' }2 T  ILABEL Toolbar(Alt) Button4
( t/ \  l! K# i9 K! I  F3 B( q3 URIBBON_STYLE SMALL_IMAGE_AND_TEXT
0 c9 F/ Z7 t* L9 `/ R6 j
3 G! Q* @. R: j( x+ H8 QBUTTON CUSTOMER_BUTTON_5/ Z. k* b; L/ f% m( Z+ O, l* }8 p. g$ {
LABEL Toolbar(Alt) Button5% l' b# @" I) w7 _/ U
RIBBON_STYLE SMALL_IMAGE_AND_TEXT
7 Q) M/ Z8 }: w. E$ o! ^3 f4 r7 q% i. v, H' X3 p

: m" r* @/ p% L, Q  c- t
' @* \1 W5 H: ^9 v  J/ e( Vcustomer_group.grb
6 f- J3 P( }6 I7 Z& G* C/ d!% f/ @! U5 I# s/ T* I1 A8 j
!  Customer Ribbon Group File) D* }5 T. T5 \
!
# r+ E% I/ x8 T. P+ s3 w( L!  In Classic Toolbars mode - This group will be unavailable, |) _2 G8 u4 J6 d$ z6 h9 {  Z
!4 c  l0 I7 `' h. I5 H! A8 Z+ R
!  In Ribbon mode - This group will show up in the "All Groups" list
* t2 X' a# ]8 x( j3 h1 s" v* }  j!     in the Customize dialog.
/ d' ^' S; S$ J/ r* e% ^: W7 V!$ [$ L2 |" V$ [0 h. O1 q
!  The labels of the buttons are defined using the RIBBON_LABEL token in the MEN files1 f5 n- {3 m$ {" _* J
!0 k) a/ x: Q& t$ ], D

' n4 d2 U+ n3 _TITLE Group  U1 d  D4 M5 U2 v+ z0 K
VERSION 170
: C. v$ y4 A, H0 a: R1 j$ N& n* M
!  No LABEL defined, using RIBBON_LABEL defined in customer_men.men
0 u! r' M) a% Z6 b3 G$ V, KBUTTON CUSTOMER_BUTTON_1- G7 h# d/ {$ d$ i" z+ |
RIBBON_STYLE LARGE_IMAGE" d& n6 Z5 ?) w2 k+ A0 s7 l

9 I. _8 `  x" e( b# \!  Example of a gallery defined in a GRB file.0 T! V- ~* S# _
! 4 m4 U) D1 L4 {3 W- @
!  If this gallery is to be used in other places, then it could be
  K2 `! e' i- ]6 }% j!  defined in its own gallery (GLY) file and referenced here
# E5 f  |( C( f: }!  Example:
3 t) p: v3 D+ [& J! e!    GALLERY customer_gallery.gly
9 W5 ?& v( c; A+ T!
( l& ?* M* q# V  ~" N2 yBEGIN_GALLERY  CUSTOMER_GALLERY
5 W  Z# s. X3 K, G' R! Z% eCOLUMN_IN_RIBBON 22 z' T* p! o& j3 U/ V* [* [* V( }
COLUMN_IN_POPUP 2
& {, j& u) E$ O% O- D, \* l6 M) xLABEL Gallery! V, Z9 s1 P  _1 ^5 [: ?) A+ h. B
GALLERY_STYLE MEDIUM_IMAGE_AND_TEXT
  y# D% ?% U. ]# R! r
$ _9 M7 H& n* B# z6 H    BUTTON CUSTOMER_BUTTON_2
1 \8 m3 D1 ]+ B: J, e0 a) Y0 q) b- A. \9 l% P, C' H* |( i/ _2 V
    BUTTON CUSTOMER_BUTTON_3
; `0 d0 G; M0 k
$ I5 q& P/ C( k5 y; R  H    BUTTON CUSTOMER_BUTTON_4
- w9 X+ h. q2 n8 H8 _; r# h) M3 ~* h% x6 ?0 S( S9 {9 G1 S
    BUTTON CUSTOMER_BUTTON_5
, A( P2 M& ]/ s. _( U1 j- j
# X% s1 L4 f% w4 ?END_GALLERY
5 I, q) I$ |, b& X* @% M9 I8 J% t/ _  s3 Z, T; e# P8 S& u

4 B5 B* n  k% M# E/ `4 M
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了