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

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

[复制链接]

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

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

admin 楼主

2015-1-9 10:37:48

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

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

x
关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧
3 V* V1 ?0 H0 ?- i+ S) a  a& x

经典界面到RIbbon界面转换

经典界面到RIbbon界面转换

. D7 V4 v, h& j2 w在经典界面下,需要的文件
$ M9 M2 z, k) y2 N7 W: f' K. J! g- l4 y
  • customer_men.men
  • customer_toolbar.tbr" ?! i. [! z; Z( t
在ribbon界面下你可能需要的文件
6 E6 N( @3 ]5 q( O4 D
  • customer_men.men
  • customer_tab.rtb
  • customer_toolbar.tbr
  • customer_toolbar_alternate.tbr
  • customer_group.grb
    6 O2 k7 P/ A' w

. w8 Q: y: B* @4 Y
3 `: n! X, `5 ?" v: E& ]$ L7 Z举例如下:
- h5 x" G& l& t# J0 }
2 E8 D2 o) J/ d7 z+ E$ U* [2 Y# l! I& _* X* ^" h
customer_men.men! E) K# k% `- W" q) z3 |! V
!! n" N& p& P2 ~& O: B% ]. g
!  Customer menu file- D- W6 a% d& N# V
!
4 W8 n  u. ~- ^2 m2 f+ U!  Contains button definitions to be used in
$ i+ N: t! V8 a5 V!  toolbars and Ribbon files8 S+ x8 c  B, r2 n
!
, r9 U, S8 }9 b9 z- K9 z- g& P0 g! L& P2 m
VERSION 120
0 m4 `) t  M! q  |9 H" F$ c" A: Y6 _7 ]$ D' T
EDIT UG_GATEWAY_MAIN_MENUBAR% l! {( f* T/ M3 E3 l

/ S, s/ [8 K1 l* `. c6 b; {TOP_MENU/ W# M3 Q9 F6 w, o
    CASCADE_BUTTON CUSTOMER_MENU: b# a: J; P% D# T
    LABEL Customer Menu9 s. n3 N" ?0 T4 A% c  K

9 h  O  l6 h3 j! N: v1 dEND_OF_TOP_MENU
& p  T8 W( y- O; y8 ~& Z
' K% F) y9 h& n4 B! D8 D. n8 sMENU CUSTOMER_MENU
! U3 }* T3 Q/ A: ~7 n! O' k+ x( M& S( I" r9 S/ Z1 p+ A- `6 M; y
    BUTTON CUSTOMER_BUTTON_1
3 d7 M/ X* S. V  j    LABEL Menu Button1
7 g) ~6 A2 U' x/ f7 q) m' ~         RIBBON_LABEL Ribbon Button1% `* O! C' m- O. V- R
        TOOLBAR_LABEL Toolbar Button17 w% B) m1 N3 x2 T0 a- V' @
    BITMAP fileopen" J1 |3 }2 N' Y' @. K) P3 h$ J
- t/ T$ s/ j4 l7 U; _9 P
    BUTTON CUSTOMER_BUTTON_2
7 A; a2 [( s! N+ R+ i( _* d    LABEL Menu Button2
+ M" Y( |: d5 x        RIBBON_LABEL Ribbon Button20 u9 H5 _% _3 Q/ i* i: w3 d' k5 [
        TOOLBAR_LABEL Toolbar Button28 E3 l1 U6 d0 E/ v# v
    BITMAP filesave+ Y& T0 L+ u5 K( k) @
3 A* F, \' x6 g8 R3 f
    BUTTON CUSTOMER_BUTTON_3: n) L/ r0 p: J1 u/ f
    LABEL Menu Button3
4 C. p, n. w8 v' y, t- P: B0 |1 p        RIBBON_LABEL Ribbon Button3
0 M3 N7 m0 ]+ X# B& _        TOOLBAR_LABEL Toolbar Button3
+ g# ~2 P+ D& `9 ]% H: Y) p    BITMAP current_feature' Z' f% x" r+ A- ^  p9 {* O

