PLM之家PLMHome-工业软件与AI结合践行者

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

[复制链接]

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

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

admin 楼主

2015-1-9 10:37:48

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

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

x
关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧
- y( }7 G  g2 M+ B2 ~

经典界面到RIbbon界面转换

经典界面到RIbbon界面转换
1 ~6 i; s* S7 Q) g" @( S3 `7 p
在经典界面下,需要的文件6 P8 w' Z2 x( P8 r: k' w" A  c; j
  • customer_men.men
  • customer_toolbar.tbr
    - b( w9 L3 A% ^+ L" i
在ribbon界面下你可能需要的文件 5 m3 Y0 o; k5 ~/ r' q7 x* ~' R
  • customer_men.men
  • customer_tab.rtb
  • customer_toolbar.tbr
  • customer_toolbar_alternate.tbr
  • customer_group.grb
    ( s8 B" O3 n6 A( p8 I
2 h2 ]+ Z* R3 h( E# U
% L0 `; f& Z) z, o# L: E3 c
举例如下:
5 O6 `* R" W9 Z/ w! ~( N/ c) [
: L( d" Y7 ?( f% Y& p
5 ?3 l2 Z. d$ Ocustomer_men.men* p3 E+ q7 G5 M8 }0 J( e
!* f6 X8 i% u, N( ^, E) B
!  Customer menu file
) C7 ^3 t0 D4 o# Z) v* F; B! % Y8 A. j. q- {4 }0 ^
!  Contains button definitions to be used in ' ^7 k$ X* B& E% a$ A
!  toolbars and Ribbon files
, Y: i6 ~1 u; F0 ^: @!& R1 Q& S2 y9 e2 Y6 R7 o

$ N+ e: n7 w# b. D& d! ]& ^VERSION 120. B3 J' T& R5 R2 s" W( Y; n

1 Y; m2 J: |7 O& C) lEDIT UG_GATEWAY_MAIN_MENUBAR( q( p/ }% ^$ e

0 r: G7 x8 F) Y: ?& m% F% XTOP_MENU7 C: ?6 D* m( I2 z& C
    CASCADE_BUTTON CUSTOMER_MENU; A4 N$ J# y/ r/ N
    LABEL Customer Menu
. E: v! d) B( ?% b
$ r; a. \0 K; I2 [+ l$ w! D0 }END_OF_TOP_MENU
& c: N/ M2 O: i$ S. i
8 J! ?: W: N+ S9 FMENU CUSTOMER_MENU
' I4 J( R. S* z4 P
, A  T; N7 _) n( \    BUTTON CUSTOMER_BUTTON_1
1 O" b0 G$ G2 H# z9 \    LABEL Menu Button1- K4 ?4 ?& {- s
        RIBBON_LABEL Ribbon Button1# ]+ S9 a! d: a! _7 Q% O& i( U0 r
        TOOLBAR_LABEL Toolbar Button10 P% Q2 n2 ?! S; o" e& X
    BITMAP fileopen
' b$ w8 K! ]) x4 i! h+ G$ v- G( k# `3 R6 k
    BUTTON CUSTOMER_BUTTON_2
" X; j) X6 R4 o( _    LABEL Menu Button20 Q; j. d. b1 ^' y! h
        RIBBON_LABEL Ribbon Button2
& [* P" N4 i( \. x        TOOLBAR_LABEL Toolbar Button2
+ ~1 D4 k$ s! E# z    BITMAP filesave0 k3 h3 ]3 K: t; W9 g% Y- ^: Q% H$ R

+ Z/ `& l/ I( |; ?3 o! i, s4 Z, H    BUTTON CUSTOMER_BUTTON_31 J; C' b) y* a7 X0 P& p# }
    LABEL Menu Button3
' h8 w" K6 X; p0 g$ f6 e2 l- C/ ^        RIBBON_LABEL Ribbon Button3+ Y5 @/ ~2 q" Z% o/ u
        TOOLBAR_LABEL Toolbar Button3
, ?2 J3 w" e' u2 Q& w3 x) Z    BITMAP current_feature
. D* v% q: J* Q
/ h0 b( u7 f; o% B7 m9 u    BUTTON CUSTOMER_BUTTON_41 m) `3 T6 y6 z$ a% u& `$ k
    LABEL Menu Button4* w$ I1 p8 s' o; F' z+ Q: y! [, B: U9 O
        RIBBON_LABEL Ribbon Button4
" D0 I; D0 Z2 \. u        TOOLBAR_LABEL Toolbar Button4" x  f, ~3 q! F4 k7 }
    BITMAP block% d0 V; _5 \: T; C) y: v; s7 }
/ L2 J  \, ~  s7 h( F9 p5 \
    BUTTON CUSTOMER_BUTTON_5
0 M* J- U* n! |% t6 r; K    LABEL Menu Button5* q' o  a" e. F# W7 v7 p
        RIBBON_LABEL Ribbon Button5
' Y5 C' {9 f: S3 T( b+ y        TOOLBAR_LABEL Toolbar Button5
( v9 {% ?( b, o, k3 m+ N    BITMAP checkgreen
7 T; [1 ^7 ~5 Q3 ^# j! E5 U/ A9 `8 @: }/ z5 O5 |- r9 ^4 v3 ~  G2 \% k
END_OF_MENU. @5 }; u! `' n3 Z1 J4 A

5 s) a- `  l) n" J8 d6 M7 E6 }
2 U8 d8 L* V1 N
customer_ribbon_tab.rtb2 q7 ^% [: S1 Y+ k
!% f$ R- \+ Q# \3 f% O( s
!  Customer Ribbon Tab
0 I0 ?; g+ \: r- a- K0 F!   a, u) Y7 y8 o+ I- p4 n8 [
!  This file will create a new customer tab containing three groups and
$ b, u  k" O/ u4 w/ G7 S!  one top level button.* c% |4 m* Z$ z4 i. q, X1 l
!" G3 i: A! Q7 Y6 d( y6 M! w
0 D6 J8 Z- Z) L; ?6 J9 ~
TITLE  Customer Tab# @0 ]$ Y: C: e& e, @4 o4 b8 k
VERSION 170- i) Z$ I, m- G' i& d8 r' M. |: b" R

