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

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

[复制链接]

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

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

admin 楼主

2015-1-9 10:37:48

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

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

x
关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧
$ c! x) J# g, d

经典界面到RIbbon界面转换

经典界面到RIbbon界面转换
) g8 c( D- J5 h* ]( m
在经典界面下,需要的文件
2 v- ^9 O& g& p6 ?
  • customer_men.men
  • customer_toolbar.tbr/ b3 f* x6 p' J8 N% {1 v
在ribbon界面下你可能需要的文件
! J# I- Q% p* Y5 c7 }/ @
  • customer_men.men
  • customer_tab.rtb
  • customer_toolbar.tbr
  • customer_toolbar_alternate.tbr
  • customer_group.grb

    4 m; z! Z0 Y0 q
9 W# W1 V, ]3 O* t$ m/ E

" z0 U# a/ I' q( v: i8 e举例如下:
/ j; v& K1 N) f
% \2 q0 S: ~! {9 M0 f5 S# H9 Q4 e
. }# R; O- p+ w, D9 Scustomer_men.men
2 k" N% F6 w( s6 g* E0 S8 M!
+ E4 ]4 P3 J' f, l' M0 V3 K$ g!  Customer menu file0 `" f& P# Z/ H% K$ q8 s3 z
! + {$ p+ C; H+ W# ], `/ Y0 ]
!  Contains button definitions to be used in " ]* a4 l. r1 D  Q) {% _
!  toolbars and Ribbon files# T9 k/ h! f2 I# Q) P6 \
!
  a: y8 V$ _9 H6 x! [, t1 X1 z
, K: i0 m. h6 d3 q- t$ e! lVERSION 120
7 i7 w: G  h! x- S7 c
+ V% \2 H/ x1 Y8 s7 FEDIT UG_GATEWAY_MAIN_MENUBAR
& z8 G1 A, {& ^" I6 I% B4 s: t5 f" d+ `9 h  C) M' Y
TOP_MENU
& y+ C) L& x4 _! m    CASCADE_BUTTON CUSTOMER_MENU( e, Y7 X, i/ V8 c
    LABEL Customer Menu- M- T% w& _7 Q! e) ^
: t* o  D5 g$ T$ p' r; Z
END_OF_TOP_MENU2 i+ w6 L* A2 n9 f
( S& N* W+ C, N# S* f; n% t- F, M
MENU CUSTOMER_MENU
. K, g# p  m- n. k* z7 N' w0 n% j) Q# A5 `9 h. s8 j  }' a
    BUTTON CUSTOMER_BUTTON_1
0 J# X$ L! Q) m    LABEL Menu Button1- W+ @; j+ @) B4 O/ ]3 T
        RIBBON_LABEL Ribbon Button1; x$ O/ H& B! i2 J" ^& a
        TOOLBAR_LABEL Toolbar Button1) V: B+ W% W% H$ l
    BITMAP fileopen$ b& P8 B& [) h  M

