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

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

[复制链接]

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

2470

主题

1275

回帖

8万

积分

管理员

PLM之家站长

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

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

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

x
关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧) u0 d: x2 S; k" j

经典界面到RIbbon界面转换

经典界面到RIbbon界面转换
; }0 E# g9 d: o* P0 V! X+ J
在经典界面下,需要的文件1 Y8 E' p9 [9 G1 x% j
  • customer_men.men
  • customer_toolbar.tbr
    % h7 t0 e  a1 f, D- Q
在ribbon界面下你可能需要的文件 6 q. L' D( D: N( G& X, b
  • customer_men.men
  • customer_tab.rtb
  • customer_toolbar.tbr
  • customer_toolbar_alternate.tbr
  • customer_group.grb

    0 Z: D  q  C, [# M6 ]7 b

0 e' E" H6 }2 O$ ?  C
  R6 E9 B3 T+ w# a% n9 @$ x: f举例如下:
, `- I7 O+ W7 i4 x& f8 ^6 I3 b( j  _1 ]1 g/ }( l/ H

' F" O, q' J* w$ J' v/ e& K% icustomer_men.men" v! M" u9 B! V$ y
!) `$ Z) V! G- w# s1 T/ Y
!  Customer menu file
4 g+ J0 h" c  N1 j! r! ! o+ a* Q9 Y+ P# R9 G2 Z( |
!  Contains button definitions to be used in
8 d: Z# n# Z' [!  toolbars and Ribbon files
+ C- g% \' x' J: I9 H/ ^!1 s7 q( P% U1 ~+ _( c- z

0 o1 S% {( j+ `/ J- X: X' a, VVERSION 120
1 K$ [; E0 ~# k! ]7 l# F' \
( X4 y. L- V1 k, S6 ~# b: s( \EDIT UG_GATEWAY_MAIN_MENUBAR, R5 b, |5 ]3 B6 x$ w; q
7 ~5 i+ r, @& K: J8 M: d' [
TOP_MENU
3 m& g: s! T1 C$ Z& o  d; c/ O9 E    CASCADE_BUTTON CUSTOMER_MENU. p5 x) p+ z& l4 V: z
    LABEL Customer Menu
! W+ e* y' i  Z# ^6 x+ X5 U; b
1 @8 x- t9 v6 i" v! xEND_OF_TOP_MENU- q  m9 x0 @* u% M, W& x9 S
4 K, F; y; G7 J
MENU CUSTOMER_MENU
! s* w% Z4 Z; Z2 {9 Y9 c
& G) @8 |6 V' o4 m2 O1 P# c4 [9 _6 [    BUTTON CUSTOMER_BUTTON_1
; Y5 o5 x' d# _    LABEL Menu Button1
' p. k" D' t7 |8 L! C+ Q4 O         RIBBON_LABEL Ribbon Button1
/ p: C- \. n' h2 ?( `7 e        TOOLBAR_LABEL Toolbar Button19 I9 G& |, a& n8 r. x
    BITMAP fileopen
& X) D* T. Q" E  Q5 J
3 ^  ?6 _2 l4 S' y/ M: I    BUTTON CUSTOMER_BUTTON_2
+ }7 h, c2 B, g    LABEL Menu Button2
) S. H3 e0 a5 G4 J' p4 I2 u        RIBBON_LABEL Ribbon Button2
$ G. G: A5 i2 S% C        TOOLBAR_LABEL Toolbar Button2
# B; W- z+ B1 Q! R: O' g/ U6 g    BITMAP filesave4 t4 r* x! K, h# K( r

& Y2 @7 E4 m* @# }+ B5 h: k, Q: z8 W3 ?    BUTTON CUSTOMER_BUTTON_3
, I4 U' v4 |( |    LABEL Menu Button3
7 t& \& F6 P0 I8 z. f9 Y; ^( K        RIBBON_LABEL Ribbon Button3. X9 h5 E; B  n, [/ i" S; O4 I4 S
        TOOLBAR_LABEL Toolbar Button3
+ P8 H. [& J, \, u9 @  w$ }3 Q    BITMAP current_feature
9 V' ?' d: \7 m) z5 a
. g  k% o* H2 u3 t    BUTTON CUSTOMER_BUTTON_4
3 c0 K) k/ k1 J3 @    LABEL Menu Button4
4 y: N' `4 e! Y& C. f        RIBBON_LABEL Ribbon Button4
' G; R+ F* M$ d) n        TOOLBAR_LABEL Toolbar Button4
" v' L8 Y* [/ l0 I    BITMAP block
+ q, g! r* ]& O/ ^! {8 o1 f: b! N: V1 h+ b
    BUTTON CUSTOMER_BUTTON_5
4 U/ n$ ^0 D& w! E9 S( g! o8 d2 ^) \& P    LABEL Menu Button5
$ w, i+ p5 q; N" i3 J2 `        RIBBON_LABEL Ribbon Button5
- Y3 w$ D( B2 {3 S; s& U# o        TOOLBAR_LABEL Toolbar Button5
. u2 }( X6 d5 r* p! _# y! F: i3 \    BITMAP checkgreen
6 ]0 v5 p% Z( B. \  G& H- ^% v! k  P- D
END_OF_MENU- E9 W0 Z6 w2 U6 A) L( z  o
4 B/ s7 r6 v; W! D& R, }

; M; W, |& y' {0 o6 F( O% J, ^+ Q3 @5 J
customer_ribbon_tab.rtb
! U# q6 q& Y1 ^% ~) G1 s8 I!$ T1 v* @, W9 w2 n9 h, v
!  Customer Ribbon Tab
6 K( a! b3 K" w" I6 y$ F  w8 W!
0 C, v$ L! c2 n3 h, j* ^. t!  This file will create a new customer tab containing three groups and7 \  ^& M" n# n6 n2 K
!  one top level button.4 K; r. E0 W8 Z0 [* K" f7 o
!, {+ _+ |" _7 S! G, X; [: b$ l

$ Z- e! g" ]2 N2 L4 wTITLE  Customer Tab
$ S) y* j4 h8 l/ ~6 i, ?$ P) nVERSION 1705 g& T) ~( L# w; {
2 Y  E: h+ _! F. R9 ?4 n! D
!  The first group represents a Ribbon group that references an existing ; [: [, m0 v2 ?4 Q
!  toolbar with no Ribbon style changes.  * f8 Y. L1 D1 D8 @  [% e! v' G
!
. h! Q6 C$ {, z6 F!  This is the quickest way to add existing toolbar content into Ribbon mode.: Y1 k  m5 T5 I/ V0 c, b
!
+ S8 i" M7 Z& w. v- z2 GGROUP  customer_toolbar.tbr- X& r$ m$ Y9 C2 A( w

1 z! J# w& H4 ^5 @" @/ ]7 P# O!  The second group represents a Ribbon group that references an existing
" H0 C5 {6 x/ D. x!  toolbar with Ribbon specific style changes added to it.  There is no difference4 N4 d4 G$ n) l1 S% Q
!  in how this toolbar is referenced in the .rtb file compared to the first
# }/ i6 j# l$ v5 s7 o7 n( q!  toolbar as a group.  The only differences from the first group exist within , f6 g& [) C1 I: p' ]! c
!  the .tbr file itself.
6 t) v9 q0 J+ {!
+ Z1 w8 W$ y! d' Q6 H& w!  This approach has advantages for customers that will deploy both Ribbon and4 E  X/ F5 Z4 F
!  Classic Mode customizations since all the content is defined in the .tbr ( Y3 ]7 ]: k9 a% D& K/ W& H  R) M
!  file and it will stay synchronized in both modes.  Only one set of customizations
# C' E) r; }" O!  will need to be maintained while still making use of RIBBON_STYLE to 6 y) M" |: o6 m6 Z
!  control the presentation of the buttons on the Ribbon.6 w% @, B: j( P5 {# O0 \  I
!
# v& z# ^9 f+ `& Q8 R7 h; [GROUP  customer_toolbar_alternate.tbr
$ m( c* x0 H! H
1 H5 c: w, K+ y' U3 n$ W0 f# ]!  The third group represents a Ribbon group that has been created explicitly: g2 R6 n( {  C* |8 J4 r* s
!  as a Ribbon group and will not exist in Classic Toolbar mode.  This is the. [3 m* c+ w& A! @, n5 U% C
!  preferred option since the user will be able to take advantage of all the . i2 O' W" S+ Y1 _8 |
!  layout styles and containers offered by the Ribbon.  4 W, [% K0 G9 X4 e# @: L6 \2 \' ]' R" x
!
# e5 ]( D1 X. q! V  m2 r!  For customers that will deploy both Ribbon and Classic Mode customizations,
$ n# P* b5 S: Q- T- M% S5 Q4 K!  this approach will result in no synchronization and two sets of customizations
2 T$ ?1 r! k& P. f& C!  will need to be maintained.
- l7 G4 B/ _- m!
- Y4 t1 o8 I" y/ r8 W) s$ T!  A group can alternatively be defined directly inside the .rtb file by using the
. m) f) ]% J" j4 l!  keywords BEGIN_GROUP and END_GROUP.  ; o0 y# L7 l. J3 v9 x2 C0 a! V
!
% E" A. }& O3 Q4 G( I1 }7 L; E! H( oGROUP  customer_group.grb
$ f& `1 n- i5 b' u& |
! Z1 L) M; \' `  X!  Example of a button that is placed directly on the Ribbon without being
# [3 l8 f/ k0 T+ O! D: N!  contained in a group.  This is a simple way to add a button to a tab+ B5 @. [; M2 A5 n, F: c
!  but is not recommended for many buttons since groups have advantages.6 Y, r" ?4 q6 ?  v1 ^" I
!  
5 P6 W+ g2 h& J( c" I* a!  A few advantages of groups:. F  M" @( }: H
!     1. Easier to move many buttons around together in quick customization.  1 [2 ^" o! x9 x( K1 A
!        For example, MB3 on a group and choose "Add to Left Border Bar".  
1 F* H! E: ?$ O9 y1 g9 S% F!        This will move the whole group to a new location.  If buttons are
# a+ B) i- ]2 H5 G7 p8 _, c!        not in a group, they need to be moved one at a time.& V& H# c- w# h# c
!
' q. D0 y' ?( ?$ _0 e9 Y4 W!     2. Provide a label to describe its contents.; k+ z/ I3 c+ ]9 g
!
9 I7 p7 {" H5 a  ~BUTTON CUSTOMER_BUTTON_1
) [* [3 @) n$ \) e# m6 K2 sLABEL Button1 Directly on Tab
* O" @4 u( n4 z1 V: `1 Q) S, a) T; r" R: V; Q9 B. I& F5 F, h9 X

1 k) c9 o8 e$ j7 B9 E8 A
; g8 ]' G- P1 E1 k5 t& c: @customer_toolbar.tbr  R1 l+ u8 h+ b' Q- R
!
0 N$ W0 e& q7 O, S' a; }!  Customer Toolbar File- H1 A% D7 I$ v4 ?! X7 q/ ]
!3 @5 ~5 E( J3 r4 y& f
!  This is similar to an existing toolbar file containing
; J9 R. p; }7 o5 D!  no Ribbon changes.
% ^" n! ]- Z8 B7 l+ U!
) q' F  ?. s4 d/ m!  In Classic Toolbars mode - This toolbar will still show up in the
2 }4 T* K0 E6 m% u2 {  y!     toolbars list.( \9 i1 m5 A( r- ~2 |2 c3 |
!: ]! V/ W' @; ]( p8 \3 k& a
!  In Ribbon mode - This toolbar will be automatically converted to a
1 t5 Y' k5 `. _; J, T" E3 ?!     Ribbon group and will appear in the "Classic Toolbars as Groups"
+ e: ]0 X$ @/ n- r!     section in the Customize dialog.
9 d6 b  b4 \2 \7 v/ g!  ' G4 |/ W) `) @

2 W  D0 I  \$ A, |' K9 v8 JTITLE Toolbar* e8 q: @' Y; ]
VERSION 170
) U1 A% m- N8 x  X9 C9 B0 x/ r1 ~- X- K9 l& M
BUTTON CUSTOMER_BUTTON_1
. D2 v  A8 }! U5 @1 a
7 e) \3 r7 i' V) e3 c% DBUTTON CUSTOMER_BUTTON_2
+ [" R/ `4 n9 Q& k/ E/ ^' d' I  @) x) h1 x) K8 P1 B" y
BUTTON CUSTOMER_BUTTON_3
/ _: [# [( Z' t* w! Y& z1 o) z( _! G8 l* n3 [) L4 d
BUTTON CUSTOMER_BUTTON_4' V9 o# t; M# ?6 N

6 t& y4 P% P1 j. j& v! D! @+ oBUTTON CUSTOMER_BUTTON_5
. V, D# d& v3 E3 X' [9 g5 y9 [0 g# C( X
# r7 S! Z& g, h) b- Q7 c

/ {5 b: `2 P, j/ I4 s: d9 gcustomer_toolbar_alternate.tbr
% Y8 h- p$ S9 E; \5 u( z!+ q5 ^+ W& d* `# }
!  Customer Toolbar File (Alternate)
6 P2 L& n; f" \; Z/ z- }' w+ A!
8 t7 F. s. i6 m" v2 [!  This is similar to an existing toolbar file with new
' H6 v( g- v& ~* @!  Ribbon styles added.
0 g# ]9 h0 W! i8 @$ M# Q!  
; r1 z, m+ |, Y. f!  The RIBBON_STYLE will be honored when the toolbar is loaded ' t/ h& t! Y0 n- C2 Z  O& \. ~& S
!  in Ribbon mode as a group but will be ignored when the toolbar % u4 _( n5 R2 l! U& T
!  is displayed in Classic Toolbars mode.  S8 `- a5 A" I1 Q1 ~0 W* ]
!
0 j- p; ~& _, v4 ^2 @- @, P!  In Classic Toolbars mode - This toolbar will still show up in the 7 z1 I) ?* ]) e: P' i
!     toolbars list.4 b  f) D/ g5 z& e1 {+ u$ s
!, Q# \& v2 Z; u" B+ j+ V
!  In Ribbon mode - This toolbar will be automatically converted to a
9 w5 c' }; P! Z2 u& `5 F/ ~3 G7 U!     Ribbon group and will appear in the "Classic Toolbars as Groups"
, R+ Y* Q, y& o!     section in the Customize dialog.: ~6 T5 ^# P* O- N& ]1 C9 r
!
, n* Y7 @% v+ h3 s( [( G* q2 S4 N7 `3 Y  u( e; _( x
TITLE Toolbar (Alternate)- z5 e& c0 X  I- O2 A: T3 J% |) o% W
VERSION 170! X/ T: {$ i1 e. V

: b% e2 V& v# ]" M1 N- hBUTTON CUSTOMER_BUTTON_14 Z. h! s' J- s  ]4 j- C0 m/ o
LABEL Toolbar(Alt) Button1
. b# F( F% g' d! K  g$ _2 CRIBBON_STYLE LARGE_IMAGE' n2 f. a% ?$ N5 q

* G9 [+ @8 t6 ]+ r( Z2 F' U$ TBUTTON CUSTOMER_BUTTON_2( N: Y$ _3 {2 |$ W. g* Y) \0 g
LABEL Toolbar(Alt) Button2$ P( v$ X- }3 M" N( b1 ^  ?
RIBBON_STYLE LARGE_IMAGE% N0 s( `: Q: H

& f2 m" S, Q9 Q* T1 r# iBUTTON CUSTOMER_BUTTON_3
: L7 F) q2 ?5 QLABEL Toolbar(Alt) Button3
$ w2 Q# c& W& n( iRIBBON_STYLE SMALL_IMAGE_AND_TEXT
* N( d1 y& |3 z5 i5 _" C& C% V& J6 Z9 B7 S4 F9 F8 a) \) s
BUTTON CUSTOMER_BUTTON_4: k9 ]+ i+ Y, l1 o' z
LABEL Toolbar(Alt) Button4
, c9 d5 B: k6 t" U2 ^3 O$ nRIBBON_STYLE SMALL_IMAGE_AND_TEXT7 |" `# n/ R% R) A5 J. ?
$ s# J5 E" p3 I, T& l/ }) V* ?
BUTTON CUSTOMER_BUTTON_5+ k! n& X& E7 X! u+ z# u9 r
LABEL Toolbar(Alt) Button5
# m( E1 W9 _5 ]2 r0 P; ARIBBON_STYLE SMALL_IMAGE_AND_TEXT
& v2 L  _# C" H$ h3 d. d* b) Z0 F
1 J6 I" ?5 O( W; m5 y8 H0 i6 C# H) m
# n" x- O) Z) Y) g
customer_group.grb
2 S) U6 U* R  n!
6 h( O+ _( r1 }8 ^! ]: W/ H4 B!  Customer Ribbon Group File+ K( j6 q) [9 G, V3 O. F+ W/ Y
!
0 c, Z7 z% t3 K& M5 @$ Q!  In Classic Toolbars mode - This group will be unavailable2 O1 P! G: x! c9 s. @" l
!
2 j, s1 u8 x6 H" o9 h7 D!  In Ribbon mode - This group will show up in the "All Groups" list; d6 Y) ]5 M1 Q$ T' S# ?
!     in the Customize dialog.
: d$ b+ \9 j, `) t1 p!1 E0 e) N7 `7 f; Q8 |
!  The labels of the buttons are defined using the RIBBON_LABEL token in the MEN files+ G9 H- G) d: k" \' w9 G+ L
!
/ b) b& Z9 o9 L; g% H; w+ j3 G8 M6 M: @
TITLE Group' |& v# n9 x( p- A* ~( ~; g1 r
VERSION 1709 P4 O( O) |8 O# I2 O; a5 @
% j* B9 r" o2 U5 `6 F
!  No LABEL defined, using RIBBON_LABEL defined in customer_men.men( H  ?- f4 U* p% `& f' B9 _; Q
BUTTON CUSTOMER_BUTTON_19 G3 Z$ a/ h( S/ I) h7 c, [: ]3 ]
RIBBON_STYLE LARGE_IMAGE
# r1 T6 [# V5 w) C9 y1 r! j/ w8 z: Y0 Q
!  Example of a gallery defined in a GRB file.
, d/ j) ]5 N# ~- o/ o3 C! & P% ]! k) B6 C( i) q
!  If this gallery is to be used in other places, then it could be
* P4 i  m) X2 K. o1 }1 n0 g0 J!  defined in its own gallery (GLY) file and referenced here1 b4 e7 Z: G. S' u* y
!  Example:
" n6 n9 @  t) k5 I!    GALLERY customer_gallery.gly3 t8 |6 ~: D" g& v- w
!
% E: ]/ Q' K* n& c: L+ d( tBEGIN_GALLERY  CUSTOMER_GALLERY3 {/ o5 H& s7 I0 b
COLUMN_IN_RIBBON 28 v8 y$ N; Y& g8 h. O" }
COLUMN_IN_POPUP 2
* S7 ?7 U* z9 z2 }! l. gLABEL Gallery7 i, M) o8 P5 F/ q
GALLERY_STYLE MEDIUM_IMAGE_AND_TEXT
2 \% ]0 q9 ~/ z% h7 z, z7 u* I6 x3 h5 q1 x$ O) r
    BUTTON CUSTOMER_BUTTON_21 G$ F# N7 p) [( ?" J: M0 Z0 o4 u! t

1 j7 I8 I0 i0 [    BUTTON CUSTOMER_BUTTON_3
; o" F- Y5 V  m" m$ U% s
3 v. X. b3 |8 q* n    BUTTON CUSTOMER_BUTTON_4: I7 X& ~+ `, s( D6 R
$ g2 Q2 M5 M8 g4 s, p
    BUTTON CUSTOMER_BUTTON_5
/ l7 L# n# Z7 |3 [6 i  ]$ a6 |7 ^# r8 i# z$ L' J5 E
END_GALLERY) G, u3 A: E; F8 j9 L
: F1 m; |9 s' {0 l5 o5 ]5 g

$ [6 Y2 g" R. |) x/ Y
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了