/ `  _/ J$ z. @  ~0 D!  The first group represents a Ribbon group that references an existing 2 R  z6 A8 ~% @) m9 l, `
!  toolbar with no Ribbon style changes.  
1 @8 M' c3 N9 p& i" C/ l! # F6 k; h+ |- K" F4 ?5 B
!  This is the quickest way to add existing toolbar content into Ribbon mode.
2 C" Z" m+ Y! R; F- |!' k! [4 Q  ]  o, x" l2 ^
GROUP  customer_toolbar.tbr
: R  s* J7 f" T1 g/ ]; S5 s, L+ B1 R) {. y; ]
!  The second group represents a Ribbon group that references an existing
( p( }& H8 V3 A7 P1 a8 K; l0 a!  toolbar with Ribbon specific style changes added to it.  There is no difference
6 ]& v0 ~6 W- i! Z3 ^, d!  in how this toolbar is referenced in the .rtb file compared to the first
  ]& D9 S! @7 e; }4 a( m!  toolbar as a group.  The only differences from the first group exist within
' Q% P, K8 F: F3 {9 y3 Q!  the .tbr file itself." P: e4 j6 @& @. L* d# d: v2 d
!
; m* Z& I7 G+ t8 T3 L! y!  This approach has advantages for customers that will deploy both Ribbon and
4 ^; n( P! ], N) h3 x  b!  Classic Mode customizations since all the content is defined in the .tbr
! g. [% u3 d& }!  file and it will stay synchronized in both modes.  Only one set of customizations
! `6 _( `0 l# ]0 g) Z!  will need to be maintained while still making use of RIBBON_STYLE to
& X, W2 }0 ?% [, D: O0 ?!  control the presentation of the buttons on the Ribbon.
: T  F8 j' y% a+ y!; I+ U; e; K% Q
GROUP  customer_toolbar_alternate.tbr
0 B  j7 \! N! e4 q6 d$ R/ p2 F  Q% Z6 \# |+ S0 O& H
!  The third group represents a Ribbon group that has been created explicitly
! N- o8 c0 x2 G; \: Y+ ?!  as a Ribbon group and will not exist in Classic Toolbar mode.  This is the
5 L  g  M6 ]4 W& M!  preferred option since the user will be able to take advantage of all the
( J! q7 B  t1 ]# \; d. J' `!  layout styles and containers offered by the Ribbon.  ! u5 U* B! R5 P! {: F8 h9 u; O( d
!
' R: g* v1 h( B& ^0 l  Z2 R7 o!  For customers that will deploy both Ribbon and Classic Mode customizations,
" n7 m$ u: ^0 v!  this approach will result in no synchronization and two sets of customizations 5 ?/ B0 D3 o4 A
!  will need to be maintained.
7 O3 D5 Z5 c' J; d# F: S!
! R/ o: Y; B5 z!  A group can alternatively be defined directly inside the .rtb file by using the
; M; P& R: u! \9 M: n!  keywords BEGIN_GROUP and END_GROUP.  4 {; T& S. O% h5 E+ J- }8 h/ Y/ d
!
. P& U; a# s1 M& UGROUP  customer_group.grb
1 `. z- w2 d2 c7 b- t
( h3 M7 |' g, I5 J9 _5 \!  Example of a button that is placed directly on the Ribbon without being
! ~: y6 l* G% q1 o" E$ ?!  contained in a group.  This is a simple way to add a button to a tab3 [- y9 y# K% H0 h. G
!  but is not recommended for many buttons since groups have advantages./ F. u3 R5 E5 y. I
!  : O' o) t$ h  o; V0 i/ j% d. \
!  A few advantages of groups:
2 m- c/ o+ }# w!     1. Easier to move many buttons around together in quick customization.  ; V3 x0 [4 x  A' O( y
!        For example, MB3 on a group and choose "Add to Left Border Bar".  
' {& E3 z6 K& J( A. O9 C0 v0 p!        This will move the whole group to a new location.  If buttons are
( l4 P1 @) t# O8 ~!        not in a group, they need to be moved one at a time.
! s1 x6 I' u; {2 v& ]) u4 ?3 `!
# n2 i+ ]/ ^! ]# J/ x!     2. Provide a label to describe its contents.# J! |3 f9 O8 S1 Y( \4 n2 m* F
!
2 N6 [2 u6 I/ ^; a/ bBUTTON CUSTOMER_BUTTON_1/ _8 N% s" \0 v
LABEL Button1 Directly on Tab1 `. t3 v7 B- N0 z
! y5 S( _: F" r$ T: B

5 ?1 F4 c8 J, L* A- W7 P9 h
# `! P/ S, g; w5 A6 g0 ^5 h1 Ocustomer_toolbar.tbr8 C8 k/ [( K- J( B- ?& M
!8 y0 |0 [, H- M, ~! B1 n
!  Customer Toolbar File3 L9 c9 N6 }* |6 h
!
0 L5 e/ p6 K) ], A7 r# V! Y!  This is similar to an existing toolbar file containing
: K, ^5 V6 I8 x- {9 i!  no Ribbon changes.; h. T/ S* o- Y- _3 ~
!
6 d) x9 Y9 }5 s5 u' q1 o!  In Classic Toolbars mode - This toolbar will still show up in the ) v1 o3 `+ I6 _$ ~/ Y
!     toolbars list.
) r+ W' a6 N3 a. h0 J5 f!
/ B, K6 m% u+ f0 V!  In Ribbon mode - This toolbar will be automatically converted to a
8 O' s' r5 h. o; T!     Ribbon group and will appear in the "Classic Toolbars as Groups"( s& ]2 e; r6 r
!     section in the Customize dialog.
6 k7 K7 y# H# z- a/ z2 q% n!  
: i& d; e: W, ]. g6 [: s9 ?; {
, F" s8 {5 q( \  D; }3 Q9 F- U; ?/ OTITLE Toolbar
6 B1 h& J" A  F6 K2 AVERSION 170! x2 ^5 j2 K) E: n

0 u3 r" F# J* z: T( J4 p: `' v* IBUTTON CUSTOMER_BUTTON_1
' I* A# g- Q5 T( o3 t/ e
! l8 S# D- @, C- L: o( j/ b* b0 c$ |BUTTON CUSTOMER_BUTTON_2
- X  Q+ b" q& q- J. z- C
1 w7 Z' v  K8 `8 l" gBUTTON CUSTOMER_BUTTON_3. h+ z; q' G/ a
1 z# F8 u, m. ?
BUTTON CUSTOMER_BUTTON_42 n* `0 G' c3 S/ H
0 F% z) Q" c' M
BUTTON CUSTOMER_BUTTON_5- v) M0 [3 {. x  A+ }
) Q- \1 R* P9 }( o$ O

  ?* d3 G$ }8 v2 q6 T2 y
: n) Q: z5 R( q6 g1 F1 ~: rcustomer_toolbar_alternate.tbr, r  d2 D& f2 B
!
1 K' m2 p9 z* k!  Customer Toolbar File (Alternate)
: b( Q0 T/ k/ j; C& k, K!/ ?1 u) G+ R. b
!  This is similar to an existing toolbar file with new3 s2 N3 u, z+ L  h5 j1 G
!  Ribbon styles added.
" W, P6 N% C' Z!  % k! n' f: ]9 L& x+ r" H7 W$ M
!  The RIBBON_STYLE will be honored when the toolbar is loaded
8 ?$ O% @0 O; x  n; H. R4 P3 K!  in Ribbon mode as a group but will be ignored when the toolbar ' l0 t% k0 s0 F* N8 I  R+ l1 h7 P8 p
!  is displayed in Classic Toolbars mode.6 c9 L  A$ h6 F. ^
!
7 b% |1 f) q. ]1 k, i0 T' i% E!  In Classic Toolbars mode - This toolbar will still show up in the 1 V9 d; ]6 n' f/ P" {
!     toolbars list.
$ `" c( Z  V6 {. f: h( D5 M4 A!- ]" v" y- \$ Z4 [+ T
!  In Ribbon mode - This toolbar will be automatically converted to a + a8 s& g9 a& [% M% @
!     Ribbon group and will appear in the "Classic Toolbars as Groups"! V5 Z8 b9 R, p' b( e7 I
!     section in the Customize dialog.
7 ]! p0 m3 g% k9 e4 ~!9 u0 B! Z& S5 |# K) V% w
8 m# p4 v' z' S: v2 I! n( |
TITLE Toolbar (Alternate)" ^- \3 w( j% D6 c
VERSION 170
  E$ g) _# C' `( ]6 I3 V" H$ S! Q& ^/ S6 l+ v
4 M% Y/ r7 A8 V# l3 oBUTTON CUSTOMER_BUTTON_1
" h9 r" `  {0 I) c- o- F8 s. ILABEL Toolbar(Alt) Button1( \% [  S5 p+ U4 D9 ]
RIBBON_STYLE LARGE_IMAGE, S) b9 G6 z  h" h4 P. t' T8 S' J9 m
/ U9 e, c% U9 ~0 o8 y' ?
BUTTON CUSTOMER_BUTTON_2; y9 a; w- w. v& e/ D
LABEL Toolbar(Alt) Button2- E( c8 ]: `/ Q% ^
RIBBON_STYLE LARGE_IMAGE2 G' `  m, ~' f5 [. }
: h0 b  z; _8 c& D& }
BUTTON CUSTOMER_BUTTON_3
6 f( T# k* `) u: R/ e, m9 XLABEL Toolbar(Alt) Button3
8 c! g1 S$ j" ]( s' e0 c: @RIBBON_STYLE SMALL_IMAGE_AND_TEXT" ~! j5 |8 ?, `) K( k

2 }% ~* l8 K8 E7 gBUTTON CUSTOMER_BUTTON_4; W( r: Y( [  n+ E* p
LABEL Toolbar(Alt) Button4( y! w( L7 ~% O- H, `2 Q
RIBBON_STYLE SMALL_IMAGE_AND_TEXT7 W' e2 R. q" i; W  |4 `( X$ v/ A

/ a' O- \1 w2 k, a) N8 ]$ ZBUTTON CUSTOMER_BUTTON_5
/ Z0 X5 r4 d: ]" F+ E( ZLABEL Toolbar(Alt) Button5
  N. X/ I9 ~% s* I* ~* XRIBBON_STYLE SMALL_IMAGE_AND_TEXT0 E. o0 S  G- K( P: o2 t
; }( U+ f+ P3 v" J+ H
. b% }6 ^! o# g. y9 I& a