5 [* n: W; s. G% V4 u    BUTTON CUSTOMER_BUTTON_2
' R* {4 C* C( F; o+ r5 j& V    LABEL Menu Button2$ y* B; \* J8 W/ |- q- m" f* W
        RIBBON_LABEL Ribbon Button21 M' l7 v* C+ i' t0 X
        TOOLBAR_LABEL Toolbar Button23 l( c  @6 V" [
    BITMAP filesave" n( ~, P% Q1 {7 A

1 G5 u! W  H9 g    BUTTON CUSTOMER_BUTTON_3
7 y5 [$ P/ _8 L    LABEL Menu Button3
( P. r' b  V# o        RIBBON_LABEL Ribbon Button3. a1 S" D/ S6 g+ ~
        TOOLBAR_LABEL Toolbar Button3: x, f9 L, o) j
    BITMAP current_feature
" u. Q- q+ X; ?" h" z, ~, v$ w, L! @
    BUTTON CUSTOMER_BUTTON_4
3 E( C! x$ F8 A; @3 f" P    LABEL Menu Button4
3 z2 l9 y. J$ x- E% F2 i7 J! ~- x( i$ A        RIBBON_LABEL Ribbon Button4) T% v# R2 g# ~! T' i( I5 L9 D4 ^
        TOOLBAR_LABEL Toolbar Button4
7 p; H1 s& a7 t! ]: \3 h, z    BITMAP block
: ?, U; ?. D! s9 A1 d  K1 S
$ Y+ A+ A4 n, m8 [" _7 g0 ?    BUTTON CUSTOMER_BUTTON_5+ }; a4 Z+ z5 J
    LABEL Menu Button5
3 H. J' \% b- [) H; W' f        RIBBON_LABEL Ribbon Button5
4 ~3 C3 u  ?& j  r7 h: X        TOOLBAR_LABEL Toolbar Button5" I) q, A' T9 s2 _4 M/ j- v$ p
    BITMAP checkgreen
5 P  X9 q9 L0 Q9 `4 Z9 T& }0 |/ U7 M( I
END_OF_MENU
- ?3 @' L$ g9 {! D
- C8 N4 M7 E7 J  p5 g6 _# ]  e& l, w* ]% d4 N
: E* V9 l- u* D2 ]
customer_ribbon_tab.rtb! T# J  W! I  P# A: q$ p& h5 ]
!
% h  {8 t0 P) X  `# P7 ~!  Customer Ribbon Tab( R# }+ I; _, o* K% W1 D
!
; o2 t2 k- W, R0 B& ^!  This file will create a new customer tab containing three groups and
9 x! X  Q$ o- f, \8 Y!  one top level button.
2 Y- i' C* s1 j6 }$ t) F2 ?+ r!3 r7 j8 i, p! _

! J/ P- x; l( Q, y) YTITLE  Customer Tab; @: l  B: p# U+ C) ]$ M
VERSION 1701 c/ f( o! u. f; ^
3 y: @$ x* |8 P0 |; C
!  The first group represents a Ribbon group that references an existing
% H! U* k* p9 x& |!  toolbar with no Ribbon style changes.  
7 p1 ]) K# v8 U!
6 k; u7 J1 k1 Z  s( a$ V!  This is the quickest way to add existing toolbar content into Ribbon mode.
# M; M% _, |+ ?  ]% A!
4 g* O$ H. h. W3 e3 A! P  n) YGROUP  customer_toolbar.tbr
  t0 `* A; _3 R1 w3 o; I
+ H/ @7 n9 p9 S$ z9 o, K& M!  The second group represents a Ribbon group that references an existing
. F; r" E* K9 U% S! _2 Z/ }( M$ U! }% I!  toolbar with Ribbon specific style changes added to it.  There is no difference
- l' P$ k% s% D6 N+ Q* \) f!  in how this toolbar is referenced in the .rtb file compared to the first3 Y! X' u1 b0 F3 _8 [5 m4 K
!  toolbar as a group.  The only differences from the first group exist within 3 j. R6 v6 B# i2 G
!  the .tbr file itself.% v7 l  ?- r( i' m" w) O1 L" {1 X9 Y
!& U6 g  S9 H) N: x: t# q
!  This approach has advantages for customers that will deploy both Ribbon and
- s0 ^4 S1 c5 P# h6 h+ Z0 u- h7 v% `1 V!  Classic Mode customizations since all the content is defined in the .tbr 5 \: U$ `4 n; k/ B% l4 o2 r
!  file and it will stay synchronized in both modes.  Only one set of customizations
6 U6 _% v  w/ B9 M!  will need to be maintained while still making use of RIBBON_STYLE to
% y. w% M2 m$ C1 o7 N!  control the presentation of the buttons on the Ribbon.- j  `" k7 M) G3 ?
!
; Y) p, F$ N) W8 D) eGROUP  customer_toolbar_alternate.tbr4 L' L- M8 d6 U8 {( h

, |/ a, X3 L8 v, x. C. x!  The third group represents a Ribbon group that has been created explicitly
  z, w3 h( h) q7 ~! y2 F) U!  as a Ribbon group and will not exist in Classic Toolbar mode.  This is the
