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

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

[复制链接]

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

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

admin 楼主

2015-1-9 10:37:48

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

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

x
关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧
" {: L- e1 x( R$ A6 `

经典界面到RIbbon界面转换

经典界面到RIbbon界面转换
; q: H4 V1 Y/ {# K$ m$ J
在经典界面下,需要的文件
) I" y% T7 I6 x- y6 [6 k& q
  • customer_men.men
  • customer_toolbar.tbr
    ' V5 R' m. |; O. H
在ribbon界面下你可能需要的文件 8 v& j! p& _3 i: T* w
  • customer_men.men
  • customer_tab.rtb
  • customer_toolbar.tbr
  • customer_toolbar_alternate.tbr
  • customer_group.grb
    ) j. }& p# K8 h8 G. }) O# [

( @- b  e8 c" X$ T% v0 A
& ]0 Z" v0 q- N5 \, z# j举例如下:
3 K  ^" B( u$ D+ E( u9 a( E% R
: f0 _. |1 w1 a0 A
- @) J) R& _$ Y' gcustomer_men.men
- m& f* l/ B, m$ i8 a' \3 k- S; L. e!6 ]0 Y5 T1 W' P# d# n1 g/ ]" [
!  Customer menu file* p, u" \6 f+ u, c# ]
!
- D$ v0 s) q" k( V1 _!  Contains button definitions to be used in
% [: `. ?( S9 b!  toolbars and Ribbon files: N8 n0 o; n3 z
!
4 A& Q, v* W- R! H% |/ e& n
* O  G6 _5 f7 R: o5 k8 i5 D5 h6 hVERSION 120
- I8 X. n/ U0 |1 c" ^6 z1 X; _8 G! w
EDIT UG_GATEWAY_MAIN_MENUBAR& S& Q0 d+ @1 x; `0 p2 ?

. ]/ `" S/ u- ^/ @0 ?8 {1 R1 C: |TOP_MENU7 U% U9 ]9 F, N% R/ W
    CASCADE_BUTTON CUSTOMER_MENU5 Y, M; L/ ]: V+ ^2 M' Q
    LABEL Customer Menu( ~. n* Z( q. @3 F; G5 e6 ?. i+ ]

/ j$ g8 S- m- e% _0 FEND_OF_TOP_MENU# m$ b5 @9 W9 }4 q: U# E! `

