|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
, z, C6 B9 \4 u' g' i5 J* Z& [
& H1 G6 v7 S( L+ {# @9 Y, J% x5 W
Catia二次开发源码分享: 关于创建命令和菜单方法
P3 o! P! x0 c, y* ^, X7 n9 [3 l7 p# B, Y
/ R/ g3 X! M+ L1 _2 I V+ C9 \5 ?. ]+ `% I) y9 d
//Methods implementation7 r) K$ L6 L! T+ a5 X) x+ d9 U9 a4 a
! i# i0 V8 j7 v* J3 d! a0 C% f3 Mvoid myAddin::CreateCommands()' G1 u1 f2 @. s
{
! [9 t$ N0 ?1 b new ParTCmdHeader("CreatePoint","CmdModule","PointCmd",(void *)NULL);
- C! Y- F$ \9 |- S% { new PartCmdHeader("CreateLine","CmdModule","LineCmd",(void *)NULL);
- _7 z0 H+ R H7 I1 A/ e3 }8 C new PartCmdHeader("CreateDialogTest","CmdModule","DialogTestCmd",(void *)NULL);
! W! u: H8 r& I3 V/ ^; ?}
4 J ]5 o: L$ ~CATCmdContainer * myAddin::CreateToolbars()
* {9 N" @/ C& _* _{
# U5 }- n! M$ k$ N 1 c, _1 g3 w/ y/ H7 o% a
//设置工具条
7 d+ f0 L# a, Q& w- o$ c6 h. F' J NewAccess(CATCmdContainer,pPartBenchTlb,PartBenchTlb);: q7 ^+ d1 r8 K. A+ u P
AddToolbarView(pPartBenchTlb,1,Right); }7 {1 _* _1 T" a0 q
/ {3 _5 Q, s4 T! {; G/ ?8 }( ^ NewAccess(CATCmdStarter,pPointCmd,PointCmd);5 q3 T2 U( X( l- I
SetAccessCommand(pPointCmd,"CreatePoint");! o; M3 n, S. B7 N% M
SetAccessChild(pPartBenchTlb,pPointCmd);! k" _; q3 x3 U
5 \3 c; p* J9 t7 K1 F' {9 a NewAccess(CATCmdStarter,pLineCmd,LineCmd);
/ x+ {: c; h/ Z4 K7 ]% k/ w+ J8 m SetAccessCommand(pLineCmd,"CreateLine");9 g2 l- W6 \+ Z
SetAccessNext(pPointCmd,pLineCmd); ; K! c: v6 ?8 x& T
* A2 T1 s" D0 e) z$ l0 ? NewAccess(CATCmdStarter,pDialogTestCmd,DialogTestCmd);
9 ^7 N! g% ^8 c0 P/ s' _ SetAccessCommand(pDialogTestCmd,"CreateDialogTest");% V) P' F6 M$ h; Z% W+ \
SetAccessNext(pLineCmd,pDialogTestCmd); # R) P0 l6 K7 A1 Y' s. g( _
' k8 g) D% V' R L" e1 w0 j- v
//设置菜单
* Y0 b& X4 s C# ^. W3 Q3 i f( K2 \) {) N1 D4 b F
NewAccess(CATCmdContainer,pPartBenchMun,PartBenchMun);- \+ H/ v0 g9 J$ S: N1 u
NewAccess(CATCmdContainer,pPartBenchSmu,PartBenchSmu);
. ^# a* y* p N/ X# z3 a" I5 O9 V NewAccess(CATCmdStarter,pPointCmdm,PointCmdm);
' n/ k1 Q* K( C8 m: E SetAccessCommand(pPointCmdm,"CreatePoint");
+ ^7 S9 c) ?0 }, A2 p NewAccess(CATCmdStarter,pLineCmdm,LineCmdm);
8 ?9 a4 C: `5 p/ c" A' h SetAccessCommand(pLineCmdm,"CreateLine");
6 p2 v1 u/ p. f3 } NewAccess(CATCmdStarter,pDialogTestCmdm,DialogTestCmdm);9 G5 o- x: v0 L; G9 s% {
SetAccessCommand(pDialogTestCmdm,"CreateDialogTest");4 K. z' p2 ]0 L$ y
$ S9 g% v( T$ k ]' z& \ SetAccessChild(pPartBenchMun,pPartBenchSmu);5 M6 G( e2 I4 a% p/ }! `* V; C8 B9 n
SetAccessChild(pPartBenchSmu,pPointCmdm);
0 Y7 o" z# h6 t+ b) l: x B- l SetAccessNext(pPointCmdm,pLineCmdm); 9 S& V, ?6 ]0 F `( O$ W8 [
SetAccessNext(pLineCmdm,pDialogTestCmdm);
9 i9 D) {, H9 K- s0 [! r( N% `+ R7 W4 r; S
SetAddinMenu(pPartBenchTlb,pPartBenchMun);; h# F- ?& _5 s7 u8 o
9 k. z3 t( I$ N6 A0 r6 j! ?( I3 E: b$ h' U$ s9 b* D, d
0 m! H* v9 A: _+ a return pPartBenchTlb;
5 d% S* E4 o1 P6 B, c/ B8 c
! X$ F2 t, \7 \4 c7 ?4 n0 H}
7 m$ o5 z L1 ]/ N
) _$ ]6 @& f: ]4 |0 R
' t) V" C" ?2 }' ^3 l0 A |
|