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

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

[复制链接]

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

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

admin 楼主

2015-1-9 10:37:48

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

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

x
关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧
8 ]$ n* O1 C) }& M( f$ H

经典界面到RIbbon界面转换

经典界面到RIbbon界面转换

- V& Z$ G8 S0 j7 m' s8 A9 w在经典界面下,需要的文件
! D) @4 e& y6 V; H
  • customer_men.men
  • customer_toolbar.tbr- @& l! o# X0 g: a' `
在ribbon界面下你可能需要的文件 : A+ t: r9 y1 l7 F. L
  • customer_men.men
  • customer_tab.rtb
  • customer_toolbar.tbr
  • customer_toolbar_alternate.tbr
  • customer_group.grb
    ' {( r- E) T0 @
) j* l  r* E  b. r' b

7 F2 Z; D! ~( T% g' I  s举例如下:
* y/ U/ e) I- j) _9 S3 F6 u
! o* @! Q1 O! _$ _
( B* X4 G0 K; H( l6 O0 mcustomer_men.men6 L1 |( q# O3 a! M2 ^
!
( B1 e" ?/ ?* B- s; n0 w% b!  Customer menu file! i  n( h0 e3 U# k' h. o+ W; e
! . N3 L8 Y5 N( R- @* v# L5 x* I& V
!  Contains button definitions to be used in
* l& `0 |3 W  E6 K/ G* ~' X!  toolbars and Ribbon files( t4 S. p1 T7 F
!
8 ]# l/ |5 J! s- E! q! t
0 j; d3 X# b) v$ s" X5 W( v( B  ^$ M3 lVERSION 120
5 T) ~" K' Q. U& m- c5 S
$ t$ d0 t& ?8 p5 t. GEDIT UG_GATEWAY_MAIN_MENUBAR
9 p2 R: N8 {& x+ B- q
3 h& q+ ?1 u' a: s" v, mTOP_MENU
1 ?. [8 }" _7 V# N    CASCADE_BUTTON CUSTOMER_MENU4 g" s: R2 W3 D
    LABEL Customer Menu
0 v# N0 x7 k5 Z# ]3 W& a5 Z# r# O( w7 |+ x* y+ X0 z- o( j
END_OF_TOP_MENU8 \+ w' u& |& A3 X( ]8 ^1 ^

& D0 K' S: S! e5 o3 [MENU CUSTOMER_MENU2 Q7 ]; i5 a& @& l' K1 V4 c  n
5 V( k# A" S! a4 c# W
    BUTTON CUSTOMER_BUTTON_1
# C) B6 Q- Y% {- K    LABEL Menu Button1
6 Y1 M4 O) j' O2 M, H/ }. u" U$ h         RIBBON_LABEL Ribbon Button1
! d3 y- d) c% ~0 H7 X* B$ E        TOOLBAR_LABEL Toolbar Button1  @" l; P0 X7 j; @. V
    BITMAP fileopen
  }2 v- d6 G% Z: x3 |# e5 x# a' H# A* W( h4 c+ J$ r* T# U+ C6 @7 N
    BUTTON CUSTOMER_BUTTON_2" d$ Q  u% k  P( Q' f% ~
    LABEL Menu Button25 _/ B6 _9 w& p. P+ d
        RIBBON_LABEL Ribbon Button2
( o+ F) U. j' T/ N9 [( {        TOOLBAR_LABEL Toolbar Button2# U# Q: N) m+ T" g2 \% G
    BITMAP filesave7 v0 Z! \- x, m

! ?& K' I$ D, Y( R2 `% K/ @    BUTTON CUSTOMER_BUTTON_3; c5 s) Q0 w( r' k/ p# q+ N% \
    LABEL Menu Button3
. O  W) O0 T% l/ z, y% L        RIBBON_LABEL Ribbon Button3
. o; c% [1 f3 B        TOOLBAR_LABEL Toolbar Button3; W8 a+ H0 \$ O0 K+ t, @0 P4 S! U
    BITMAP current_feature+ }" G, X+ V9 w$ m1 G

" j; ^# J8 b3 U1 f* [    BUTTON CUSTOMER_BUTTON_4; O! [/ C0 p. H# l6 w) V
    LABEL Menu Button4/ v% n# x4 C* F
        RIBBON_LABEL Ribbon Button45 H, g! a6 q7 Q# q7 M, T. T6 F: z
        TOOLBAR_LABEL Toolbar Button4$ G( I! h3 w# L& m
    BITMAP block$ y8 g1 v& k4 I1 Z

! O# g5 k: [. F. Q    BUTTON CUSTOMER_BUTTON_5% W4 P- ^- N) n
    LABEL Menu Button5
- m+ |9 r7 h2 k! m0 _: b        RIBBON_LABEL Ribbon Button5
7 y7 \) z+ L' i, X        TOOLBAR_LABEL Toolbar Button5
/ [# Z, P6 Y% J6 U$ J    BITMAP checkgreen
# R( J, r& Q, i/ r
( m& B( M4 L' T9 k* W: p& j; mEND_OF_MENU. }+ s- K4 F& i$ Z
4 h. F: [8 F/ \+ V/ F- o1 h

0 l: h! G" L  P" X* T( n4 [3 c; E* ^6 X& G# g6 L
customer_ribbon_tab.rtb
( Y5 F1 L: N. V" N& N+ u!6 i; w* u. z+ M1 n+ F  T6 p
!  Customer Ribbon Tab2 Z$ H  u+ k0 c) t# U( ]
! , }- l5 C; ?8 k8 d
!  This file will create a new customer tab containing three groups and* }4 q+ F* B# x+ {
!  one top level button.
0 D" M. r1 f* P" o! |+ l# a. o!0 T# C+ K3 m$ G( v

& ~* D- x7 a' x1 G' f4 [8 JTITLE  Customer Tab
4 ^% S3 Z7 t6 e* WVERSION 1702 z# ?" E* ]) O, {- n5 t
+ u' C) H* b& g+ v) i* m7 u  H7 e
!  The first group represents a Ribbon group that references an existing ( l  h( Y8 v+ s" E
!  toolbar with no Ribbon style changes.  + g* @# U( i' A
!
7 K- ~' v4 a2 X3 w!  This is the quickest way to add existing toolbar content into Ribbon mode.7 c* K3 G* I' Q5 A2 Z% T) V8 |
!
9 [. m- @* r8 ]GROUP  customer_toolbar.tbr. ~" ?- g9 S5 U/ m$ }' Y

. c/ P: q2 d0 ]. T0 r!  The second group represents a Ribbon group that references an existing % ]1 O4 v, P3 m/ k
!  toolbar with Ribbon specific style changes added to it.  There is no difference0 Y0 K! P+ D* H5 H6 |0 \
!  in how this toolbar is referenced in the .rtb file compared to the first
$ P3 \2 q" G: I9 ?  L  {!  toolbar as a group.  The only differences from the first group exist within
- d( H7 i9 |0 Q' a3 h!  the .tbr file itself.
# j6 y2 g8 P" G4 l) _( e!: E# Y* q( A% @: q% t
!  This approach has advantages for customers that will deploy both Ribbon and1 H% f& \( Y2 W( m' \9 M5 N- V
!  Classic Mode customizations since all the content is defined in the .tbr " k, K+ s* U; B) n9 k
!  file and it will stay synchronized in both modes.  Only one set of customizations9 f+ D2 p4 d# \& T
!  will need to be maintained while still making use of RIBBON_STYLE to   _1 t( d$ g& d
!  control the presentation of the buttons on the Ribbon.+ u9 b+ |2 Z) r" d
!
- g+ R; E6 K, G% J# x* QGROUP  customer_toolbar_alternate.tbr
/ k& |7 q! v1 Q" ^% l! e! w& n+ c& ]% \: ^2 C% m) H
!  The third group represents a Ribbon group that has been created explicitly: o# P+ F7 I6 I
!  as a Ribbon group and will not exist in Classic Toolbar mode.  This is the" X$ L& d! F% t. a1 @
!  preferred option since the user will be able to take advantage of all the # Q# S& }& P, h9 N3 }
!  layout styles and containers offered by the Ribbon.  
# J) j. e& H1 H" L. [  w!
4 ^5 G& y5 w3 Z4 J% \% `5 t' T, n!  For customers that will deploy both Ribbon and Classic Mode customizations,
. y/ G  _( P: M!  this approach will result in no synchronization and two sets of customizations * \: J) w" a* r' u$ ?$ V7 V$ o9 z
!  will need to be maintained.
8 U! j0 c' |' I1 i+ A, x5 G+ `!
0 p4 z0 _+ e, x% I!  A group can alternatively be defined directly inside the .rtb file by using the
9 Y5 ]) N( N( U) o!  keywords BEGIN_GROUP and END_GROUP.  
. b9 \0 \4 z- J2 f1 s2 b!3 k0 X3 \& Q0 d) y
GROUP  customer_group.grb5 t; B: V8 ]" [3 l  F  n

/ u: G8 x% G8 s!  Example of a button that is placed directly on the Ribbon without being
# Z$ h3 k7 r6 D- k6 M9 t6 F4 A!  contained in a group.  This is a simple way to add a button to a tab
3 i1 ]3 ?' f- r+ D# B# Y# [+ I!  but is not recommended for many buttons since groups have advantages.; e8 |. p, j+ {, F+ n2 u
!  , X  i0 p9 z, a& o; X
!  A few advantages of groups:
, I5 D, o; J" q+ \) X: E) J. I!     1. Easier to move many buttons around together in quick customization.  5 t" p2 l% u) c
!        For example, MB3 on a group and choose "Add to Left Border Bar".  
3 R2 {  _1 C$ B8 C3 m!        This will move the whole group to a new location.  If buttons are
1 G2 w: j) R; @" H4 `) t+ ]5 z!        not in a group, they need to be moved one at a time.
3 n7 f0 k: v4 E" T( d  c!1 o" h2 v7 W7 G# y! j
!     2. Provide a label to describe its contents.3 V7 m' D5 d- M9 z! D
!
, T2 w, R3 {5 Y" S% M1 h! ?' ?BUTTON CUSTOMER_BUTTON_1
6 x" k2 S$ }2 a) D- }! yLABEL Button1 Directly on Tab
8 Z. p- l3 o" Q" l& Z* l
6 k5 j. g+ z" z+ o% c' [, X9 ]; Q( y5 h* U
; J( @& P" @) [, e" v4 h2 |9 f7 U
customer_toolbar.tbr  b: q: l+ L5 q3 I8 x7 V, b
!" e: P# I; u6 Q6 @5 {
!  Customer Toolbar File: V( s% Z# ?1 p* n3 M- y7 w$ q; r9 v
!
# ^' ?2 i. ?( |( q, X" }!  This is similar to an existing toolbar file containing
$ j. q1 Q) P8 ~' N* j& d: e!  no Ribbon changes.' L# H/ M0 v% l. W. W& |
!8 f  e% N/ h1 `& }  Y, F0 Y
!  In Classic Toolbars mode - This toolbar will still show up in the
5 K' \" C/ [1 o5 C!     toolbars list.3 ~9 U8 m, h8 D# q/ X
!
( o$ N, C) p! X4 e, K!  In Ribbon mode - This toolbar will be automatically converted to a
& W* |# T! s) Z4 I!     Ribbon group and will appear in the "Classic Toolbars as Groups"
. I$ R3 j3 t( K8 x: w8 }!     section in the Customize dialog.
9 k# s* i5 k* ?2 W5 h!  
" g1 g5 i5 m) M: u8 c% p5 s" U: G1 o' I) a7 d! Q4 d8 }4 X
TITLE Toolbar
/ G; j0 P& R& e+ n; o3 qVERSION 170
& V8 |4 O9 X9 f3 O, Q- h1 a1 d$ _  a) N+ Y" |0 g! O9 H
BUTTON CUSTOMER_BUTTON_1
+ W8 e1 F9 F/ Z( x1 k
' K. v7 _# M: S& x+ ABUTTON CUSTOMER_BUTTON_24 Z5 c  a9 e0 |/ N' E/ P9 B
( e) x) j# `. I
BUTTON CUSTOMER_BUTTON_3+ B4 s" W3 W7 d# [* O' Y
: g/ w* |7 C8 p) L8 k
BUTTON CUSTOMER_BUTTON_4' _- r' |" c6 D  z& z% ^
  |6 D, ^$ g3 O, `& V3 y
BUTTON CUSTOMER_BUTTON_5  `8 C7 @# e. p
. }$ a% L; Q: c5 J9 [& p. R5 U
. g$ h: T+ @  M9 s5 V# c( j& ?
; |3 o9 b# {; b* r; I9 Z
customer_toolbar_alternate.tbr, G# }; F+ P" e: {; q$ c. {
!
9 G' c$ [" M3 U  W; x7 _9 q% q!  Customer Toolbar File (Alternate)
4 e0 ]" M% A8 I% z5 M: F# D!6 v1 u* E4 W- r$ X
!  This is similar to an existing toolbar file with new) U3 e* c1 C$ }
!  Ribbon styles added.3 d4 A4 I+ e; C
!  % t4 n4 Y2 W' w
!  The RIBBON_STYLE will be honored when the toolbar is loaded
5 O- U0 ]1 f3 Q3 f/ e' _!  in Ribbon mode as a group but will be ignored when the toolbar
/ Q. |9 R7 @% I0 }  L2 o9 O!  is displayed in Classic Toolbars mode.
8 Y' g- c: p, |!2 z8 a4 E0 [% e7 N. k" v
!  In Classic Toolbars mode - This toolbar will still show up in the 2 P$ g9 p  |5 x6 f
!     toolbars list.
! Q! D7 V, C! m!* R$ F" [& |/ p/ I) U$ R* _
!  In Ribbon mode - This toolbar will be automatically converted to a % M( P" t: A  q- s! s  h6 e6 N
!     Ribbon group and will appear in the "Classic Toolbars as Groups"
6 m& ~) q! _, H; S$ B9 e!     section in the Customize dialog.3 ?6 ]1 ^+ Q8 c9 M9 Z
!
6 \" S2 y" u- z/ ]" x& v) F
, t" h1 o" S6 H! Q  f" F/ qTITLE Toolbar (Alternate)/ Y6 x- @) L+ z! M/ W% j. l' }
VERSION 170
% \/ g. T# |& r0 n* T5 Y' W# h; M& }* Q2 Q1 k3 ~; H8 h
BUTTON CUSTOMER_BUTTON_14 M$ V9 N1 H8 L& U! h4 k
LABEL Toolbar(Alt) Button1
3 j# s1 M9 h/ I" H7 w2 ^4 GRIBBON_STYLE LARGE_IMAGE
; j8 q, A* K& i3 _* \( K7 d) L; I2 \- X1 z! G" R
BUTTON CUSTOMER_BUTTON_2! [, W% w  l5 b( {! T9 c: o+ J
LABEL Toolbar(Alt) Button2, ]4 v. `* v* E8 i* f1 s3 e. j
RIBBON_STYLE LARGE_IMAGE, {( v8 S6 Z% j* ?  D6 g

. I' ]4 [% u& K; iBUTTON CUSTOMER_BUTTON_3
& [( X5 U" C, E/ R' \& m9 A. NLABEL Toolbar(Alt) Button3
! |; W1 @/ P# t% r6 T) o% U9 KRIBBON_STYLE SMALL_IMAGE_AND_TEXT
' j) o' q* w# M8 D4 y4 z
+ t7 O& f( a8 I7 G; ~5 pBUTTON CUSTOMER_BUTTON_4+ q5 l& U: k/ ^& P
LABEL Toolbar(Alt) Button4* u, J; m- F/ d9 W+ D) i- y& d; D
RIBBON_STYLE SMALL_IMAGE_AND_TEXT
# i# O+ _2 T" c3 V- u+ Q& r3 \+ P
- j2 U5 t4 x% M( ^& }! pBUTTON CUSTOMER_BUTTON_5
3 F/ r3 ~1 {  ?# \0 J: LLABEL Toolbar(Alt) Button59 Z, L6 s8 o/ m: J+ U
RIBBON_STYLE SMALL_IMAGE_AND_TEXT" o+ D; A7 k, W; E* A4 b5 Z3 K: r, ?

+ }% @+ q2 f, R) g, o$ @/ V, T
. F2 _5 E+ \0 r# l) @& x  v4 G+ M+ L" N! M1 u7 s! i
customer_group.grb
& X6 l- N7 T8 j. B& l3 ~/ Y!* o" Y/ \7 L3 |* D
!  Customer Ribbon Group File) C) A3 x! c' ~" f% L
!6 ^4 F8 u/ M" p1 Z+ z
!  In Classic Toolbars mode - This group will be unavailable
2 n1 t' m, Q4 Y$ y' E!9 t. N" O6 t$ G2 b$ o
!  In Ribbon mode - This group will show up in the "All Groups" list
8 A. n4 T' b$ C1 ~!     in the Customize dialog.
+ q, b! o* C# g+ b!0 `' f% x9 p3 \( L
!  The labels of the buttons are defined using the RIBBON_LABEL token in the MEN files
0 \. q( O8 M& ~" G( Z) J!: s: ^+ s5 ]& j7 z/ g0 W

2 n2 C/ l  U: |TITLE Group9 B1 g3 }1 w4 Q, O' `
VERSION 170& T9 q, |3 `# }3 Q  r: _/ n

. h9 b0 c6 N, Z; n8 x% _!  No LABEL defined, using RIBBON_LABEL defined in customer_men.men, Z8 d8 @% j8 }: k
BUTTON CUSTOMER_BUTTON_18 v1 p5 A( z) o* L0 t1 r
RIBBON_STYLE LARGE_IMAGE  }3 S1 _& O7 W5 l

- x0 X4 z" `9 ^- A7 `4 Q/ n- w3 X+ V!  Example of a gallery defined in a GRB file.
' x7 p' G6 y( u8 d& D!
1 o6 A3 p, w; V8 ?!  If this gallery is to be used in other places, then it could be 6 I' \% ?% A' x$ D$ j, j0 s) @
!  defined in its own gallery (GLY) file and referenced here! o4 E3 ~1 Q9 C
!  Example:
/ y$ i+ T5 y1 e9 J& e2 b# E!    GALLERY customer_gallery.gly& V! W  d8 g4 h9 }3 T
!: q- f3 C' M5 c
BEGIN_GALLERY  CUSTOMER_GALLERY; c+ e  ~: d0 @; Y! D& n
COLUMN_IN_RIBBON 2
4 {! s2 O) P: p& S& I  TCOLUMN_IN_POPUP 2* }4 t/ o7 a6 D
LABEL Gallery( J' g6 ?$ }- ]0 W
GALLERY_STYLE MEDIUM_IMAGE_AND_TEXT
. @% s+ i! P$ F6 I" `7 e; {2 `0 g6 C
    BUTTON CUSTOMER_BUTTON_2  Y! i$ ?0 K# R9 Z$ H$ _6 W! k: n

1 Q7 C/ X( ^/ E+ P" `0 {1 ?& F    BUTTON CUSTOMER_BUTTON_3
& C5 C/ E! h6 j' x: O! Z* ~9 i' A2 \
: f  @& k( R% D, M# d0 G& H/ h    BUTTON CUSTOMER_BUTTON_4
" b/ |  E8 C/ r& A) @# u9 B9 M) w$ U6 i% z" z
    BUTTON CUSTOMER_BUTTON_5
- @! I7 W2 D" `# x/ w
' }& d  i( Y6 p0 G( I4 gEND_GALLERY
* g( B2 p5 F! z% z) D4 e( Z3 r4 f7 B2 ~/ Q8 M
1 K2 z7 \, a; m6 F) j; A7 Q
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了