/ F* r& I( ~" J8 Q) CMENU CUSTOMER_MENU4 r7 T2 W& V/ }/ L$ u

8 o7 u1 [/ [2 n: M' R1 a* T4 X* a    BUTTON CUSTOMER_BUTTON_1
) s, l4 R9 [8 p# b3 f! D    LABEL Menu Button14 I2 d% D( H; c: ~1 O( u
        RIBBON_LABEL Ribbon Button1
# M+ N( l, a2 `$ n$ h9 k        TOOLBAR_LABEL Toolbar Button1
, i' Y* \! _- i/ m" ]3 @2 Q  f3 E& a    BITMAP fileopen% s, B2 I' k3 f# o$ ?
3 `9 q/ n7 M. }
    BUTTON CUSTOMER_BUTTON_29 X7 y; f: J8 _3 L& [8 @5 }7 t6 k
    LABEL Menu Button2* S7 s$ s+ L. _' f7 w
        RIBBON_LABEL Ribbon Button2
$ {' \% K# q5 A9 U% S, a        TOOLBAR_LABEL Toolbar Button2
8 {; d9 y' f: t6 H/ Q4 |  x    BITMAP filesave
% F2 k9 b4 r( a9 q  e4 G( D. G9 ^- V
    BUTTON CUSTOMER_BUTTON_30 U% S* E0 e, J- q5 |8 C& M! R! `
    LABEL Menu Button3
( m6 H0 I% Z9 G7 S6 m        RIBBON_LABEL Ribbon Button3
, V5 V" R0 R( R8 {5 x: Z        TOOLBAR_LABEL Toolbar Button3
8 S% i, @( G  ~    BITMAP current_feature
: I( D( a7 q( B" ~& F3 s/ E+ t( L3 X& X+ [; y
    BUTTON CUSTOMER_BUTTON_4& S& k, W; k7 f' B7 k0 g
    LABEL Menu Button4
' m5 P: J+ j! P, E3 [1 d: q        RIBBON_LABEL Ribbon Button4. g! C2 g( O2 D9 o1 k
        TOOLBAR_LABEL Toolbar Button4
% ~- l* |0 l. S2 d% l# K; b    BITMAP block7 P  |! j) x, ]6 e4 ~% @* e- L
9 O& Q1 f" m6 `% [
    BUTTON CUSTOMER_BUTTON_5& {1 W& ^+ G) f" n: s2 R
    LABEL Menu Button5
, n5 M/ G: {, Y- @% G        RIBBON_LABEL Ribbon Button5$ S7 S" g, l% Y* N, c3 C
        TOOLBAR_LABEL Toolbar Button5
/ [" z% v5 d# d; n* [, G+ P    BITMAP checkgreen) X, G% a* l6 v: b7 K+ V& ]

- ^: ^. J+ w- K* u6 h6 ~; xEND_OF_MENU3 h9 f: D9 U6 ]7 b  h* U. e6 B

8 {" a4 G3 L8 E9 b7 G
4 r0 D. Z- \" c! p- d6 Z
8 s# z' o/ |! j/ qcustomer_ribbon_tab.rtb
) q  ?8 X& P) u+ E8 s+ ^!- ~' x: a  z: ~/ \0 m  V. c
!  Customer Ribbon Tab- k# A! S# m1 }# _3 t5 t/ N) p
!   P1 I( {4 c' a& t& P) z, t
!  This file will create a new customer tab containing three groups and- S( E% j, b2 a: u
!  one top level button.
4 Y7 G% \+ W. o  l1 Z: E4 L!: Y: F) M/ G+ m# f, W
$ @3 c8 {2 Z# h  Y2 S$ @
TITLE  Customer Tab$ H6 Q$ O1 i" w' |+ n' Q5 _
VERSION 170' G# ]* {& C: C( I; n

1 n; {+ c; A  k& d!  The first group represents a Ribbon group that references an existing
! p, W8 T  l2 n4 H4 g, c!  toolbar with no Ribbon style changes.  8 s- [, q8 |) v' @8 a7 l! m
!
' w, g+ h1 D+ I!  This is the quickest way to add existing toolbar content into Ribbon mode.
1 y# H0 B; ~* e9 \3 Z1 r!
6 `% l1 K3 _% B# t$ FGROUP  customer_toolbar.tbr
: O( m# P$ H# P$ w& t9 g( S4 ~& ]
) E5 {: q/ G8 Q! P!  The second group represents a Ribbon group that references an existing
; a8 x/ l0 l- ^: t8 N8 Z* s5 q6 r" f!  toolbar with Ribbon specific style changes added to it.  There is no difference
! v8 U4 e) Q# B- S0 U4 K!  in how this toolbar is referenced in the .rtb file compared to the first
/ H* \+ M7 i+ |. d4 |# k+ h!  toolbar as a group.  The only differences from the first group exist within ( J( C+ c/ s( h( g& d, O  D
!  the .tbr file itself.
, k  m* b2 ?& n8 N!& ~8 _  s0 n5 M0 T3 B) M5 }
!  This approach has advantages for customers that will deploy both Ribbon and' ^; I3 @+ _+ k- j7 `4 d) t/ J
!  Classic Mode customizations since all the content is defined in the .tbr + E3 p9 V" |4 r' q+ I* v+ b8 w: H
!  file and it will stay synchronized in both modes.  Only one set of customizations
* V4 F! p+ x4 M& ]8 W+ d!  will need to be maintained while still making use of RIBBON_STYLE to
4 E! t' s; V, Y% e" n5 F& ~!  control the presentation of the buttons on the Ribbon.
+ u. _8 |3 b0 _. k# T2 Z' t8 U!! J' t' a) |! q! \6 j, @8 u8 i
GROUP  customer_toolbar_alternate.tbr
9 U: X7 h& A+ C# A' ~0 w, j8 {# S6 t% Y. X: C
!  The third group represents a Ribbon group that has been created explicitly
& e% F3 ]' ^+ V& c!  as a Ribbon group and will not exist in Classic Toolbar mode.  This is the
* ]/ ^; r7 z% W) c# O' u!  preferred option since the user will be able to take advantage of all the . @$ k+ R8 ?- _0 [- L) o  [" \4 H
!  layout styles and containers offered by the Ribbon.  & U$ R: c1 a3 H( l1 e2 m
!
9 m/ ~' n! q0 W6 w!  For customers that will deploy both Ribbon and Classic Mode customizations, 8 J8 x$ \* m/ g, d! U. a: {
!  this approach will result in no synchronization and two sets of customizations - n, K8 B! @2 z. J
!  will need to be maintained.7 ~( ?/ X& V: i6 {
!( y- F" k; q" \
!  A group can alternatively be defined directly inside the .rtb file by using the
$ Z% T9 v- {1 q: }' L' e5 ]!  keywords BEGIN_GROUP and END_GROUP.  $ D: p1 c& O: c% I+ N% V
!
) @! O2 M* J# {- p+ _% }* |( pGROUP  customer_group.grb
( C) o/ v4 f1 Q, |4 \4 z
/ r# `1 p8 l! Q6 }. Y!  Example of a button that is placed directly on the Ribbon without being
, I% o) f2 e/ \' b1 [9 R!  contained in a group.  This is a simple way to add a button to a tab
$ c" B6 u  q! Z" U  d% L& X& I!  but is not recommended for many buttons since groups have advantages.- m) N9 a( ?9 @  }
!  : C6 ?: n$ j& g* F
!  A few advantages of groups:
/ |4 e1 M) o1 A5 o7 N9 M( W- [% V# Y% r!     1. Easier to move many buttons around together in quick customization.  4 }, O  h9 V* o+ ^8 w8 o4 j. _
!        For example, MB3 on a group and choose "Add to Left Border Bar".  
7 h7 t# O, y6 w; w7 g8 i% k!        This will move the whole group to a new location.  If buttons are " t6 ~8 S, F  f5 f; `" B
!        not in a group, they need to be moved one at a time.3 c; \* @+ N# a2 l! y
!% G7 {8 M; d* q
!     2. Provide a label to describe its contents.& |) w) y! d6 }9 Q( Z
!
' v) Q+ A& g; @+ yBUTTON CUSTOMER_BUTTON_1
3 J( a2 N2 o/ `" a: ILABEL Button1 Directly on Tab; Z+ ~, ?7 ^/ ?! g8 w
+ t- S+ n% d5 \' J) [

) |" @5 M# i- p; g; ]/ U$ Q
6 b2 W- C7 r) E- dcustomer_toolbar.tbr
: k2 L7 q% p9 p/ J!$ v0 T; a6 U& m2 R5 t, O
!  Customer Toolbar File
$ x5 P7 v) U, D* I!$ o7 \0 {# @9 y* N
!  This is similar to an existing toolbar file containing2 q) i/ _1 _/ ^2 T1 }( K( u
!  no Ribbon changes.
( l9 Y8 [0 U, z6 x( |! m9 {) [!) n0 h1 m7 o( ^- z# G
!  In Classic Toolbars mode - This toolbar will still show up in the
+ f% }! _' G5 E: Q& F) P3 D; u!     toolbars list.
& V. I! w  M0 L) P$ K$ t!# h8 b* J) \9 t. }) j# t/ x6 y, m
!  In Ribbon mode - This toolbar will be automatically converted to a
0 |$ u# ]% Q" H; t, N!     Ribbon group and will appear in the "Classic Toolbars as Groups"
3 z1 |& }9 j: e2 |0 B- a$ c( h7 p!     section in the Customize dialog.* m1 N+ j% {1 v4 s9 `
!  3 U4 q% B: |8 v$ e# D9 |4 {/ Z9 j

! R0 _+ J6 i8 ?' }TITLE Toolbar
5 z, C7 l6 J3 P$ gVERSION 170; I$ L* @9 t3 y6 D) n* m7 ~+ n
8 ?! p& }  r* q$ W; K7 M
BUTTON CUSTOMER_BUTTON_1% v8 R0 C/ T7 J8 w/ b, T, ]! e

, O% u  e# y( C% b4 mBUTTON CUSTOMER_BUTTON_2
, \! f) g: @7 @1 b! i0 }  H  S( h7 q: N
BUTTON CUSTOMER_BUTTON_3# J7 `3 y; i. ^: G$ F2 o
4 N9 e7 R" o: c: b0 W
BUTTON CUSTOMER_BUTTON_4# t+ J1 f$ S- W

) H) B2 @, r7 Y. X7 x. @BUTTON CUSTOMER_BUTTON_5" `( Z& }2 x) M4 n2 m( e

7 a8 y- V! D  K9 e0 |, X. `
$ t: R) q; R+ b1 G8 N- w0 ~3 r8 i- v
customer_toolbar_alternate.tbr
. v. D' P4 S' o0 s, ]1 _- H1 J+ D!
1 x! r& i; u: o8 o8 @$ c!  Customer Toolbar File (Alternate)
. M" _7 L) j7 M8 z  n5 ]!
1 p3 f& H2 y3 I# I!  This is similar to an existing toolbar file with new
9 J( Q* {0 }8 C; d4 V2 y8 T!  Ribbon styles added.
) t; T0 v" w7 F!    E* q1 M( x, j0 X- ^) s# }
!  The RIBBON_STYLE will be honored when the toolbar is loaded 9 C$ V+ G' ]' n0 f" ]4 h
!  in Ribbon mode as a group but will be ignored when the toolbar # ~6 K  m  V" B, ?4 y& _
!  is displayed in Classic Toolbars mode.. W/ c; B( k5 Z/ T
!* _( r; b* s& c# C
!  In Classic Toolbars mode - This toolbar will still show up in the & b$ k  W) _8 V: ^
!     toolbars list." K5 d( p; F' P4 Y. o5 T! G. d1 l
!3 E6 c3 J9 S. K5 N. N' u
!  In Ribbon mode - This toolbar will be automatically converted to a
" O7 J% S1 K2 b3 g) A. t!     Ribbon group and will appear in the "Classic Toolbars as Groups"
. y& @" ~, E% O& X, o0 r  c!     section in the Customize dialog.# X( u6 G2 X& _- r+ L  s# H# `, {
!  M1 e( f+ J$ R8 K. R% T) _

1 R, V9 Z. |4 T, s" CTITLE Toolbar (Alternate)1 a. t+ d5 @) \7 m( ]/ k9 ?1 a3 J
VERSION 170/ Q& }6 }+ D; G: F" P# l
3 z- }, k0 N4 P4 S9 n3 W1 R( }
BUTTON CUSTOMER_BUTTON_1
& G$ m; \+ M0 k) ~  ^LABEL Toolbar(Alt) Button1& @  t7 F/ F- U, Z( w# y# J+ d
RIBBON_STYLE LARGE_IMAGE
" X% ^, h1 u4 X: c$ [$ {5 z3 c8 v+ t1 `1 [
BUTTON CUSTOMER_BUTTON_29 C# b1 g$ L/ a7 K/ G% f" p
LABEL Toolbar(Alt) Button2
) X. t+ {7 t$ w: M+ k2 M( w; wRIBBON_STYLE LARGE_IMAGE
: c0 }, _9 N/ p  T8 R4 f: Z3 u* ?! M! I" L' r, o. v
BUTTON CUSTOMER_BUTTON_3$ s9 j: |2 b, Q0 D) Q3 {7 b! S2 M
LABEL Toolbar(Alt) Button3
  \7 ?3 i2 K- M; s. v7 y7 q2 vRIBBON_STYLE SMALL_IMAGE_AND_TEXT; \, E- D7 @  l4 |5 D& I

8 ?2 R8 J. s! `. }0 Q; X- J; jBUTTON CUSTOMER_BUTTON_4) x4 W2 G) q, m6 C- l
LABEL Toolbar(Alt) Button4
" l. v, `. B6 U1 l: ~- lRIBBON_STYLE SMALL_IMAGE_AND_TEXT
+ t& z5 V( u" o/ i, T3 d$ e% k: T. P7 ^' l' [
BUTTON CUSTOMER_BUTTON_5+ i- _# w- I$ `' \; x3 F& o
LABEL Toolbar(Alt) Button5" z3 w/ i" l4 t8 l1 w/ A7 i
RIBBON_STYLE SMALL_IMAGE_AND_TEXT; Q& O; ^0 d: u! w
; _2 Z$ t  X' ^( h
5 t  k) _* v( r7 y
* ~+ _7 B& b$ v  X# b
customer_group.grb
6 Z$ S+ Q/ Y& d!/ V$ K0 M1 G1 l/ p, N1 n# W9 j
!  Customer Ribbon Group File
+ v. r6 O/ k1 L" |. k# ?/ m2 E$ u!
9 |  a0 N8 _7 e: q9 A* l!  In Classic Toolbars mode - This group will be unavailable
3 h) {4 F5 R/ Z' P0 p6 v!! Q( _) G; T# H8 t3 o) F' K) V3 h
!  In Ribbon mode - This group will show up in the "All Groups" list$ ^$ x$ }2 s0 N! z) }$ h
!     in the Customize dialog.9 j- W5 ]) c& }1 z) Z8 u
!
1 ^8 q1 K% H1 t0 T7 Z% l!  The labels of the buttons are defined using the RIBBON_LABEL token in the MEN files2 J, L# ?, G+ R; Q& I' Z
!
* [  `. ~- `6 `7 \, N+ b% t% q$ B
% w3 Y  ~- x$ Q: F9 A/ BTITLE Group; A1 i# ~: j! u. z! K
VERSION 170
% V4 d8 V. H+ s" }/ M/ _8 l/ P# E
!  No LABEL defined, using RIBBON_LABEL defined in customer_men.men  i* _8 w2 Q0 m' q5 _, u' J# b
BUTTON CUSTOMER_BUTTON_1
  v7 d3 \, F- s! S7 d3 w6 G- ~RIBBON_STYLE LARGE_IMAGE
1 J: ^  t. j/ H8 {) q2 j/ p. K  t2 a3 P- F
!  Example of a gallery defined in a GRB file.
5 y+ Z' q3 V$ L% p! 4 A! E) U% a/ i; y8 _0 ~/ U; k
!  If this gallery is to be used in other places, then it could be 3 C! w/ u) s. w. S
!  defined in its own gallery (GLY) file and referenced here+ H2 `+ ^! R5 ~7 z% f1 c' p4 y0 G
!  Example:, @' A9 X* ], S2 E+ a
!    GALLERY customer_gallery.gly' h2 Z4 \2 c% x) D7 P# L% n: S: a
!
! d! G1 k! J7 e8 f. l' W$ A- NBEGIN_GALLERY  CUSTOMER_GALLERY
1 k6 ^. v' g; H2 wCOLUMN_IN_RIBBON 2$ |$ ]3 _0 Y# @  d
COLUMN_IN_POPUP 2
; Q. @, g9 O: i& ^( hLABEL Gallery" {3 X9 a, h& W
GALLERY_STYLE MEDIUM_IMAGE_AND_TEXT
1 Z9 p4 B* k; Q$ W9 p- e( |  }1 N/ U8 S- z9 `) g: g9 g
    BUTTON CUSTOMER_BUTTON_21 b& M5 k  e; A* l

: e+ B- |% |6 H! Q4 O7 q0 b+ \" H% X2 K    BUTTON CUSTOMER_BUTTON_3
. m) k( P3 l; \, y# t
  Q1 ]1 A9 K: ~* C: n1 O    BUTTON CUSTOMER_BUTTON_4$ W8 A$ ]. D* i/ P
7 |: L& B& s7 ?" c6 p! d& e) f. f
    BUTTON CUSTOMER_BUTTON_59 E0 }; c1 a- E( C. s

5 J- V; |% F& Z$ VEND_GALLERY5 a# ~* d( b: `

' D& ]* ]  n% w. [/ o
7 a& K4 I- J  T3 R( s
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了