查看: 2578|回复: 0

[资料分享] 关于NX二次开发 Ribbon菜单定义技巧

[复制链接]

4

主题

3

回帖

44

积分

管理员

积分
44
发表于 2018-12-25 16:10:57 | 显示全部楼层 |阅读模式

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

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

×

+ v  {/ x' N: B2 [& M
, t6 B. V2 `2 T% M
  s; N5 f6 Y8 n: }5 r, ?" v' w; _( |  r' D/ Z. t# A1 }
首先认识下关于菜单的后缀文件3 {0 ]* J; V( M* Q+ B, a
- I/ p/ |. s0 Z3 E9 l( J/ P
Extension
UI object
.tbr
Toolbar
.grb
Group
.gly
Gallery
.ddb
Drop-down
.rtb
Ribbon tab
.csb
Cascade
.abr
Attachment
2 U0 X" i( J0 B* W9 g
8 N& |* X. W7 M  ]
RTB作为菜单ribbon 界面定义的关键,详细信息如下4 i7 c. w- M% n1 I1 P
: m/ l3 X" X: \, C" S( a8 |9 d
+ b6 h2 ]: E  \5 y; a6 @+ f5 x
customer_ribbon_tab.rtb
+ O# J; H) s$ n0 {% u( n# W!
2 Y1 j& B2 U& M& y!  Customer Ribbon Tab
5 C& X7 i% J5 ?, C. Q! ; R8 e" g0 D+ q. x
!  This file will create a new customer tab containing three groups and
/ l( T, q) b' o7 f) @% f# G!  one top level button.; X$ @, ~3 P. S6 W( u4 o
!
. E4 i0 D3 w& w% g, V
# M  q' K2 \7 |TITLE  Customer Tab
& l+ U# G/ Q4 K# \/ zVERSION 170" T' Y( c$ A7 i, _
: g, G% N& T+ u' O& p2 {+ O! A
!  The first group represents a Ribbon group that references an existing
7 p7 \9 f5 }7 M& e! S6 R6 V4 R!  toolbar with no Ribbon style changes.  " D, m8 Q8 u) g1 O! u
! , ?' I" F; R& t# s0 x2 f# ~8 Y
!  This is the quickest way to add existing toolbar content into Ribbon mode.
; M, C8 O8 L+ B& }!8 {" B, t! j2 l9 [
GROUP  customer_toolbar.tbr
/ x0 i  h2 `* V- t% R4 h. I" w7 _# y
! 如果想直接切换tbr 到 rtb,这是最快的
( A2 j2 }' ^- }; e- O0 P  a/ S!  The second group represents a Ribbon group that references an existing 1 u: @) |3 D' T4 }9 i, S
!  toolbar with Ribbon specific style changes added to it.  There is no difference
2 ~3 A& |$ w. _1 Y, D; @4 F4 D! y!  in how this toolbar is referenced in the .rtb file compared to the first
6 E# s' S5 I# E8 M( j!  toolbar as a group.  The only differences from the first group exist within / O! ]. ^4 n5 L6 }/ U7 _
!  the .tbr file itself.
! i1 R- _! S6 H  B" u8 [4 g!
. t. Z/ }1 |0 R!  This approach has advantages for customers that will deploy both Ribbon and
# F5 O6 a$ f6 ~! G- L( C!  Classic Mode customizations since all the content is defined in the .tbr ( D: }5 _4 s* Y; g
!  file and it will stay synchronized in both modes.  Only one set of customizations: B0 P; {. U; d+ w* }
!  will need to be maintained while still making use of RIBBON_STYLE to 9 }& o% N7 Z  z7 U4 D
!  control the presentation of the buttons on the Ribbon.
0 E( n) p% Y4 f% V  l- [5 v4 |!4 e9 b; S9 |9 Y+ ?2 S5 h" m
GROUP  customer_toolbar_alternate.tbr: V5 z  A) @6 M  O/ }
6 i5 }9 }- T3 T* [' f  Y
!  The third group represents a Ribbon group that has been created explicitly
4 `- Q( `6 k: X& p& w% M7 ~: Y$ ~!  as a Ribbon group and will not exist in Classic Toolbar mode.  This is the
0 y9 X" C, w% R$ A" P! c5 Z!  preferred option since the user will be able to take advantage of all the
2 t" \8 ?' y+ G7 n9 l!  layout styles and containers offered by the Ribbon.  + n/ j; @2 N- q$ q
!5 j5 `& D& T5 Z( r
!  For customers that will deploy both Ribbon and Classic Mode customizations, 7 D9 X4 `6 Z8 Y( @- \
!  this approach will result in no synchronization and two sets of customizations 9 i6 S& a1 N$ l) W) H0 f* G1 R0 b/ `
!  will need to be maintained.% d; G6 I) ~- L
!9 |0 |3 C' q8 x$ k3 i# o4 S: s
!  A group can alternatively be defined directly inside the .rtb file by using the( v1 H% I  l# |, A
!  keywords BEGIN_GROUP and END_GROUP.  
+ |" p. t* b/ x! U9 l* `!  t9 n: G8 r6 Q5 p, F7 ]% \
GROUP  customer_group.grb/ _, m) R8 e4 c' g