' A) F& B1 g2 I( m* c9 r* ?: _    BUTTON CUSTOMER_BUTTON_4+ h' V0 q" a) ?% p
    LABEL Menu Button4
/ |' P3 q; i# L8 P/ ^3 ^        RIBBON_LABEL Ribbon Button4
* n4 m! T: j* }1 {8 j3 b        TOOLBAR_LABEL Toolbar Button4
% _0 v( @& Y% k1 Z% F    BITMAP block, T, G9 H) ^+ q
2 S. G  Z" b$ x$ J
    BUTTON CUSTOMER_BUTTON_5
4 M% R, u: x4 Z    LABEL Menu Button58 i' T& |: M$ [9 b$ L! T
        RIBBON_LABEL Ribbon Button5
& z$ O8 Y! C& T+ n! q) J8 o        TOOLBAR_LABEL Toolbar Button5+ C% B3 ~: j; j7 K! E1 \
    BITMAP checkgreen: b! Q( s( D7 d1 J& A

6 L) n5 g' n% A8 A  |2 B  QEND_OF_MENU, P# }7 C& M  b. R2 f6 p" ?, b) r
% x: J9 J" u: n! R
5 J4 i+ G/ \' g. R- S3 o: _
6 f3 h3 i5 t+ B% L
customer_ribbon_tab.rtb7 F* b3 A0 Y' k% f6 s
!- P' s+ n) [9 N
!  Customer Ribbon Tab
  f: J  g1 c; l, @! 5 p" _# H7 b- Y8 G/ d3 v' O# A4 w9 G
!  This file will create a new customer tab containing three groups and6 D+ N* X# X" _, ^" m- X$ L
!  one top level button.
+ Z3 ~/ ?& n2 R% D3 ?( E!! H8 Q# e0 H+ v+ I

1 ], R4 T6 Y  D+ _/ {) ~* QTITLE  Customer Tab
5 y4 P1 I* p# yVERSION 170  f; I3 s8 @, f: ~& a8 L4 Y
6 C+ s# Y7 b$ {
!  The first group represents a Ribbon group that references an existing 0 g7 @, c" I! h% ^
!  toolbar with no Ribbon style changes.  
5 _+ T% W  @' D: h- m. U9 `: U! 6 o& c" Y1 Z0 \0 s8 @! M9 I
!  This is the quickest way to add existing toolbar content into Ribbon mode.1 V& H' J: [! I) F
!. ]7 X: `$ e) S/ D( o, P
GROUP  customer_toolbar.tbr
2 i+ M) p, o# u3 W' C
0 {' d5 V7 n: d. p% A. B* x!  The second group represents a Ribbon group that references an existing
4 H- h9 o% q: L8 o!  toolbar with Ribbon specific style changes added to it.  There is no difference: m4 W) N1 `* j
!  in how this toolbar is referenced in the .rtb file compared to the first" i5 E( z$ i: _% P$ N; p
!  toolbar as a group.  The only differences from the first group exist within
4 U& D, Q( h% F5 r!  the .tbr file itself.  q. T( S9 ?8 T& J2 p
!
7 g* w( Q: l9 m5 B9 [) G!  This approach has advantages for customers that will deploy both Ribbon and
5 L$ K( [; S, p- K; y2 K7 ~!  Classic Mode customizations since all the content is defined in the .tbr , F: w' p6 m+ r  z8 [# _5 l
!  file and it will stay synchronized in both modes.  Only one set of customizations" g4 O' L2 j8 n  n# {4 P
!  will need to be maintained while still making use of RIBBON_STYLE to - d7 Q0 W9 m; N( z
!  control the presentation of the buttons on the Ribbon.$ A0 f( d, W6 ^7 z8 v2 G
!( Q. ?+ F% p1 u5 [  C
GROUP  customer_toolbar_alternate.tbr( M8 [! c( E0 n- J2 }
  z+ e0 c* r0 J. U0 z
!  The third group represents a Ribbon group that has been created explicitly
0 A8 g- S3 y$ N# k) k& y!  as a Ribbon group and will not exist in Classic Toolbar mode.  This is the
3 Y4 Z8 ~0 {- u/ F4 w!  preferred option since the user will be able to take advantage of all the
2 t" T. ?: C9 A5 x9 O6 z!  layout styles and containers offered by the Ribbon.  5 O1 l& t$ i2 f
!6 u0 P) t2 e. g- n' Z# I, E2 C
!  For customers that will deploy both Ribbon and Classic Mode customizations,
" v% l5 Y" B! S% G  |  i!  this approach will result in no synchronization and two sets of customizations
3 P2 L& A, {$ H1 R" A6 \1 ~9 f. Q* Y!  will need to be maintained.! M, l6 m- _" H8 Q$ v
!* O! w/ ^' n4 |2 P$ ?2 h
!  A group can alternatively be defined directly inside the .rtb file by using the: o0 r) e) y" P9 ]
!  keywords BEGIN_GROUP and END_GROUP.  # h* f9 p; z8 X4 T; r! f+ G$ S
!0 Q: p5 D# j0 ]1 D6 P) w
GROUP  customer_group.grb
- F; @( y4 C7 E5 `5 y* p7 N, b: x: X% I0 I5 G
!  Example of a button that is placed directly on the Ribbon without being
" J) H4 J& A, q2 l8 `  m. V' p7 G# `!  contained in a group.  This is a simple way to add a button to a tab
" W  _% k4 o# n$ ~!  but is not recommended for many buttons since groups have advantages.' q7 s; f# ?* _: N$ O, G9 @/ p4 A+ E
!  
- ?* }0 ], A5 R!  A few advantages of groups:
6 b, Z) F( i2 n" v9 r!     1. Easier to move many buttons around together in quick customization.  
, }7 O& [4 U8 P7 D8 ?!        For example, MB3 on a group and choose "Add to Left Border Bar".  3 m- h# ~& r5 S1 `
!        This will move the whole group to a new location.  If buttons are
( C  u( C5 Y9 o( e& D!        not in a group, they need to be moved one at a time." A( K  X+ x, B$ ]+ v( x. q" l
!0 b; H% ?. \: \$ `
!     2. Provide a label to describe its contents.# M- Y1 N( ~; ~9 \, i4 Q
!
$ K1 D* [0 E/ v, G# u5 T1 ZBUTTON CUSTOMER_BUTTON_1
5 A2 s! k- a+ |: W  ]. F/ y. @7 LLABEL Button1 Directly on Tab
7 k* h0 _+ a, r7 `* o3 L( o# @6 ^7 Q6 D5 Q  w/ D  ~" R
9 o& v8 s$ p" d, l. U" v6 Z! G& a
. \! {2 J* u; ~# t$ o
customer_toolbar.tbr
  T% K: w, ]) D!. ~/ Q7 E" ?& P" A+ _  z. t
!  Customer Toolbar File  G' |0 y2 P3 M1 [7 s
!; P& q, l  a1 Y" G* U
!  This is similar to an existing toolbar file containing
& j: `9 S& N2 }4 [( S!  no Ribbon changes.& L" F' r8 s; C0 c
!2 R* {6 h1 @+ p: u2 J! \
!  In Classic Toolbars mode - This toolbar will still show up in the ) r: Q& j5 g1 _% l( g
!     toolbars list.. L/ a/ y: k4 f) w
!7 D) d; W3 [  a* [
!  In Ribbon mode - This toolbar will be automatically converted to a ! U# S# ^3 I/ ?9 F1 f3 @$ m
!     Ribbon group and will appear in the "Classic Toolbars as Groups"& I( S* {% c5 t0 Z& J, W
!     section in the Customize dialog.
: E& a( b' y5 k6 i" H" Q!  6 u+ B; ~0 t4 N$ `( y

6 k0 \/ g* a2 t6 u- [2 B3 yTITLE Toolbar
/ A+ [' h% ]! w+ U5 A& E4 J6 f* KVERSION 1703 {1 g4 _' ^7 \
. {- P8 N1 a; n
BUTTON CUSTOMER_BUTTON_1
1 A; }' ]5 [0 H1 ~* X! Y3 }+ Y% V3 i! R/ b! w+ A
BUTTON CUSTOMER_BUTTON_20 r+ k2 d- e6 _9 x+ M8 T3 ^& W9 b
/ i" A  X& }- w% l" B! M9 I& V1 G
BUTTON CUSTOMER_BUTTON_3
& z# x3 i" r6 u# }; D2 [+ L
) k% H# e8 `' V: q, {, E2 OBUTTON CUSTOMER_BUTTON_4- @. ~* x3 D; J' n; n

8 J; u0 m" s3 G& S. q; l# hBUTTON CUSTOMER_BUTTON_52 G5 m4 [4 I' `; K

6 A0 N% }* j& O: W) Z
4 ^( K) j8 {. B" z+ f4 O, ~' p4 j; J  S7 s! K* h2 x
customer_toolbar_alternate.tbr/ ?. F$ m& c" C5 n/ ?
!& e( n& a% E: x- w3 [' B
!  Customer Toolbar File (Alternate)1 P, ^9 e% _0 c2 p# h8 X& x
!- D# h. ^3 R4 k% z; v
!  This is similar to an existing toolbar file with new
* e3 Y  Z; }# j4 _* j!  Ribbon styles added.8 p) R# p+ W4 Y  V/ t3 h( o2 T
!  
) t/ ?) v. k$ z' T!  The RIBBON_STYLE will be honored when the toolbar is loaded
4 _: N1 q: d* ?; R!  in Ribbon mode as a group but will be ignored when the toolbar
7 V$ p1 ~! M. _, Y5 }!  is displayed in Classic Toolbars mode.
5 W. b% n0 |& e4 _" E0 U!' b! b' M! T, [
!  In Classic Toolbars mode - This toolbar will still show up in the # _/ r3 M, Q/ h' ~) i' O1 ~
!     toolbars list.
- q  r4 c" s/ w( P8 E!
9 b% m* n( Y, t/ s!  In Ribbon mode - This toolbar will be automatically converted to a 1 T( `! C/ [( n
!     Ribbon group and will appear in the "Classic Toolbars as Groups"
8 u# Y+ m8 @6 w) v( u( @' F6 D!     section in the Customize dialog.
' D4 Y' N+ }4 W!# [4 ~) V4 m: S
; c2 f, A' n) \, z8 q
TITLE Toolbar (Alternate)$ x+ C. J+ L% y! g1 u. n
VERSION 1707 v. ?) s, C, W" K; ^+ r
9 Y' _( B9 h. {. g/ {! N
BUTTON CUSTOMER_BUTTON_16 G" p8 i: W5 z# [9 z' o7 a
LABEL Toolbar(Alt) Button1
6 i6 ~4 u, c% W6 hRIBBON_STYLE LARGE_IMAGE3 s# W+ l) X3 K

9 B! l/ i" f/ A3 n% pBUTTON CUSTOMER_BUTTON_29 v) i. h( G+ x$ V& X  }
LABEL Toolbar(Alt) Button2
4 F- i- U7 q! h$ IRIBBON_STYLE LARGE_IMAGE! N9 @2 g% l0 u# G7 o/ m6 W% f
; d) E: b( F7 C4 L' Q  Z
BUTTON CUSTOMER_BUTTON_3% g# h- X/ _" D3 W& }. m0 w8 j
LABEL Toolbar(Alt) Button3
9 z+ @8 s+ \/ R& sRIBBON_STYLE SMALL_IMAGE_AND_TEXT" X& {  I& P5 L' k3 y
) H3 x5 ]* A2 {: L: [
BUTTON CUSTOMER_BUTTON_4# R$ f: N# u- c7 G, C  b
LABEL Toolbar(Alt) Button4
& b  [; s3 K% a, `RIBBON_STYLE SMALL_IMAGE_AND_TEXT6 ]" w' }' w" i8 O. O

, i6 L1 M- ~/ n# h; ABUTTON CUSTOMER_BUTTON_5
7 P* P/ K- I' v4 KLABEL Toolbar(Alt) Button5
. D! H$ g* P4 d' oRIBBON_STYLE SMALL_IMAGE_AND_TEXT
6 a: M' U( k( [; X5 u0 A1 V5 v6 B* ]1 D8 \) y3 p
9 Y" }5 n/ i1 j3 X7 @

2 U1 q- I5 E# p  T; ?3 Icustomer_group.grb
+ b3 P3 ]6 m+ b, N3 G!
3 R, I2 J& n$ R. E7 i' u4 x% i!  Customer Ribbon Group File
9 M. b/ ]. |. w& C$ A+ u!
) K0 X! n6 ?) r!  In Classic Toolbars mode - This group will be unavailable; n) f( \8 C2 [# U* B
!
$ O3 {: h& u9 a4 j. [6 Q% g!  In Ribbon mode - This group will show up in the "All Groups" list
. g9 ~/ d1 G; V!     in the Customize dialog.
# r4 G9 U* H% c' w9 ^!
$ S, _  I2 `% [; w, }7 C8 A$ h( S!  The labels of the buttons are defined using the RIBBON_LABEL token in the MEN files! ~0 l( D' x( v
!
1 u) q( ^' I9 L: r0 r; b: w7 D- j7 j# t' d+ ~  G
TITLE Group
5 V) x( C: Q, \4 }5 PVERSION 170
( c, c, K% @: }* J
7 R) {4 k% d$ d/ j- V2 l0 }!  No LABEL defined, using RIBBON_LABEL defined in customer_men.men/ q* m/ |& Q4 D3 Z: x+ F- u0 K
BUTTON CUSTOMER_BUTTON_17 ^& R- R, b& q: w6 }# o3 `
RIBBON_STYLE LARGE_IMAGE5 r% E) K3 ~) q7 W. z

$ n1 w6 r1 X/ E; s% T  T6 W( u  z!  Example of a gallery defined in a GRB file.$ k+ {& z( V+ h% f
! 4 E+ s& ?  r2 }4 x1 k* R" _! W8 B
!  If this gallery is to be used in other places, then it could be
( }' T7 Y, B. V5 `6 c!  defined in its own gallery (GLY) file and referenced here' I2 h* y2 O  {
!  Example:- l, h2 c  I) S- \8 U2 X
!    GALLERY customer_gallery.gly
2 l$ G( H/ ^* x!* b- F  v4 q0 V8 c2 t# K
BEGIN_GALLERY  CUSTOMER_GALLERY
4 G/ Z% T  M/ Q* ?1 MCOLUMN_IN_RIBBON 2
3 H' _! Q6 j' J1 pCOLUMN_IN_POPUP 2
7 ^. D  Q; f& J9 \: q% n& bLABEL Gallery. U1 m3 J$ _: t% M: o
GALLERY_STYLE MEDIUM_IMAGE_AND_TEXT
2 o' L6 [- c  s3 K. P% ]: n3 k$ [8 w" E5 \) Z
    BUTTON CUSTOMER_BUTTON_2
# g, R2 ^: A+ j: A4 A; D* {; ~
8 {. m1 G0 x& R+ w- ]; P    BUTTON CUSTOMER_BUTTON_3
% F/ S8 a8 _4 _& B; B6 c* J6 b9 a' b2 M8 B7 H5 C) _/ F5 Z) U0 b
    BUTTON CUSTOMER_BUTTON_4+ g  g$ y% C7 P3 B0 `
9 z# D' z7 x$ ]3 G5 @; F
    BUTTON CUSTOMER_BUTTON_57 @/ M4 H( D& g* B( i! d8 D/ {7 _- V

4 F8 t0 T! o% |: `4 y. z3 cEND_GALLERY: l+ ]7 f; `. Q1 t  w( s
, F. g' ?0 d% R) p0 {6 i
6 w6 N& B/ H% P& k& N
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了