: M' c7 |& W8 Y% Ucustomer_group.grb* v) S  v" V' e" _- U9 Q& ~' M
!* s% U6 S) w( `' n$ h/ u5 G
!  Customer Ribbon Group File. w7 w& q3 E' v) e
!
' E( x+ L0 \/ q( n!  In Classic Toolbars mode - This group will be unavailable
" S. Q3 M: o. C( q% f% [9 M/ h!" T# e# [, p3 `) g
!  In Ribbon mode - This group will show up in the "All Groups" list0 d2 m0 T9 h4 Z, b+ k- q2 E: }
!     in the Customize dialog.
; A. m, B! B& j!% n1 q+ k5 y' d
!  The labels of the buttons are defined using the RIBBON_LABEL token in the MEN files
8 b! n+ e' [" s1 D!
: a0 y  E$ c$ x1 h) J" _" h1 ^( \, @1 p8 r$ ?
TITLE Group& _  U9 K5 h, C  R, N, N
VERSION 170
; s' }1 ?# A. C; q- p% S
3 I8 C1 c  m1 J" P) j! ]7 h, E!  No LABEL defined, using RIBBON_LABEL defined in customer_men.men
. k: W9 o6 o1 y4 b# h5 D2 TBUTTON CUSTOMER_BUTTON_15 r, v  v/ y0 X! F
RIBBON_STYLE LARGE_IMAGE  y- K0 ~/ v. j' F
! z+ ?! d; x" Q% `' V. u6 v8 x
!  Example of a gallery defined in a GRB file.
4 }! G' w: k  ~! b/ @  z* f: {9 b' H! / i+ b+ s; k3 B* i% N7 b% b
!  If this gallery is to be used in other places, then it could be
# l* |8 j  f9 K+ `/ t4 @!  defined in its own gallery (GLY) file and referenced here
) L2 e% T& U) K: y3 O& s!  Example:* {2 c3 v' ~9 s0 c9 n
!    GALLERY customer_gallery.gly
! d6 W' ]4 D4 O4 G( [' |!
( U( E3 G' f4 F$ |. E; k" wBEGIN_GALLERY  CUSTOMER_GALLERY7 ~- s4 k& E, z1 s+ I& o# ^
COLUMN_IN_RIBBON 2
: |1 g4 M1 m' Q( [3 S: ICOLUMN_IN_POPUP 2( R* p9 [0 k3 ]) @+ E
LABEL Gallery! a4 z# H) {% A; h3 M. B
GALLERY_STYLE MEDIUM_IMAGE_AND_TEXT- i9 a. d" {  E( }

7 t, n2 q8 @! ?6 b    BUTTON CUSTOMER_BUTTON_2
% O3 }! A% C3 t+ A0 p7 T2 T6 W1 k% g- K* ]7 j/ ]# \3 e
    BUTTON CUSTOMER_BUTTON_3# z! t- R: c2 I% q+ D5 z6 T
% [1 E$ J3 c0 ^( m6 W/ B" t
    BUTTON CUSTOMER_BUTTON_4  S+ S+ N0 {) F3 c. J6 u
; G! d8 f- p; P; U" \' a
    BUTTON CUSTOMER_BUTTON_57 \0 g7 x- M6 i6 @' E
) `; S7 }! P$ p( H
END_GALLERY1 p: n4 N9 [1 F) y, P! @6 {" I
: }( ]9 W. E& J9 X* T

$ o2 i/ a! B. O1 {. {" 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二次开发专题模块培训报名开始啦

    我知道了