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

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

[复制链接]

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

2470

主题

1275

回帖

8万

积分

管理员

PLM之家站长

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

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

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

x
关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧
, v- y5 z* ^% t% {" A: n$ I+ L/ @/ b

经典界面到RIbbon界面转换

经典界面到RIbbon界面转换
1 ~2 ~" W0 G9 D, m0 Y
在经典界面下,需要的文件
9 ?6 M7 j0 e# q9 B) c
  • customer_men.men
  • customer_toolbar.tbr
    / _) y& l7 p9 l3 |2 d, |3 {( c
在ribbon界面下你可能需要的文件 ) k6 e) [- {& c* G9 a2 @1 R
  • customer_men.men
  • customer_tab.rtb
  • customer_toolbar.tbr
  • customer_toolbar_alternate.tbr
  • customer_group.grb

    3 g& i( c$ v' {. I
: l! C0 t" P0 Q+ D1 h

2 e3 A" M* n+ T: |* ~举例如下:  Z. v, s6 f! {
8 G6 c5 f& J5 b, v: X1 e4 f2 h

4 {  l3 o9 v3 f& K: ]customer_men.men) d4 I; L4 a+ e8 R/ D5 G
!2 s4 V9 z7 E! c) @% d: T/ V
!  Customer menu file
$ P: s4 L9 G! W1 q  z% g2 Z6 P+ \( E!
, s( b. U4 _8 |* D. ]3 o!  Contains button definitions to be used in 3 ?: t" S% H. c7 u* `" w
!  toolbars and Ribbon files
' {; Z" u/ ^% ?. Y!
1 R$ R/ O  F) x; U
1 v& g$ u9 I6 t' Z! @) [  r" TVERSION 120' S! J" D1 e  m3 ]  q- K! ~3 I5 \! I

/ U. I' [1 U* ?" m6 Z: fEDIT UG_GATEWAY_MAIN_MENUBAR
/ }1 L% \* h) `1 W9 d
. H5 c* E% V% ?2 RTOP_MENU
" A' q$ Y$ n' v! H( T) ^  K    CASCADE_BUTTON CUSTOMER_MENU+ {( W2 k& O8 N9 [) B1 R' p0 p# g  s
    LABEL Customer Menu
  Z6 Z8 X, G. t. Z' {  K: d) |/ |3 u2 s% \! |" T
END_OF_TOP_MENU- L* q9 _0 G" F

* P  C; ?0 E+ j6 qMENU CUSTOMER_MENU- |, \. b- i; ~" c2 }; K# ]( j
( F. Q7 F2 T( L1 `' |7 c9 v
    BUTTON CUSTOMER_BUTTON_1# \  {$ D1 I$ P: V  P0 w9 R( _& Y/ ?
    LABEL Menu Button1
7 C# @1 E5 v$ j% K# n         RIBBON_LABEL Ribbon Button1
+ K* D. y; ~3 s( b        TOOLBAR_LABEL Toolbar Button1$ m  v- ]& i+ [' @1 }+ e" }+ D" T
    BITMAP fileopen
2 I1 G3 A% Q9 _0 ~+ I
4 ?4 M; T( t# O$ ^    BUTTON CUSTOMER_BUTTON_2
& O( N+ I9 c$ q    LABEL Menu Button2
) J# o  H6 o- z+ u8 y. \        RIBBON_LABEL Ribbon Button2
) Y! u4 a8 x, f1 X9 @  ~        TOOLBAR_LABEL Toolbar Button29 M$ @& \4 v1 d0 I; X
    BITMAP filesave' w4 {1 y! X9 j# m1 y( k; i
" {7 z5 P/ V9 o6 }5 B
    BUTTON CUSTOMER_BUTTON_3
0 }3 s7 o% Y# Z1 P    LABEL Menu Button3* c# c' q4 `  x% S) {7 U
        RIBBON_LABEL Ribbon Button3
