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

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

[复制链接]

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

2471

主题

1276

回帖

8万

积分

管理员

PLM之家站长

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

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

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

x
关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧
& q- w, C+ D& H

经典界面到RIbbon界面转换

经典界面到RIbbon界面转换

, A! ?6 f+ {; r& E在经典界面下,需要的文件  X( B: X; n8 i( X& ]6 i& O
  • customer_men.men
  • customer_toolbar.tbr
    4 W7 s" V- l. x0 K: V
在ribbon界面下你可能需要的文件 - p8 M" p6 Y- ]: {
  • customer_men.men
  • customer_tab.rtb
  • customer_toolbar.tbr
  • customer_toolbar_alternate.tbr
  • customer_group.grb

      o( e3 z* p) i. `

2 U3 ?: x& [# y$ ~; ~! A" r$ H
, B$ l: y" {9 H/ y& U5 P5 L举例如下:
" q- I7 K. U% l$ d# s7 p( e9 C. {7 i7 A- I- z" L7 d4 v* }
  c% g: y* j! g
customer_men.men" A1 E" ~9 q4 A2 T* B; T* F
!
$ _) N) ^/ z6 T$ S; `/ V!  Customer menu file* {# ]; w* d) t6 k
!
2 d9 u: [  D# a, `+ n7 x!  Contains button definitions to be used in 5 C5 w0 F% m8 `' w- S5 [  T- l( m
!  toolbars and Ribbon files0 x' ]( H% p. q& M# {
!
1 Z6 q4 O+ d1 C. g6 n) |8 z  f1 X4 V& \" k
VERSION 120, h6 ^0 b% |7 R. ~3 T5 k8 p

" m, `3 r( E& ^: bEDIT UG_GATEWAY_MAIN_MENUBAR
  j2 |4 e! ?" V  s2 D. U
  X7 `. K, F7 rTOP_MENU
, C+ }" ]1 V9 w4 h. B    CASCADE_BUTTON CUSTOMER_MENU3 n' U( S, m& n2 F4 T
    LABEL Customer Menu5 Z% f+ v( ]5 y; y& j9 M
& N8 }$ T- |& E' T, m9 e
END_OF_TOP_MENU* o- a/ i' R" m* j) M
0 ~+ D$ q- L: ?  N% @9 M/ a% P
MENU CUSTOMER_MENU. _" m$ W, P1 R5 z2 P

$ D& X4 j4 f! }1 [) A; w7 P! V# `    BUTTON CUSTOMER_BUTTON_1, X/ n: ^+ O3 }, W, z4 _
    LABEL Menu Button16 Z: J7 W0 d" I2 H" Q
        RIBBON_LABEL Ribbon Button1
. o; @! w7 a# ~7 o        TOOLBAR_LABEL Toolbar Button1
7 q, c0 U% g3 q6 x( B2 L    BITMAP fileopen. ]; _0 I0 Q  H1 I

8 o6 e! ?4 z- _2 |1 }0 Q, @    BUTTON CUSTOMER_BUTTON_2
: G/ H! |/ r1 _) ~; b3 j4 p, e: W    LABEL Menu Button2
# j8 I+ L1 M. C5 p$ s0 ^        RIBBON_LABEL Ribbon Button2
) O1 \4 H8 m$ A. o6 g6 [2 y        TOOLBAR_LABEL Toolbar Button2
- y2 l2 d5 Q2 ~% Q& [    BITMAP filesave
# k* p- ~# b# C/ s& x' A5 g2 W
) e( {6 }( {% O8 J) M    BUTTON CUSTOMER_BUTTON_31 u* U+ @* z* q
    LABEL Menu Button3
! @( I7 j% [( s        RIBBON_LABEL Ribbon Button3
9 v) M, i. T, `7 d, w" V        TOOLBAR_LABEL Toolbar Button3
  f% I$ c1 N4 q7 X! z6 ]0 R" g    BITMAP current_feature
) e3 @1 U0 K: ?! o4 u; f3 H" k# U2 u
3 @* q5 @: n" g$ I    BUTTON CUSTOMER_BUTTON_4$ I  \! z  k9 T, v
    LABEL Menu Button4$ \8 Y/ Y9 X8 a9 E! p, K$ I
        RIBBON_LABEL Ribbon Button46 v% e+ g; r' Y$ ]. X
        TOOLBAR_LABEL Toolbar Button4! f0 i' f6 `9 J* M
    BITMAP block; f% \% Q+ \  }6 ?6 D% L
; S" d$ X7 \* a4 G# J4 P! c
    BUTTON CUSTOMER_BUTTON_5
2 N5 \' p6 @4 E) \9 Q  T! ], R    LABEL Menu Button5
, M* K" l. U7 M- ?        RIBBON_LABEL Ribbon Button5$ [6 L/ v8 x  B' z- H& J! |! g
        TOOLBAR_LABEL Toolbar Button5! S' y; f( }2 @" `0 L1 P+ Z3 z0 J
    BITMAP checkgreen3 n! f9 l9 d4 R' O2 y

# C. r' y% L& p2 P5 \! [END_OF_MENU
. w/ N& h( i4 I$ `( l9 _7 ]& t: G! e; R- Q/ M, U

: y( f6 u) k* r8 ?
5 z( d* l2 S; r1 F; y! a* |8 lcustomer_ribbon_tab.rtb  E, S) p3 y# Y% f; e2 q; Q
!
1 ]  L& }' w% p$ D: A!  Customer Ribbon Tab
! ?' M+ M' {7 d3 C% V0 l( J! 9 E9 Y8 @. n4 O% L  v$ L
!  This file will create a new customer tab containing three groups and3 Q2 V/ D! R& N3 J% r; {
!  one top level button.
( f" A% a* {" {6 p' L. }!
; A. R1 G+ f& I2 r$ G- L, B& f% k* z1 c5 B. n% s, e, V9 F$ f
TITLE  Customer Tab) S0 U& u; B* }, _: g5 E' f
VERSION 170
1 f6 j4 w! F) e0 W5 l0 p/ o8 i
" R3 C+ `0 ~: i9 s!  The first group represents a Ribbon group that references an existing & y. V- }, h7 l' L
!  toolbar with no Ribbon style changes.  
" S" c. ?; z8 H* e3 b) j6 [!
) B" ^6 A8 n+ S+ U% X6 [, R0 r!  This is the quickest way to add existing toolbar content into Ribbon mode.# _0 c8 m% r; g! Y9 P
!
- {2 D9 `. Z* A& c/ P8 aGROUP  customer_toolbar.tbr
- P& g1 p7 j5 L% N
) d! ~1 f0 m# w9 A+ d% v& B; @!  The second group represents a Ribbon group that references an existing ! r. n0 d$ {# V
!  toolbar with Ribbon specific style changes added to it.  There is no difference
4 @$ r  h- Z  V" s' p* m' {!  in how this toolbar is referenced in the .rtb file compared to the first
5 \: ?7 Y# |' z) b) }7 S!  toolbar as a group.  The only differences from the first group exist within
* ^5 U& F/ i- x+ e; S!  the .tbr file itself.& {4 w, E  Z6 e+ l0 u  f
!  c9 w) P% t: S! \
!  This approach has advantages for customers that will deploy both Ribbon and+ t% g+ }7 y6 l) [
!  Classic Mode customizations since all the content is defined in the .tbr . v# N0 s, D/ N, _
!  file and it will stay synchronized in both modes.  Only one set of customizations
+ P) c6 k7 w$ M! ^!  will need to be maintained while still making use of RIBBON_STYLE to
# R5 q9 F9 t. `0 Q$ [( M; @  R- q- _!  control the presentation of the buttons on the Ribbon.: d& h2 O: k5 Y. [
!
5 ^; G1 Q5 @9 I; CGROUP  customer_toolbar_alternate.tbr0 K; n% V7 Q- R8 P; S
0 O( ?3 D$ \7 y! y! k
!  The third group represents a Ribbon group that has been created explicitly
- T) f  C1 x. Q! K9 ~% a5 g!  as a Ribbon group and will not exist in Classic Toolbar mode.  This is the
$ E. [) j( b: N% |- m, `!  preferred option since the user will be able to take advantage of all the $ }+ U# S  X3 w+ ?# k8 Q0 N
!  layout styles and containers offered by the Ribbon.  
/ X# G/ W  d. A8 Q2 C* A8 }9 w!
; L" c0 Q+ Z9 x: t" u# s!  For customers that will deploy both Ribbon and Classic Mode customizations,
0 f5 d" H2 u# k8 M8 Z& h& B5 ]!  this approach will result in no synchronization and two sets of customizations - }. t/ Z- W( H' g, g
!  will need to be maintained.$ T% k  n0 ]9 \
!) c6 p5 u6 b4 _: C0 h0 k
!  A group can alternatively be defined directly inside the .rtb file by using the' Y: z, l9 }( _5 B
!  keywords BEGIN_GROUP and END_GROUP.  ; O& ^5 y7 s3 d) Y$ Y. u
!! ~  F1 i$ R4 G/ o% d4 R
GROUP  customer_group.grb: D2 T, j$ p' K2 v% }% A8 _" H! P
$ x3 A/ T* Z, O% R! y- f0 q- J, y
!  Example of a button that is placed directly on the Ribbon without being
& O9 a! n9 F( |3 @8 _/ J% }) O!  contained in a group.  This is a simple way to add a button to a tab+ p3 d2 A% @) j7 K
!  but is not recommended for many buttons since groups have advantages.3 i4 M& A+ [# I  x* \
!  
( c" T0 y" m. e+ m1 M. ]+ G!  A few advantages of groups:
! g, v& T) X& P!     1. Easier to move many buttons around together in quick customization.  
( q5 h4 m  ^9 j6 A0 \!        For example, MB3 on a group and choose "Add to Left Border Bar".  9 f8 i  W5 H8 t9 W+ L! U5 b8 P
!        This will move the whole group to a new location.  If buttons are
* \" {+ c8 a. g. X!        not in a group, they need to be moved one at a time.. C& K) R3 P! J6 l2 i" d9 K1 g
!6 v( z% G2 N: L+ w
!     2. Provide a label to describe its contents.( S6 i5 Z* s  N. [9 e, Y
!
& m6 C" ]# Y% G. O% M5 I. G( KBUTTON CUSTOMER_BUTTON_1
; G6 C8 X% O! r  {/ u. uLABEL Button1 Directly on Tab' g  Y+ V  z, C( P) i) E9 }9 e7 P
6 m3 R9 M1 P" e2 F

! u8 S* H5 |4 h( H" O; o( E& G& t$ W" P# D5 B
customer_toolbar.tbr, E5 w; k& j) P. h
!1 q6 x7 h; h5 y" x
!  Customer Toolbar File
3 }% S! ~% i7 M, x9 e!
' V( y. u( h  P1 u$ {!  This is similar to an existing toolbar file containing
9 [1 |4 v. d! ]; [1 [$ V9 m4 M!  no Ribbon changes.* c- P, I- f5 m6 K- w
!) E$ ]1 g3 M: S: l. V# V* E) B
!  In Classic Toolbars mode - This toolbar will still show up in the
/ I; I7 \5 U. S' G3 I!     toolbars list.2 n8 N" Z% a8 P' C+ c% F
!
, _4 m  ]9 f$ c5 o/ {/ p8 w, D!  In Ribbon mode - This toolbar will be automatically converted to a 9 m& A) B9 ?, U$ X  w
!     Ribbon group and will appear in the "Classic Toolbars as Groups"
! {% i8 ]/ H5 ?' y/ S!     section in the Customize dialog.- F% H0 ~' c/ o5 z8 w9 R0 @4 y* f
!  
# O2 ?+ G6 |; Z$ g7 }
& k" _- G( z; o! f$ bTITLE Toolbar
- G3 A% c! Z" [* sVERSION 170- ]6 m6 |1 E1 S+ L6 z2 J

- X7 _& [" h& o, z9 gBUTTON CUSTOMER_BUTTON_1' c# l# x' l4 b/ v" C+ W. Y  M* T

2 }  P* c) U3 I, b( Y1 X: ZBUTTON CUSTOMER_BUTTON_2$ Q5 |: w9 I0 t7 p% K
9 C( K* d# X8 y# e9 q
BUTTON CUSTOMER_BUTTON_32 x9 ]* j$ O8 t  s! L& S
) H- D$ c5 z3 p, n! G# N( Y/ T
BUTTON CUSTOMER_BUTTON_4
& Y3 D& B% @0 h
. ~' [8 C5 X: u4 K6 `1 }) v0 ~5 j. mBUTTON CUSTOMER_BUTTON_5# U' ]  Z! v, p, L# a% \
* W3 k4 o" [! ~7 L
# e3 V% `5 {7 [0 n# h% S, p+ P
% ^1 \* c5 @" }
customer_toolbar_alternate.tbr
# d# c/ e6 W  q' J/ l+ `!
' l9 n2 H  m/ A( b1 q) z!  Customer Toolbar File (Alternate)
  L0 R9 K, Z" c$ Y0 F, c5 {!8 h  U# j$ g# [. r. L, P( \
!  This is similar to an existing toolbar file with new4 u4 G& c; `. ?1 L- q9 k3 I1 ]
!  Ribbon styles added.
, Z9 b3 r& P! g8 H!  9 F1 ^% A3 w# O7 Z8 v5 S; N' r. O
!  The RIBBON_STYLE will be honored when the toolbar is loaded . P, ^3 \8 Q3 R! Y: j
!  in Ribbon mode as a group but will be ignored when the toolbar
5 Q* p  \7 g% a' g; h! F!  is displayed in Classic Toolbars mode.
, G( I6 w# v6 O8 a!2 ]6 J7 c: w5 U; Y- U8 R+ E
!  In Classic Toolbars mode - This toolbar will still show up in the
8 V/ }/ D9 c5 {3 j2 G* _3 t!     toolbars list.. ^+ e8 D  h& i: S& x7 t. o" G, ~
!
- J( ]; h8 D8 V5 P!  In Ribbon mode - This toolbar will be automatically converted to a 2 _, z5 ^! q4 C" @
!     Ribbon group and will appear in the "Classic Toolbars as Groups"
, p" Z) [- w  d% w& A. S: K!     section in the Customize dialog.- T  m3 W2 _& p+ h
!4 @2 A, t' q. y( ^+ n4 K+ A9 \7 d
! F$ P. v! \) f6 N* N' h
TITLE Toolbar (Alternate)
! V) {& \3 _6 z8 ^5 TVERSION 170
5 w* s* m# B1 e/ A, l: f  [* n3 {0 G/ d  V/ ^9 o* ]+ F
BUTTON CUSTOMER_BUTTON_1  F: n$ ]7 n$ T, J, K! X3 Q" N
LABEL Toolbar(Alt) Button1
: A; \3 @0 s8 N4 oRIBBON_STYLE LARGE_IMAGE! m) i% P! W/ X7 r

# `* ~. Y  b9 U) `7 x4 ^BUTTON CUSTOMER_BUTTON_2
8 l8 Z  ~0 Y, N& J. l+ p, |LABEL Toolbar(Alt) Button2
% c% e' l& c0 f6 YRIBBON_STYLE LARGE_IMAGE9 d$ P: @0 r' k9 N
+ u& Z1 A8 ~- N' s7 Z0 |
BUTTON CUSTOMER_BUTTON_38 {7 Q4 x' |' I8 \
LABEL Toolbar(Alt) Button32 \; [& R9 q: }6 k# b) r- Z
RIBBON_STYLE SMALL_IMAGE_AND_TEXT0 |4 `5 |3 d# \  ~0 A3 }
) b/ X% L; h0 w! t
BUTTON CUSTOMER_BUTTON_4
2 h1 G5 y8 _: t+ eLABEL Toolbar(Alt) Button4, M% H& L/ L) H: c) @7 S
RIBBON_STYLE SMALL_IMAGE_AND_TEXT
. e- a  M' c* G( B% f& {9 c8 d0 }$ Q3 c5 E! i, |
BUTTON CUSTOMER_BUTTON_55 l' m; n& D: {  n( p
LABEL Toolbar(Alt) Button5
2 P( c& B' h$ `# XRIBBON_STYLE SMALL_IMAGE_AND_TEXT
6 \# _4 A( R4 j2 P$ n' m- c3 k9 E, k+ c5 Q7 W
# G7 ]9 q9 S2 I0 |  i" a: c6 Q8 o

3 O1 C6 b" U1 E8 @1 ^# |- pcustomer_group.grb; w! [2 `5 `/ ?4 r7 \) ~  b
!
2 D( Y, N9 |/ I* G, n!  Customer Ribbon Group File
: c6 h. u4 k& T# N( t!
$ ]- y+ u6 u/ T9 V) I, j3 e!  In Classic Toolbars mode - This group will be unavailable1 F$ P2 E5 s- E2 M
!
" m9 p7 `5 c  w6 a8 a) V; v% F!  In Ribbon mode - This group will show up in the "All Groups" list
: ?3 ]" K: E3 `, _!     in the Customize dialog.
# V! b  b; D8 I6 C4 k% B!
8 q& u& r# F* k# O!  The labels of the buttons are defined using the RIBBON_LABEL token in the MEN files
+ q6 Z6 m/ {. a!' Z5 Q' u1 I# u% g

! [0 @& n. I2 B; z7 @$ \9 BTITLE Group
& e8 P" e7 `9 O) l; d2 m6 pVERSION 170$ i, Z8 Y9 n) i' |! P) n( g7 \

; L4 I0 I( K7 q4 z4 R2 {0 ]!  No LABEL defined, using RIBBON_LABEL defined in customer_men.men
' [) ~/ z7 L8 N% `* jBUTTON CUSTOMER_BUTTON_1" q6 M& b' G: g: y7 E: D
RIBBON_STYLE LARGE_IMAGE( u! z& B7 ]: K+ A& z, F
. ?& _4 e! I+ {: l! s# D) V
!  Example of a gallery defined in a GRB file.  e7 W9 [7 s5 [! p8 Z0 C
! 2 G" X4 R) R8 t  x; C) W3 g( e
!  If this gallery is to be used in other places, then it could be ! Z: W! e0 k( G, q" }
!  defined in its own gallery (GLY) file and referenced here& Y+ W9 M6 }2 Q/ v  d4 y
!  Example:$ k$ }/ I* W7 A8 }, h
!    GALLERY customer_gallery.gly
8 w4 J7 J% J1 p!3 P1 m- Z5 D9 x+ l7 ~
BEGIN_GALLERY  CUSTOMER_GALLERY
: I# o$ d1 d0 c- X; g7 w8 U, t+ R* T4 \COLUMN_IN_RIBBON 21 O, r; y, c* Y1 i# k$ J; H
COLUMN_IN_POPUP 2
; F0 F$ ?7 P3 D. W9 h  bLABEL Gallery
3 [. }" Y/ \( A  ?GALLERY_STYLE MEDIUM_IMAGE_AND_TEXT
* B2 D) T. X, v! k- {" B9 s' \+ E0 M
    BUTTON CUSTOMER_BUTTON_2
2 ^0 \) D" G) m: u% }2 c; v- w4 L9 V: z9 P- z1 Y
    BUTTON CUSTOMER_BUTTON_3+ H; w( D, [: u

7 G6 s) ^  g/ b4 [7 e0 Z8 h' a    BUTTON CUSTOMER_BUTTON_4$ ?' A8 m& j% G2 g; P, A# a
& ~; L0 F) D5 K3 L- G. _& N: q
    BUTTON CUSTOMER_BUTTON_5
; C9 Y1 y* G1 }% |$ y$ j- \6 m% c6 f5 D" T/ T$ ]. O4 X9 s
END_GALLERY! z. [0 R+ s" q8 U1 D6 J
. Q2 k! \) ]8 d; j6 C

7 o' b0 `/ P0 N( e3 C
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了