6 e$ }9 k, o4 s2 R!  Example of a button that is placed directly on the Ribbon without being1 N  m% H  U5 m. S
!  contained in a group.  This is a simple way to add a button to a tab
* T2 u& I( @' ?; F  s( e8 R!  but is not recommended for many buttons since groups have advantages.
, O! z+ H& e# W7 I1 o" q!  # ]7 t! b2 E% c7 W; e
!  A few advantages of groups:
5 T* `$ P8 g! H' X7 o7 I6 w+ V!     1. Easier to move many buttons around together in quick customization.  
" `9 Q# o! J: d! i' P!        For example, MB3 on a group and choose "Add to Left Border Bar".  6 r' ?) ~( `* N$ s* P
!        This will move the whole group to a new location.  If buttons are
: W- ]6 L1 y( }4 I: C7 N9 G4 e0 w!        not in a group, they need to be moved one at a time.
2 e$ v6 y" G+ Z3 E$ _! O0 D0 N, [!/ J& A( z5 K3 p+ _6 S! a+ y
!     2. Provide a label to describe its contents." [$ R1 `6 s: @# T- C9 `& m* m
!
( S; y: K* Z9 Y& }5 IBUTTON CUSTOMER_BUTTON_1) }* w8 ~/ x8 L# n
LABEL Button1 Directly on Tab

: n1 G, X5 y" t% ~

4 c% q7 s& a3 D  R0 G( P
部分菜单可以单独写成group gallery 作为对应后缀,重复调用
9 _0 r  F- Z7 `. _7 E2 b!  Example of a gallery defined in a GRB file.
+ V, e- l$ Z: N4 T! p!
* ?6 L5 t% m' U; G; @- \- G2 a!  If this gallery is to be used in other places, then it could be & g2 ~' V+ a; d2 n2 R
!  defined in its own gallery (GLY) file and referenced here
& o* Y; X" z& Q!  Example:& r1 o2 ]6 H6 n5 i' E4 t; V
!    GALLERY customer_gallery.gly
: p& \% s6 t3 A. Z6 W; _!% ]4 D& i* S: S+ R2 G
BEGIN_GALLERY  CUSTOMER_GALLERY
0 @. z4 X3 r0 {' x$ CCOLUMN_IN_RIBBON 2
/ K+ i* `4 r$ ~7 nCOLUMN_IN_POPUP 20 D4 h( H  T! h2 Q# w5 U
LABEL Gallery
7 i4 w9 ]- S, oGALLERY_STYLE MEDIUM_IMAGE_AND_TEXT
# K  O' _6 V3 {" @- Q) w: Z( q
  q% j, i6 G: |4 U3 W( s    BUTTON CUSTOMER_BUTTON_28 a2 W5 i' R* X, W
    0 r5 A) M: Y" U. K8 A4 ^5 N! T/ A
    BUTTON CUSTOMER_BUTTON_30 p( }7 R6 m& |8 y8 z
    # S- [( ]- \$ c; v; L
    BUTTON CUSTOMER_BUTTON_4
, f7 Q+ I% w0 J/ h. ^/ R    * U& X- ^6 m( G9 I3 G. Q
    BUTTON CUSTOMER_BUTTON_5' Y; y; o( P3 k1 |# _  q0 Q! Q
   
/ J/ V) C( n* A$ ?END_GALLERY: N3 h( U  `: c; ~; k
4 N6 I' ?; w: W4 T6 g* e0 S
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.doteam.tech
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

在本版发帖
关注公众号
QQ客服返回顶部