3 f7 ]. b2 ]" d# v0 z3 {- M        TOOLBAR_LABEL Toolbar Button36 I2 [6 _5 p* j9 G- i" ?
    BITMAP current_feature8 |0 {1 z  N. M7 Y" t

, ^/ `' ~0 t( }3 d! ]% I0 b    BUTTON CUSTOMER_BUTTON_4
) K8 @  V' p; z    LABEL Menu Button4
6 o6 r5 o. o9 l9 t4 ^# p        RIBBON_LABEL Ribbon Button4
) c$ E4 ~1 S1 K! ^' a* v" D        TOOLBAR_LABEL Toolbar Button46 A$ y9 S  D& k; P$ H
    BITMAP block
: I+ U8 F. C% p! J; C# z7 d3 L/ r! o  \, @; r3 {" }
    BUTTON CUSTOMER_BUTTON_5
+ ?7 _) l% W% _% f1 b, e    LABEL Menu Button5" p3 L, ]" n5 V7 l
        RIBBON_LABEL Ribbon Button5
4 R8 G  B3 v! g+ x        TOOLBAR_LABEL Toolbar Button5
6 {' R  v: |8 h) i/ D: D    BITMAP checkgreen
# v& ]9 N  d) S! N4 b& l5 y4 g2 L7 }( n! H1 ]
END_OF_MENU
/ p+ L) c7 y/ J' Z- a; o! ?4 R0 V* ]8 y4 G; V% K
# P) q# h& b. E: s* t
& v. `, N8 e$ F
customer_ribbon_tab.rtb( t' [' F% N; ~: D/ \. x* ^
!
/ D9 O) c% Z$ V1 s!  Customer Ribbon Tab2 O7 Y( U7 |& l0 _6 l7 [
!
. Q6 Z, }2 Q/ j2 |  ^/ Y+ H) t* @* b3 q!  This file will create a new customer tab containing three groups and1 W3 |! b( {9 e# C9 m8 x; a
!  one top level button.' R  ?# c4 ]. H% S: ^) c
!
6 l- i* E. Y+ f" N% D7 j' X+ C; K0 A# K+ S
TITLE  Customer Tab
5 h! ^" m- j" ]) H0 ~VERSION 1700 J" M& ]/ G% f6 {+ \
8 g, t0 h: s* L" O( U7 ~+ |  A! f* i
!  The first group represents a Ribbon group that references an existing
' ^; t3 P& |/ W!  toolbar with no Ribbon style changes.  
( N& W8 f- ]3 c! A!
( B+ N4 d) `+ W( \; r) P- U3 c!  This is the quickest way to add existing toolbar content into Ribbon mode.
' ?8 q1 u1 M5 M% b!
/ W& R9 V. |. zGROUP  customer_toolbar.tbr1 Y+ u  B0 ?6 c1 Y. H" o7 h
! C: J- ~  t( N" }
!  The second group represents a Ribbon group that references an existing $ v' q: ~! |" x& s8 F+ `1 k2 `* w
!  toolbar with Ribbon specific style changes added to it.  There is no difference. B; ]- Z6 Y5 D5 }: o# h) [  p
!  in how this toolbar is referenced in the .rtb file compared to the first$ H. u! L1 R" F" d6 }
!  toolbar as a group.  The only differences from the first group exist within - V6 K# E. q) `4 w
!  the .tbr file itself.
8 k, ^0 c7 t4 x% _  k!8 _) P" [$ V+ b/ P, F8 X
!  This approach has advantages for customers that will deploy both Ribbon and, K$ R3 C! v3 t7 s1 \6 {# w3 ^- g
!  Classic Mode customizations since all the content is defined in the .tbr ' D- c0 ~# I. ]% n# i
!  file and it will stay synchronized in both modes.  Only one set of customizations
6 Y0 X! p6 k" g% K" P!  will need to be maintained while still making use of RIBBON_STYLE to & v$ X( g  S8 v) s: a
!  control the presentation of the buttons on the Ribbon.
2 q/ s* U- W5 G1 B!( T6 n3 j1 P$ E0 {: z- g
GROUP  customer_toolbar_alternate.tbr1 O  N, _1 x! }1 l; e- g$ T
" w( q# P" g; Z+ ~
!  The third group represents a Ribbon group that has been created explicitly6 n6 S/ I$ L8 K9 T
!  as a Ribbon group and will not exist in Classic Toolbar mode.  This is the
9 a3 Z4 D; K  f) ?9 T+ E# o!  preferred option since the user will be able to take advantage of all the ( q! X- k. G0 q' V; z
!  layout styles and containers offered by the Ribbon.  2 ^  i: B2 b6 {, O8 j* O0 l
!
6 d9 J- a! D1 \!  For customers that will deploy both Ribbon and Classic Mode customizations, # e+ Z6 d: c, n1 {" ?! W
!  this approach will result in no synchronization and two sets of customizations 3 `: P* ]+ V+ T! ?- W* z
!  will need to be maintained.
1 I! k3 }1 e4 ~( c: L$ U& Z!
" S; O* |% {. X+ A8 C!  A group can alternatively be defined directly inside the .rtb file by using the
1 [/ @4 d  G. ^* c: n: H!  keywords BEGIN_GROUP and END_GROUP.  8 y$ Q2 p* X6 g' l3 y3 r
!
5 R4 Y5 u9 d# B% AGROUP  customer_group.grb
9 p4 G7 u+ _! i) ]+ K3 x6 ~3 v/ |; Y/ a, `" v' u
!  Example of a button that is placed directly on the Ribbon without being/ Q- [: d; i. e& R
!  contained in a group.  This is a simple way to add a button to a tab, r. p$ U* [" c8 i+ T. h, z
!  but is not recommended for many buttons since groups have advantages.3 g# d# g1 |/ {9 Y! {" J' Q
!  
3 w$ g" \7 w. l" h4 G!  A few advantages of groups:3 _7 d$ T$ h1 b4 w; I, t
!     1. Easier to move many buttons around together in quick customization.  ( w9 T6 {& ~3 P7 F
!        For example, MB3 on a group and choose "Add to Left Border Bar".  ! b/ w- |5 ^# _
!        This will move the whole group to a new location.  If buttons are
. e# i* o' |9 T3 T1 ^!        not in a group, they need to be moved one at a time.
- q( X7 N0 l1 [; p' p5 a9 a* a  L!
0 ~; r3 s' X/ l4 T. ?; `# L9 H!     2. Provide a label to describe its contents.# A9 u' O/ N' g8 t
!0 z+ g- V7 o* Q- m9 F& y
BUTTON CUSTOMER_BUTTON_1$ Q* d3 J! v/ i
LABEL Button1 Directly on Tab
: x* A; C2 |: p5 s9 D- r! O* f# N: w3 o* T& n0 D' n- ?

. P& ?: K6 X1 A; l$ P
/ N7 M4 A& f9 S2 K! b# Gcustomer_toolbar.tbr& e5 |5 j5 U1 R) I7 o9 O
!
4 }" ~4 W2 B/ ]0 U!  Customer Toolbar File2 |, Q( c# t3 O
!
0 a' W7 @1 F+ G% h0 A& ^!  This is similar to an existing toolbar file containing& z& ~; g& @- k% L* s# n
!  no Ribbon changes.# }/ e% K; \' j/ e% y
!9 p; a% d* S7 _% }2 p: o2 J5 D
!  In Classic Toolbars mode - This toolbar will still show up in the
! @# g8 F* i$ r0 p; K5 a!     toolbars list.
1 R8 e3 f7 F. H1 H0 E# y!5 i# Y# \: e/ S
!  In Ribbon mode - This toolbar will be automatically converted to a 7 }3 G3 ?9 P" `3 b) [- K
!     Ribbon group and will appear in the "Classic Toolbars as Groups"' C% l1 N( Q  [* {% ]$ |- _8 F
!     section in the Customize dialog.
; N5 B3 O( L! @% ?/ {9 X!  ! @( J& a, i3 u! c

8 x  Y# e! r: A" k  f& T0 aTITLE Toolbar) i2 `5 o- r9 d
VERSION 170* b/ a: |& ?( C: d9 d& W+ B

- A3 k7 `' }6 l8 w% e5 P# b9 nBUTTON CUSTOMER_BUTTON_1
# {9 d0 @7 @0 D2 C( c5 U3 Q5 {. V# ]- t8 I0 Y
BUTTON CUSTOMER_BUTTON_2) Y" D7 v$ ^7 J0 ]' K
) O& q2 P" d( h  ]  x: @
BUTTON CUSTOMER_BUTTON_3
  P( _4 _# }- J3 i) X& c$ N
: R7 b' T0 U* g  w5 R1 G+ z  tBUTTON CUSTOMER_BUTTON_41 A2 q0 T3 u" E' T" u+ V

- o* e* I0 I7 @% u! P7 }7 dBUTTON CUSTOMER_BUTTON_5
4 d0 G+ W! S+ x% i" c+ H: y) `& b; R. ?

  ?( L- i4 J- a4 J5 R- L$ G! {7 e  y) S* M" P
customer_toolbar_alternate.tbr
$ m  T  {, U9 N' L!9 g) n/ W# [9 \5 o! H2 J
!  Customer Toolbar File (Alternate)1 A5 x8 E( ^1 O$ g% j( g, F( v
!
6 u0 i. O0 o1 j# e5 U!  This is similar to an existing toolbar file with new$ Y6 [" S6 _" }& V7 R
!  Ribbon styles added.
; ?6 ~  g2 w# o: ~- M$ c!  1 C7 w5 |; k0 |4 m. X9 P
!  The RIBBON_STYLE will be honored when the toolbar is loaded # B- n) r% Z' o3 M$ Q8 E
!  in Ribbon mode as a group but will be ignored when the toolbar
3 Y- c6 }; h7 p# y5 g) H!  is displayed in Classic Toolbars mode.% I1 D% m( @; M# @4 o+ k
!# s& D8 L8 p1 W( q3 D/ u9 O- y
!  In Classic Toolbars mode - This toolbar will still show up in the
" B8 T& s' f3 x: S) G) B/ z* W!     toolbars list.
5 ?  Z) H9 C1 K1 `!
! `3 [9 @+ M; z( _0 `!  In Ribbon mode - This toolbar will be automatically converted to a
8 A. r' r/ I4 @! b" z, d  t!     Ribbon group and will appear in the "Classic Toolbars as Groups"2 s! S1 D5 F. ^
!     section in the Customize dialog.1 }1 j+ G; @, J: B, Q: J
!  i3 o6 k8 I9 n* V# u) j4 s
! s. y% {, x$ _& \  X  |+ j
TITLE Toolbar (Alternate)2 [0 r1 @* {' h4 R; i) V* I6 \$ O
VERSION 170
: P; k' ^0 u" E
, `* h& R2 b$ q7 N# i8 YBUTTON CUSTOMER_BUTTON_1: x7 A& H' \& J( {. J/ v
LABEL Toolbar(Alt) Button1
( o+ E4 [8 V7 fRIBBON_STYLE LARGE_IMAGE3 R+ M0 R! g4 _- N8 W9 M$ ]: C* |! i
) o3 D" u! E  q" x4 }
BUTTON CUSTOMER_BUTTON_2" I) j# y+ L- M% f
LABEL Toolbar(Alt) Button2
* c) ]5 ]. f0 v# i7 ]# a/ CRIBBON_STYLE LARGE_IMAGE
1 k4 k3 a% I* E3 F- c6 X1 D, g# s2 _' s- _* `  d& e0 y# z
BUTTON CUSTOMER_BUTTON_3
" f3 \/ d3 r% M! t7 CLABEL Toolbar(Alt) Button3
4 d3 s/ J. A3 T0 o. a5 `5 L; aRIBBON_STYLE SMALL_IMAGE_AND_TEXT' e2 H4 B. [- z' o% ~7 y
( R% Z. n$ \! x+ Y; n5 K
BUTTON CUSTOMER_BUTTON_4) T& Z2 s/ |. I" P5 {
LABEL Toolbar(Alt) Button4
! U. i5 {# S, h3 PRIBBON_STYLE SMALL_IMAGE_AND_TEXT8 ^, R; e2 ?% w3 {' I
$ H5 n# A* g# t; d
BUTTON CUSTOMER_BUTTON_5
! o  C$ i4 k' A% d9 {7 yLABEL Toolbar(Alt) Button5
( u7 |3 B# i, t, V7 p0 Q% H. MRIBBON_STYLE SMALL_IMAGE_AND_TEXT0 a! a2 n) q+ x4 e( [3 i: `' H& M

" f! `  u7 Q" Z6 C1 v) s9 ~( ^8 ]
* m7 E2 x6 n% `' p2 h" i9 G& ]
customer_group.grb
6 f% V& n+ ?. u!
* r8 F5 c# q2 }3 C!  Customer Ribbon Group File$ Y' S/ l% C5 r3 N2 X; M) e7 A
!5 W& {1 z' u4 z/ y  J  {
!  In Classic Toolbars mode - This group will be unavailable2 ], j1 o; f4 T4 @7 E
!1 Q6 A5 e% g3 ?2 ^& m6 r1 Z
!  In Ribbon mode - This group will show up in the "All Groups" list) O7 L5 U1 h$ X) Z7 R
!     in the Customize dialog.& b% U) m7 o# q: h  g5 S  M
!0 K) @. v' R) }3 T
!  The labels of the buttons are defined using the RIBBON_LABEL token in the MEN files
7 T4 A! \8 h6 g!
1 f, S5 \1 S& J( A: f/ z$ {
* x0 K" H& F: G$ p" l  fTITLE Group+ g4 p5 }/ S# ^6 o5 f) A
VERSION 170
- P9 @4 Y, @5 ^- d4 r* H
- X4 |7 f5 i! R4 L" u3 r!  No LABEL defined, using RIBBON_LABEL defined in customer_men.men7 c  u! c' S% y- [, @( i; z
BUTTON CUSTOMER_BUTTON_13 F& E! g& E% {; l# V1 C$ Q/ Y, G
RIBBON_STYLE LARGE_IMAGE3 Y+ M* |; E: F& i5 m

7 s/ H! a# m! v* q+ A!  Example of a gallery defined in a GRB file., m/ M6 t4 J4 C4 w0 A
!
7 G( m; w8 K) e- @- r, {!  If this gallery is to be used in other places, then it could be
1 R2 `  ?, ?- T!  defined in its own gallery (GLY) file and referenced here' K% R. T/ c' y! H
!  Example:$ n% l3 e% O/ V1 N" ^) p# r
!    GALLERY customer_gallery.gly
0 x, O; }# Y  ], q5 m!
+ X8 r3 ~% i& M# ~4 E! R7 `- l  ~+ HBEGIN_GALLERY  CUSTOMER_GALLERY1 L& P  ]0 k7 k/ F* {
COLUMN_IN_RIBBON 27 w7 m$ E0 ]8 Z# Y- C  m$ h
COLUMN_IN_POPUP 2$ v5 N. X, o4 H; s- K) o
LABEL Gallery
/ s: |, P1 j; P4 M( u, pGALLERY_STYLE MEDIUM_IMAGE_AND_TEXT# @+ [  Y/ \2 b/ M# M
3 n/ [) E' T9 E' S* g6 n2 E
    BUTTON CUSTOMER_BUTTON_2
- c  C7 V. b# [* m
& E5 }, D* z3 P; _/ Q' O. _    BUTTON CUSTOMER_BUTTON_31 V" F& m9 g& r$ l- s
4 V0 Z6 {* F! W/ y1 e4 y8 e- q: P
    BUTTON CUSTOMER_BUTTON_4) u9 v7 {3 a, |/ K# ?
% S/ [( U3 J1 i! |
    BUTTON CUSTOMER_BUTTON_5
' |% o( G  Q( g$ @$ c, m# W. X. X  y# C+ [+ w
END_GALLERY
9 e1 v% T( X" o2 W5 O  o/ u! {  t) C$ v+ v/ i8 M8 c9 V7 K

/ z1 I& [0 B/ w' \6 T' C, q' a
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了