/ Z9 a3 k6 y( V/ \$ X  |!  preferred option since the user will be able to take advantage of all the
/ ]' R! v  f. v' X- D5 V+ B. M!  layout styles and containers offered by the Ribbon.  8 j% v7 }6 [" e; b3 N) b& k, I4 L
!/ V! ?. X8 b6 X3 B7 O( A0 e: }9 G
!  For customers that will deploy both Ribbon and Classic Mode customizations,
" c) J0 r, A6 ?; [* @/ x9 {!  this approach will result in no synchronization and two sets of customizations
: x7 f7 d4 s9 H* L' Q!  will need to be maintained.1 r, q6 r1 i" g  R* O8 I; h. k
!
' `3 X2 `+ z3 E/ v!  A group can alternatively be defined directly inside the .rtb file by using the7 o* I$ h( I; N2 |$ N' ~
!  keywords BEGIN_GROUP and END_GROUP.  , L; y9 j. J  G( d% H0 N
!# f, k( n$ [. |) x5 C
GROUP  customer_group.grb4 p9 z) Q8 r4 L9 H: _) [! T9 p

5 M7 p) F8 l7 C7 m: P!  Example of a button that is placed directly on the Ribbon without being# `" D% W7 N- [
!  contained in a group.  This is a simple way to add a button to a tab
% }2 f6 d  I9 D+ z+ E! F% n!  but is not recommended for many buttons since groups have advantages.) K/ g- F* Q& ?+ m/ ]% |
!  $ S% S* P1 s; U3 a6 U) a
!  A few advantages of groups:2 }  w" s; V  \6 _# [4 D; H
!     1. Easier to move many buttons around together in quick customization.  
! ~8 [2 u; c- Q" l; t; [/ \!        For example, MB3 on a group and choose "Add to Left Border Bar".  
. U6 f4 c: J2 p!        This will move the whole group to a new location.  If buttons are - |) Q5 y: ~; v9 S6 |' G% D  r
!        not in a group, they need to be moved one at a time.; }4 b7 `( E! t7 A# a7 L! d% f/ e
!
$ V3 g2 J9 r  g$ f!     2. Provide a label to describe its contents.
: Z+ {( l) ^  L/ l% \) O; J!5 X. p+ `, v$ i
BUTTON CUSTOMER_BUTTON_1
+ D! S5 c$ ^' T3 s$ x( b+ tLABEL Button1 Directly on Tab( A( x8 w; t% U  `3 |1 _( Q0 {
8 `$ ~( Q# u" a1 Y1 W& j% V, @. s
$ P5 {6 |5 |5 a4 V8 z2 w0 \
5 H" \' K2 u% e5 Q9 C
customer_toolbar.tbr4 }8 T2 H2 C1 \
!
/ d: W" ~0 e( }* B/ n$ W! o!  Customer Toolbar File0 h% P0 A7 H! ^* m* P7 Q
!
  Z6 K0 {5 K6 F9 H$ ~0 F9 b!  This is similar to an existing toolbar file containing
: Y- S0 B: P. f( V!  no Ribbon changes.
; f( e4 t  H8 c4 ^) n2 ^!
5 g* z: Z$ O: y!  In Classic Toolbars mode - This toolbar will still show up in the : T: q5 @0 J. {
!     toolbars list.- T! o8 {: X: }. `# y. w; Y
!
1 C9 u# d1 `( X0 b% g!  In Ribbon mode - This toolbar will be automatically converted to a 9 w; D/ ?4 ]) v$ O9 L
!     Ribbon group and will appear in the "Classic Toolbars as Groups"" s/ I5 E+ c8 F9 W. f
!     section in the Customize dialog.
( W" z) R% }, ?2 K$ _!  
$ i) g  U) V  _. ^$ A8 n$ R3 _* [: `7 X
TITLE Toolbar% ^4 h7 j4 W6 `( ~+ M5 K) y* j/ K  Z
VERSION 170
3 u$ `. {- H+ B' h+ o( X" W; T
3 ^' S/ ^  A6 wBUTTON CUSTOMER_BUTTON_1
/ B; S  }( E+ X' R/ z) s" ^" i6 C1 m9 G, K5 n" A
BUTTON CUSTOMER_BUTTON_2
5 M3 A0 O9 r: a7 z: `) V4 e8 j' [- Y6 V7 ~
BUTTON CUSTOMER_BUTTON_3
  m! i$ {! m$ p8 d% N+ y9 T$ O  ~+ ~1 ^  p$ P6 F, L
BUTTON CUSTOMER_BUTTON_46 H& p. Q* S' ^

9 p# r) X- d2 c4 F% W2 `- [BUTTON CUSTOMER_BUTTON_5
* i, q# E- @3 F" R/ B0 \9 h5 q' _( x: ?. _

: m' q5 ]7 L  `7 k
3 T, ^. n0 P. d# jcustomer_toolbar_alternate.tbr
8 @& k7 G( g& i" N$ \' U( F; i!, O$ K' C& N7 F9 h# J
!  Customer Toolbar File (Alternate)
* U8 {- P% _5 R8 i! Q!1 a7 i" Y2 H" U1 P
!  This is similar to an existing toolbar file with new" @; O# ~  u! i0 D* i. W
!  Ribbon styles added.
8 _7 R! i& J' v+ G: C4 N% `!  
  q; X- H& i' _' @- p!  The RIBBON_STYLE will be honored when the toolbar is loaded + x1 `5 G; f( I& M8 l; m
!  in Ribbon mode as a group but will be ignored when the toolbar " ?# K; P$ z) r6 r1 ^
!  is displayed in Classic Toolbars mode.0 B2 U5 O! ~! M) _8 J* I
!
: _, M4 A5 b# _% M!  In Classic Toolbars mode - This toolbar will still show up in the
) \- Y0 {; {7 H. ?5 m: e!     toolbars list.7 G) X& i1 U8 d( k4 g, a
!* E  S, F; l6 z/ f2 _$ ~* d
!  In Ribbon mode - This toolbar will be automatically converted to a * l, B# K$ E0 N0 J& G3 u; y0 ~
!     Ribbon group and will appear in the "Classic Toolbars as Groups"
7 O  |$ Z& W5 L3 [! g/ v9 Q!     section in the Customize dialog.6 X  B: ?  s/ D- V3 M( s6 b2 \
!8 r# z$ T/ n- v8 V- g. J
( Q) G: {2 y8 k4 c
TITLE Toolbar (Alternate)3 c( W+ Y, b6 w% ]6 J2 c1 y
VERSION 170
; }+ v) @' [) s* d8 q0 w
+ }* O6 O& H/ nBUTTON CUSTOMER_BUTTON_19 Z9 `* E5 ~( y" K2 x
LABEL Toolbar(Alt) Button1/ R9 t2 \( r& Z& a, K
RIBBON_STYLE LARGE_IMAGE9 v$ _1 O$ ]3 R: P6 _4 ~
) d" O8 }4 O9 `! a
BUTTON CUSTOMER_BUTTON_2
: H" t* c9 \" Q, z+ V& RLABEL Toolbar(Alt) Button2
. t- m* `, Q" T* {$ |; iRIBBON_STYLE LARGE_IMAGE. ]0 `" H7 N, [6 `" Z5 S

' @" }* v) h; }5 @. e$ W. eBUTTON CUSTOMER_BUTTON_30 a, [+ S" f3 n
LABEL Toolbar(Alt) Button39 d9 h& n8 B# Z# ?) |
RIBBON_STYLE SMALL_IMAGE_AND_TEXT! o& c# J8 q8 b) B1 K' v

7 R  F3 J' T: q3 R! _7 xBUTTON CUSTOMER_BUTTON_4
8 _: h* H2 @4 r: HLABEL Toolbar(Alt) Button4+ D* y( t  f( J; Y' M3 ~" W& G/ j
RIBBON_STYLE SMALL_IMAGE_AND_TEXT3 e. T% [# c' D8 W# ]
) }( g9 Q3 R2 w0 _
BUTTON CUSTOMER_BUTTON_5' w$ X, G& ^2 {' m- w- W/ y# a
LABEL Toolbar(Alt) Button5
- K9 O9 @$ x6 D1 }RIBBON_STYLE SMALL_IMAGE_AND_TEXT
2 N9 O! \7 v$ B% Q3 A. Q4 \% A% S% \" O  p  s2 I

5 x3 v4 K3 `1 \! j
* I3 O( K8 Z$ @) Q6 L/ }# Ncustomer_group.grb
6 `4 j* E/ K; c. j!+ c; s& R, s, h
!  Customer Ribbon Group File
' y  n: p" ?4 O4 l$ b!: m/ T' }, p) F
!  In Classic Toolbars mode - This group will be unavailable
6 o% q3 Y2 i8 M  V!
8 {0 f" _# b. C1 s8 v& ^7 F!  In Ribbon mode - This group will show up in the "All Groups" list; c5 y( e, Q: U
!     in the Customize dialog.2 F, {% |0 e+ G- c" G& g1 t
!
2 J" s: u, A  d. ?0 ^; |% T!  The labels of the buttons are defined using the RIBBON_LABEL token in the MEN files
3 q4 P9 c7 ~) |! V" ]!$ b+ I9 G! F9 q5 j0 S

3 W/ m+ z' m2 `/ _, P% v0 @TITLE Group8 |8 f/ E& e& l+ V
VERSION 1704 ?( W0 n5 p( t$ h" }& U3 b/ \; i# O
& W' Q3 N% D0 S# l; v4 J* P
!  No LABEL defined, using RIBBON_LABEL defined in customer_men.men
0 F. {2 q7 P5 x9 b5 {0 p4 X5 TBUTTON CUSTOMER_BUTTON_1* l! ~* B0 Q( Q. f4 _, V" f
RIBBON_STYLE LARGE_IMAGE
' S$ o. v! r0 A+ S+ C2 i( P; a6 r* D/ U! m4 A
!  Example of a gallery defined in a GRB file.
6 L; C- W. E) U* ?& `% w  P6 V! & E6 [  G6 `' w1 u8 @# e: B
!  If this gallery is to be used in other places, then it could be
, M0 I) j* f$ ^4 |( i. B!  defined in its own gallery (GLY) file and referenced here8 Z* i" v! L  z( p, {  ?
!  Example:
- W0 m# i3 r& Q" T/ [1 Z. @9 l!    GALLERY customer_gallery.gly
- a' h7 E7 a/ E  V6 {. u!
5 k2 w  W* h4 F& j, V3 V) f' E" W! t. BBEGIN_GALLERY  CUSTOMER_GALLERY  k% p6 V  a6 J& f% t
COLUMN_IN_RIBBON 2
' Z& T4 h0 i7 d8 |) r  z4 QCOLUMN_IN_POPUP 2( k$ F" s! o1 J2 A. C
LABEL Gallery
; q" [( c9 {; zGALLERY_STYLE MEDIUM_IMAGE_AND_TEXT" u7 k3 g7 w0 l
& N+ P. }  D" l& I% _4 U7 Y& S
    BUTTON CUSTOMER_BUTTON_2
- L' ]9 q& b5 o1 y& r2 j* u% B( s0 m
    BUTTON CUSTOMER_BUTTON_3
! k1 @1 {$ L6 {+ z: G. W6 @5 W& f) C  Z& K9 \0 q
    BUTTON CUSTOMER_BUTTON_4
! a. D1 O' p+ f. S- y5 E; H9 ], P2 }
    BUTTON CUSTOMER_BUTTON_5
2 V0 V4 r9 O$ u9 l0 U8 p/ a/ n8 l0 Q) M1 `
END_GALLERY' d0 Y3 i. l1 `: P- J+ t/ F  N
$ {/ H# C: ^% m3 ]- d- o  o% g

+ F* b; R3 J$ {- [! G9 A7 v
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了