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

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

[复制链接]

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

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

admin 楼主

2015-1-9 10:37:48

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

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

x
关于NX二次开发,经典界面到RIbbon界面转换的菜单开发技巧9 ~5 I* ]6 T1 t) q

经典界面到RIbbon界面转换

经典界面到RIbbon界面转换

5 y7 \/ O2 N6 \1 H% E在经典界面下,需要的文件" D& d" o. i/ h  T
  • customer_men.men
  • customer_toolbar.tbr" V) X) D# x0 p: B. Q
在ribbon界面下你可能需要的文件 ( E3 Q4 H+ \  l5 p+ j3 B$ T" |
  • customer_men.men
  • customer_tab.rtb
  • customer_toolbar.tbr
  • customer_toolbar_alternate.tbr
  • customer_group.grb

    6 ]. c# Q0 Y: K+ U  A' Y
+ j, n( I4 l7 L* P  h
3 n& ~& B2 R! E( B
举例如下:
8 b& i% a7 I) _! e: y  t! T
: T2 [2 b6 \1 I2 J$ T2 o
5 P5 u1 }5 Q* e" I; |0 mcustomer_men.men5 ^7 N4 V( {# l! Z" {
!, {+ c2 T' }3 [, v' l/ D9 T
!  Customer menu file
/ z8 ]( z3 k" x' @' r! T! ; Q6 I- i4 i5 f$ }% l
!  Contains button definitions to be used in
! B- t; T: ^& \!  toolbars and Ribbon files6 n/ t/ C3 K. R: n
!7 L, z9 Q% |5 P- m& W

' o1 P. W2 S( Z7 q0 Y0 VVERSION 120
& h, O; y* g$ B& W# E/ ^( g" z2 [, J3 j9 }  H3 ~
EDIT UG_GATEWAY_MAIN_MENUBAR" y# v6 b1 m7 u* @. l
3 s, M; K7 i7 F' a
TOP_MENU% o) J+ z3 t3 u. F& V& ~0 x
    CASCADE_BUTTON CUSTOMER_MENU+ }+ Z' ^" q; _: Z+ c% ~! W
    LABEL Customer Menu
+ N- N0 u/ W6 N+ `8 u5 d% ]% Z& N- S7 q8 H- q: i( V
END_OF_TOP_MENU" ]4 q& L/ ~7 ~5 ~! R1 Y$ p5 @

/ v* x; P2 w% x; i' S% _MENU CUSTOMER_MENU
" J+ X9 J+ c" Z, c8 K8 }
- }3 R# S  k# B+ e  v4 K    BUTTON CUSTOMER_BUTTON_1
* P/ \* |& o  s0 i4 Y* P    LABEL Menu Button1  |, q: m2 l7 I% W0 r, p
        RIBBON_LABEL Ribbon Button1
; A$ S2 p3 G0 p/ h' V( k% }        TOOLBAR_LABEL Toolbar Button1
" [4 _8 p2 e+ U" d0 h: R$ T    BITMAP fileopen: y) |- O+ B+ U4 p! f( d" _

, S' O% B0 ?) o    BUTTON CUSTOMER_BUTTON_2" k# T$ l" ?  \. C  s% ^
    LABEL Menu Button2
: H; F/ s& X5 s0 s/ l- K        RIBBON_LABEL Ribbon Button26 v" u  |9 ~' K9 R
        TOOLBAR_LABEL Toolbar Button2: V2 A, |( t( o" M
    BITMAP filesave- Z# {$ ~# f( p, b
' a7 N" `# Z  R) Y- y9 O: q7 _  G
    BUTTON CUSTOMER_BUTTON_3$ S7 Z- h. Q1 T. s2 u1 a6 r& @) r
    LABEL Menu Button3
