查看: 2759|回复: 0

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

[复制链接]

6

主题

4

回帖

60

积分

管理员

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

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

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

×

/ w9 k4 V2 g( r# ~  g, c! b% P: y6 h. O* d+ k5 i
7 I& {* Z: w$ }5 u; D
' W3 L# z4 U, R7 f3 |: }! A
首先认识下关于菜单的后缀文件2 e: t- k: y2 _3 m# S
  a/ e1 U9 o0 t2 x2 W% f2 h
Extension
UI object
.tbr
Toolbar
.grb
Group
.gly
Gallery
.ddb
Drop-down
.rtb
Ribbon tab
.csb
Cascade
.abr
Attachment
2 E# l4 H" b8 t# T5 c1 h; Q! u
' q: z+ M1 E  }! J' T
RTB作为菜单ribbon 界面定义的关键,详细信息如下- b; z- u( D& e- i  `  N4 Q

0 S7 J0 e5 R7 u3 P
6 F& w6 Q6 U0 x# m3 d2 x+ `customer_ribbon_tab.rtb
) R" y5 @( }: W# m8 G$ W!
2 V: a- r+ R# V* f6 n0 [!  Customer Ribbon Tab8 V( E# S, g% N4 j
! $ v; v8 q. ]$ c
!  This file will create a new customer tab containing three groups and5 V- k+ U+ ?3 P) m6 `$ _
!  one top level button.
0 a/ {  m9 ~$ U- E' V!
% m7 o% T; U8 N8 q# G& P, V0 u- P+ V9 a% x
TITLE  Customer Tab
9 l( J+ q! q% V: ]- m6 EVERSION 170
0 E3 v# D- y- ^' f
' I, J! G$ P2 ]!  The first group represents a Ribbon group that references an existing 4 X+ o' b  x( E* z1 z0 ?4 G
!  toolbar with no Ribbon style changes.  
& Y) Y: @$ J5 n- o" g!
2 L5 u  }, H! j1 i5 M6 d!  This is the quickest way to add existing toolbar content into Ribbon mode.5 b6 @$ _5 ?1 }$ |. ~, ?" h
!
5 t! L5 l9 v& g! U
GROUP  customer_toolbar.tbr4 J7 u7 k7 H4 j, d
! 如果想直接切换tbr 到 rtb,这是最快的 8 o; @9 |+ p2 S' n; y! p
!  The second group represents a Ribbon group that references an existing ! l# g: |3 N7 p$ \: O2 W, e
!  toolbar with Ribbon specific style changes added to it.  There is no difference
2 w; u! V; ?0 `- |2 ^!  in how this toolbar is referenced in the .rtb file compared to the first
1 M6 {* K+ j- f7 D8 _!  toolbar as a group.  The only differences from the first group exist within
% E4 ^3 i( M' s$ k5 k+ I!  the .tbr file itself.
/ n/ K; {, j$ A* t!
, r4 K9 P, q1 k/ ^) \0 }!  This approach has advantages for customers that will deploy both Ribbon and4 m1 w1 |5 r, p
!  Classic Mode customizations since all the content is defined in the .tbr ) C+ W$ c: C9 O" }8 F: j( w3 Z' g
!  file and it will stay synchronized in both modes.  Only one set of customizations! g/ `/ c  Z3 E5 b8 I  N
!  will need to be maintained while still making use of RIBBON_STYLE to # a# X# z. L2 j7 a
!  control the presentation of the buttons on the Ribbon.
% u/ x* w6 ?5 D0 N' \!( |& k- s# b  n" w' L# v& v
GROUP  customer_toolbar_alternate.tbr
3 W& V9 C2 J. d) K9 a: B. P# ^4 {4 L
, y' D& {$ H+ F$ ^* B; f8 H6 _!  The third group represents a Ribbon group that has been created explicitly
3 _4 T" Q, Z# b* z; L1 b- u4 m7 q1 u!  as a Ribbon group and will not exist in Classic Toolbar mode.  This is the( e; k4 N& e8 X- C" s
!  preferred option since the user will be able to take advantage of all the : w2 f6 P4 X& \4 Z; j8 L3 X1 C4 \
!  layout styles and containers offered by the Ribbon.  
; X5 U" K# q+ V5 H2 f3 B!
; a5 B( _( q( w3 e; V7 @# E  ^5 |!  For customers that will deploy both Ribbon and Classic Mode customizations, ; ]5 ?6 _9 M8 n
!  this approach will result in no synchronization and two sets of customizations / Z# @  b0 X7 @  R1 M6 k
!  will need to be maintained.# a, h9 z! q, w$ S2 I, ^# P
!7 N: k3 ^5 t  T! c' a8 j
!  A group can alternatively be defined directly inside the .rtb file by using the# l+ U6 }1 q5 b: ^( V: G& s
!  keywords BEGIN_GROUP and END_GROUP.  9 @" O2 @# C+ Q/ V9 C
!
; [; T, x4 e6 F! v3 t8 d' xGROUP  customer_group.grb- y, C1 V% a) e' n2 P: k
0 a/ S( m% W) R' j$ P& ~9 p2 B' `
!  Example of a button that is placed directly on the Ribbon without being
) ~. _# S* ^& B  ]6 }!  contained in a group.  This is a simple way to add a button to a tab  ?( u6 o6 c& w/ N7 N. E8 S& n/ n
!  but is not recommended for many buttons since groups have advantages.
0 }" t; P5 {  P8 V!  
+ O9 }/ {) ?3 R/ r!  A few advantages of groups:: P: m0 s0 |4 l8 A# |* g
!     1. Easier to move many buttons around together in quick customization.  / D+ V  |/ R4 k1 {. Z. @8 _9 `  ]
!        For example, MB3 on a group and choose "Add to Left Border Bar".  4 ~8 }" ~" J! M1 V- z* H
!        This will move the whole group to a new location.  If buttons are - m1 Q8 S0 d0 Z; J
!        not in a group, they need to be moved one at a time.
  v; o; v- g( O  _8 c, Q) [!
7 a( Y$ [7 |* N6 v, h- K!     2. Provide a label to describe its contents.8 r% @8 s8 G" s& x; Y5 t) a& ~
!
7 o1 J' ^- q! @6 j& w: TBUTTON CUSTOMER_BUTTON_1) p0 n' a3 F& x7 v
LABEL Button1 Directly on Tab
% c2 d% m9 _6 @- m: Q
& {8 K5 K5 P; t( m7 ~. }
部分菜单可以单独写成group gallery 作为对应后缀,重复调用
, U! \! ^$ S( B9 |# [) E7 ~& H/ u!  Example of a gallery defined in a GRB file.1 U7 x% l* C4 f
! 9 g5 |' {+ w3 o% w2 G/ h
!  If this gallery is to be used in other places, then it could be ) G+ |# J* }% @& C, I, h
!  defined in its own gallery (GLY) file and referenced here: j7 `9 b$ h) q$ N2 M
!  Example:1 a! t& i: _) K4 z" B7 Q
!    GALLERY customer_gallery.gly
% b* Z! H3 W, t' n& h4 ?! h!
! b5 Q- H' z  M! h# R0 u8 j8 m8 b% R$ {BEGIN_GALLERY  CUSTOMER_GALLERY0 O- z" n7 z/ i# f& |3 b' I; i
COLUMN_IN_RIBBON 2
8 `6 j3 D* V, e+ T( I, H9 r* J/ OCOLUMN_IN_POPUP 2) x9 U: q1 t8 G: Z( b
LABEL Gallery2 @) K1 m" c% W
GALLERY_STYLE MEDIUM_IMAGE_AND_TEXT- k, r7 |5 x2 ~4 f" h3 I

) O1 p9 B; ?2 r' ]0 w    BUTTON CUSTOMER_BUTTON_2' M- s- z# F( a9 B5 _/ H+ P
    7 F4 \4 Y# l0 \& E( e
    BUTTON CUSTOMER_BUTTON_35 L( h4 U6 T: n( {/ b
   
- c$ p# b! P4 M7 m$ n    BUTTON CUSTOMER_BUTTON_4
# H) Y/ i1 o  y- b    2 W! Y0 E" v8 O7 j9 U4 f" i
    BUTTON CUSTOMER_BUTTON_5
  G8 E  q2 V9 [( W0 z   
! Y  {# @& g' K) B: tEND_GALLERY
& r4 L1 V2 x& d; g- \. s( T
4 J/ z! j! g; V' ]0 S1 L: M- R/ c+ g
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.doteam.tech
回复

使用道具 举报

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

本版积分规则

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