7 u0 b; I; H4 [        RIBBON_LABEL Ribbon Button3& v9 C/ n' C& p3 e) W% Q
        TOOLBAR_LABEL Toolbar Button3
8 [# B2 ~* e  n# f    BITMAP current_feature
& H% N0 q( n- Y% k* D, f7 u4 F( J& v
    BUTTON CUSTOMER_BUTTON_4$ F0 F2 r/ x# d' q' u
    LABEL Menu Button4# [$ l. m. a$ S$ J% j. q: _0 B
        RIBBON_LABEL Ribbon Button4
1 J" C; s# g9 @& |0 s        TOOLBAR_LABEL Toolbar Button40 `1 o9 @3 Q9 g$ ^7 [8 I
    BITMAP block
5 i! N) e( m2 l# F% d2 p( D% v& A' S* S- z9 O/ o1 H( ]
    BUTTON CUSTOMER_BUTTON_5
, f; ?+ k/ m6 g) {8 c0 @3 K/ P- _    LABEL Menu Button5% A1 U8 b' p- _% K
        RIBBON_LABEL Ribbon Button5/ n: J) U, G' j2 M' b: ?+ y7 W
        TOOLBAR_LABEL Toolbar Button5$ U: J& Z- A$ b9 [2 u- J* w
    BITMAP checkgreen; V+ d2 q+ t8 K! N1 r0 _) d8 T

+ c* ~: C" i$ \4 s* Y: V/ SEND_OF_MENU# T" @2 M# [1 j5 z; z) C

  ^" ^5 l6 h  C" [2 m' A. V+ b/ C. P0 W5 {
/ f7 p- ^, S8 Q; e5 ~
customer_ribbon_tab.rtb
+ z% d8 n$ r5 H+ ?!. Z- x+ M% x8 z- D- G5 [  R
!  Customer Ribbon Tab
" K  c& g# F/ Y" B. K! 2 w3 M9 O7 a! q
!  This file will create a new customer tab containing three groups and
, P( V( g/ M' n( n- {1 _7 R!  one top level button.
& R$ I* J& Y: Z7 C/ k!/ L/ O- s) m' G' k- X7 e

- {" ?. i- ]) h. xTITLE  Customer Tab% j& z8 d0 F0 [3 V/ c
VERSION 1701 L- @: q4 s) v. ^$ J1 E
6 f7 i5 a/ v' R% Z
!  The first group represents a Ribbon group that references an existing
' l: B  s% b, H' `!  toolbar with no Ribbon style changes.  
2 p' d+ E/ g8 V! % C3 K. B; q" ~5 M5 O4 c' ~
!  This is the quickest way to add existing toolbar content into Ribbon mode.
) Z7 Y2 w1 ~9 C- m* Y) v" O: X!: \0 _7 M' c' F
GROUP  customer_toolbar.tbr) ]1 G3 I( e7 q5 k. B/ j" w
* M( D2 G+ A% ~/ _9 a$ N& W
!  The second group represents a Ribbon group that references an existing
9 K" M+ u& s- E( `!  toolbar with Ribbon specific style changes added to it.  There is no difference
9 b& K1 \* I) d1 }/ e5 l# _% b/ @# u  ?!  in how this toolbar is referenced in the .rtb file compared to the first6 E$ ]- @- l4 m/ U5 B
!  toolbar as a group.  The only differences from the first group exist within ; \& G7 d$ F" H) v9 C
!  the .tbr file itself.4 i( {6 j% ]# y6 ?( x4 N1 e7 F
!# S, Q+ b5 P" y! |/ \
!  This approach has advantages for customers that will deploy both Ribbon and4 l  o/ V% A# O0 ^
!  Classic Mode customizations since all the content is defined in the .tbr
8 H3 D1 u( g8 j* }!  file and it will stay synchronized in both modes.  Only one set of customizations
' }& p8 R. J6 b& k8 K8 s  d!  will need to be maintained while still making use of RIBBON_STYLE to ; Q9 k5 G/ ^8 q) K8 s
!  control the presentation of the buttons on the Ribbon.. L- @9 u% T7 y  M
!
9 v1 ^6 N' O2 R, b# P: p% gGROUP  customer_toolbar_alternate.tbr
2 v; {4 x: y2 W* V/ [; p9 u2 J8 {2 q; v4 I. N1 D: s
!  The third group represents a Ribbon group that has been created explicitly8 C9 W+ C3 r* l( o" r) ]. c
!  as a Ribbon group and will not exist in Classic Toolbar mode.  This is the0 [# P: R+ z" a7 B& f5 U' s2 k
!  preferred option since the user will be able to take advantage of all the 3 ^( v2 I0 r: d' T& f( a
!  layout styles and containers offered by the Ribbon.  / {  V# A) z8 r4 s3 S! z5 {
!
! L: S/ J8 g; g5 M2 }' o0 W!  For customers that will deploy both Ribbon and Classic Mode customizations,
) V1 Q% I( e& R$ w' M) i!  this approach will result in no synchronization and two sets of customizations
: \2 D$ u4 f' F3 j3 p6 N0 L!  will need to be maintained.7 p6 h, C! ^* F; V( G. v
!0 I) N+ F1 S. L- @4 W
!  A group can alternatively be defined directly inside the .rtb file by using the
* E9 U, [% Z" e* H!  keywords BEGIN_GROUP and END_GROUP.  ' ^1 k/ T$ L8 H. X6 V3 A! I
!
1 H; Q! {) f/ K7 o% @1 KGROUP  customer_group.grb% {( V% k& F2 d
( p+ d8 W& B  f1 v( a1 o9 h3 ^
!  Example of a button that is placed directly on the Ribbon without being
1 Z: p. ]! f' Q8 M$ |!  contained in a group.  This is a simple way to add a button to a tab
( E1 w, [1 G& ?8 V( q( J- v!  but is not recommended for many buttons since groups have advantages.
5 \) P# c! c1 K* e0 [  _* p3 Z!  
0 F7 ]% z5 P. K6 I9 c8 \# A!  A few advantages of groups:
$ h3 D) Y9 K7 l& S!     1. Easier to move many buttons around together in quick customization.  
! z( Z8 I  a9 n!        For example, MB3 on a group and choose "Add to Left Border Bar".  
, o3 }/ ]3 c9 J7 ~# I!        This will move the whole group to a new location.  If buttons are
1 h5 S; l8 P7 e- x( L0 g1 |8 V!        not in a group, they need to be moved one at a time.; @0 J  @- D5 n+ [/ _
!
& F& x& p' r! Q8 Y) f" n9 R: \!     2. Provide a label to describe its contents.7 C5 m' w; R" m  b' A$ s- J6 G% H  E0 A
!
% S/ o& o0 ~! c0 R/ X0 nBUTTON CUSTOMER_BUTTON_1
/ M" b& H+ v2 d7 Q" E+ h0 ELABEL Button1 Directly on Tab
$ D+ H. j# s" B) S% W# J
  N& R" ~% K# e( D# l
+ i7 y4 u  B# S* [
; p6 Y' o0 Z/ P1 m$ j$ c% `  G1 Ucustomer_toolbar.tbr
0 l# B1 r" q4 H, z2 l, F6 C!
$ `2 F9 @# Z" ~. E!  Customer Toolbar File8 h- [$ B" `; a' b6 U. i
!. S7 W0 A$ `5 K
!  This is similar to an existing toolbar file containing
9 l& D, p* J7 I* j2 p!  no Ribbon changes.2 ?7 P# l  O& l8 \- T$ B2 R# ^& p8 W2 y
!
  r+ g8 t2 }; C/ V* N!  In Classic Toolbars mode - This toolbar will still show up in the
  u4 i4 H: a1 b) m2 N) M!     toolbars list.3 F, j; @( s( T; |- b* P
!
% i% e$ h1 d( i# O' g$ i% m!  In Ribbon mode - This toolbar will be automatically converted to a
' v; H+ g# l+ u3 y/ z0 _1 o/ r!     Ribbon group and will appear in the "Classic Toolbars as Groups"; {* K% r! a& H; y) B) G+ d# `' h: V
!     section in the Customize dialog.* N! f2 W0 ?" N
!  
& {) r; k" I- B$ a  D8 t
: m! c. o' {7 |3 \/ A$ FTITLE Toolbar
+ C" ]7 H5 T7 v3 t6 A5 ]3 j9 MVERSION 170
3 `0 B! a& a) X2 E' r* a6 X- E7 r2 g, n+ x( ^
BUTTON CUSTOMER_BUTTON_1
+ H# s! i3 R& v$ n* w, q! V3 K! X
BUTTON CUSTOMER_BUTTON_2, G, K5 V/ A5 S/ P
0 p! O% [' f$ J
BUTTON CUSTOMER_BUTTON_3; o3 `& `% I: H

/ ?  F" d9 Z' S2 J  F, P' ?BUTTON CUSTOMER_BUTTON_4' V& i' q- E5 n
& v# Z: c/ Z8 Y2 Q( N! z0 W
BUTTON CUSTOMER_BUTTON_5( ?3 U# X$ j7 z$ a5 u
" t1 ~# P1 Z; d# p

- O. |# h) i5 |' j3 S' I
  i$ A- E( N, y# G% I2 K3 ccustomer_toolbar_alternate.tbr
9 G4 w* z  t1 _* P! O* T" T( n!) X! c" n" V' o3 @5 u* i
!  Customer Toolbar File (Alternate)+ c% z2 }7 L4 t3 c' s/ a5 [
!
9 g( V* K4 K) S+ Y. V& |# {!  This is similar to an existing toolbar file with new
% e) S) j9 [+ k!  Ribbon styles added." o, V% l3 C4 I" W$ i" q; F1 Y
!  . U% S/ N' H) p4 @2 M! H( B4 M" n$ i7 y
!  The RIBBON_STYLE will be honored when the toolbar is loaded
  C5 ]: ~% |" f!  in Ribbon mode as a group but will be ignored when the toolbar ) G( n/ U$ O5 k) j* r
!  is displayed in Classic Toolbars mode.
( N, K% F$ r2 {!
" _( v* [0 I( z!  In Classic Toolbars mode - This toolbar will still show up in the 7 ]" w4 E: Y, M1 e
!     toolbars list.
9 t& G- o2 L$ q!2 r8 [3 `- A) z" d9 ~
!  In Ribbon mode - This toolbar will be automatically converted to a
( [/ i5 U/ o, o!     Ribbon group and will appear in the "Classic Toolbars as Groups"3 N2 D( }" t: x. v1 t6 u7 i3 M
!     section in the Customize dialog.
4 _4 c- V" V7 ^% ]9 C) G5 V!- p8 T. `6 g; e

; m  T( u) k: [  s0 w2 ?  h5 LTITLE Toolbar (Alternate)
8 r; @6 N% {% |# U, k3 pVERSION 1704 h/ Q; [" A, b- ~' b

6 A: C: M' S% W! gBUTTON CUSTOMER_BUTTON_1/ z, B% U$ o; B7 a$ U  p3 p' @9 w
LABEL Toolbar(Alt) Button1
; I4 s5 E/ o% z3 t2 k2 nRIBBON_STYLE LARGE_IMAGE, ~- C. |* l" ]8 e2 |1 u# ]( `# h
8 |: p2 h, c' C0 g5 M$ p: g  g
BUTTON CUSTOMER_BUTTON_2; H  K9 m/ D2 F7 I
LABEL Toolbar(Alt) Button22 H* H3 X- _  {: M# P
RIBBON_STYLE LARGE_IMAGE7 l: c+ h/ @% v" k# w
, N" c5 @: [7 V8 K
BUTTON CUSTOMER_BUTTON_3, ~7 T$ \9 l; F* y
LABEL Toolbar(Alt) Button3
8 u3 w& W' t7 m/ K' H8 C8 `RIBBON_STYLE SMALL_IMAGE_AND_TEXT
7 Z+ j( {; ]5 Y$ i" b
! A& z4 s' A* LBUTTON CUSTOMER_BUTTON_4
' s! V8 D5 w' c* G2 |. w: C- fLABEL Toolbar(Alt) Button46 p8 P$ m% M/ |: X& {9 b4 R
RIBBON_STYLE SMALL_IMAGE_AND_TEXT6 }8 g6 L4 U! G1 `9 M% P" }
( ^' |7 S9 k/ x) {8 X/ E0 O0 D
BUTTON CUSTOMER_BUTTON_5
- O8 {; x* U! ^; H9 z! _3 `6 L/ Z; kLABEL Toolbar(Alt) Button5
- K$ U; H0 U: H' D6 ARIBBON_STYLE SMALL_IMAGE_AND_TEXT
/ _: U% h. R6 o9 O+ W9 T. b! M# p; o8 f' t
8 w; E; u$ L5 x3 K1 E+ _; T; z

0 N2 D& H& M9 }" l8 V: S( @4 D  ?. dcustomer_group.grb, E: [6 `0 t) Y! Y% h! S5 z
!" f" v& M% B+ s, V$ T% i
!  Customer Ribbon Group File
. L' e- a1 |  J8 I!$ \  l  R; ^* @+ Q5 X
!  In Classic Toolbars mode - This group will be unavailable
7 J! ]* E: \$ L+ |!
( p8 @9 N5 p3 c& [!  In Ribbon mode - This group will show up in the "All Groups" list
/ M& y( @) E8 R2 O( F7 H, E5 y' Q!     in the Customize dialog.
5 x9 o; b4 `3 u3 L! U!
% a. Y: s5 l7 [. @1 q* u2 Z! m$ M1 U!  The labels of the buttons are defined using the RIBBON_LABEL token in the MEN files
; Q8 h7 g) y  R: S6 g& @) G6 R!+ B- r7 p) \# F8 `' h
5 d7 H3 ?  s* U1 v7 r6 `+ K
TITLE Group" q0 z! v2 ?& n& c( e7 v" x6 k
VERSION 170
+ U( F: z- O7 J
6 v5 Q! o8 C" l9 B. Q!  No LABEL defined, using RIBBON_LABEL defined in customer_men.men4 T# }( s# j3 E+ Z) C
BUTTON CUSTOMER_BUTTON_1
0 p: ^  T+ _9 d3 r) E  `* iRIBBON_STYLE LARGE_IMAGE8 q& f! ~) V, T- T
; Z* a! J9 @2 M7 g  f
!  Example of a gallery defined in a GRB file.
. D8 |+ d' ^8 b% A, T" C! $ z$ }$ k/ U  V1 S! ?9 _) m1 R
!  If this gallery is to be used in other places, then it could be
5 `3 E: g; S0 P8 X* d!  defined in its own gallery (GLY) file and referenced here$ F5 {1 h+ b2 ]3 B# d" p& ?0 y
!  Example:
9 Q: r5 Y6 X2 s: e!    GALLERY customer_gallery.gly; K: z+ F, {: L% P
!" j" R$ `' t- |1 t3 N
BEGIN_GALLERY  CUSTOMER_GALLERY( Z0 W6 i3 `2 ?, t& Q; _
COLUMN_IN_RIBBON 21 p: M/ E( ?) s" [- ]) w
COLUMN_IN_POPUP 2- v1 d' T  P  [
LABEL Gallery
. R( q5 `0 \, h* }/ c8 `4 sGALLERY_STYLE MEDIUM_IMAGE_AND_TEXT
9 z3 m: S7 Y3 }4 h# g
4 i# q3 F  o! r/ x1 ?7 z; ?, c, s    BUTTON CUSTOMER_BUTTON_23 u% u5 P( g: d- g. u
; v1 e% X+ N& N; W& P5 _
    BUTTON CUSTOMER_BUTTON_3; s. T% U, Y) o! g3 a
* C1 U. y- d; w* `* @+ D; b& X
    BUTTON CUSTOMER_BUTTON_4- T) l0 f+ A, L* d
4 J! D" {6 f# D# Y% G. N+ P
    BUTTON CUSTOMER_BUTTON_5
% L( t3 e4 H- R+ e( q
& r; N8 c2 R' K% yEND_GALLERY
; z( C8 N) B2 n3 g$ g% u7 U
1 r" d1 I) t( t) w" }1 K2 i4 t
: W, p3 [) P+ z( l( Q5 e+ x# D
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了