PLM之家精品课程培训

PLM之家精品课程培训

联系电话:18301858168   |   QQ咨询:939801026
NX二次开发培训

NX二次开发培训

UFUN/NXOpen C++和实战案例

适合初级入门或想深入了解二次开发的工程师,本培训结合ufun,NXOpen C++,大量的实例及官方内部的开发技术。
公众号二维码

关注公众号

点击扫描二维码免费在线高清教程

课程详情
Catia二次开发培训

Catia二次开发培训

市场需求大,掌握核心技术前景广阔

Catia二次开发的市场需求大,人才稀缺。掌握开发技能潜力巨大,随着经验积累将在汽车、航空等领域有所作为。
B站二维码

在线原创B站视频

点击关注工业软件传道士主页

课程详情
Teamcenter培训

Teamcenter培训

全方位培训,从基础应用到高级开发全覆盖

涵盖用户应用基础培训、管理员基础培训、管理员高级培训及二次开发培训等全方位内容,由多年经验讲师打造。
QQ群二维码

加入同行交流

点击扫描二维码加入QQ群

课程详情
×

PLM之家plmhome公众号

课程涵盖: PLM之家所有原创视频

×

关注B站视频

所有高清视频一览无余,全部在线播放学习

×

加入PLM之家QQ群

同行交流,疑问解答,更多互助

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

Catia二次开发源码分享: 获取装配所有组件列表

[复制链接]

2018-1-10 10:12:25 2400 0

admin 发表于 2018-1-10 10:12:25 |阅读模式

admin 楼主

2018-1-10 10:12:25

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

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

x
+ O' l5 W3 q" ]8 `/ e. z7 U/ u
Catia二次开发源码分享: 获取装配所有组件列表8 A: R; ^7 E/ a& u/ B. `: |/ ~; d( w

& @9 ~2 ]+ m. d. w+ R
8 q" U6 Q1 s4 ]* m  v" r7 a* D[mw_shl_code=c,true]/* ----------------------------*/
; M% _$ g6 K+ w- d% C; L6 r        /* 2. Retrieves Root Product   */( a7 c  a! ~2 M- e7 k3 R
        /* ----------------------------*/7 T, W! \, U5 B: X3 F4 ]: p
       
$ Q* V3 `  }0 U) h$ T1 X7 V        // Begin navigation throUGh the document => start with the RootProduct.
1 F5 X7 R0 I$ s! M. k& L; h! o+ j        CATIDocRoots* piDocRootsOnDoc = NULL;6 u5 c2 I# F9 a/ s4 i5 c6 }$ N( j+ I
        rc = pDoc->QueryInterface(IID_CATIDocRoots,3 c) ^. |& X/ _9 v6 R6 C0 M
                                      (void**) &piDocRootsOnDoc);
; v% ~9 r& B. F* \2 N% U( Q/ F- m        if ( FAILED(rc) ) return 3;
* i! U8 S/ `# g! g+ n& P) C: ?1 r        / W( y6 `( K6 W0 ^! [
        // get the root product which is the first element of root elements
7 Y' e) V  U, X: c& I  _        CATListValCATBaseUnknown_var* pRootProducts = 7 l! w9 u$ C7 c9 T, h
                piDocRootsOnDoc->GiveDocRoots();5 K, S2 ^/ f! q. b$ Z; f2 I
        CATIProduct_var spRootProduct = NULL_var;, W# U. g6 _) y; {1 f3 n, ]9 a1 D
        4 C# x7 r. k2 R% A
        if (pRootProducts && pRootProducts->Size())
) r% t8 Y: F9 s1 J4 [' t1 d3 A        {  $ a" \$ G3 `+ c* v
                spRootProduct = (*pRootProducts)[1];( Q' x; x- g# o
                delete pRootProducts;' T: h, ~& F! H
                pRootProducts = NULL;
6 [& G- u) B  a        }! [+ T4 _- x8 L% {
/** @anchor err_1 piDocRootsOnDoc not set to NULL after release */
0 P9 d& ?4 y! W- w3 H& _! Z; B# l        piDocRootsOnDoc->Release();
4 b" _  O( k  R! c5 {3 x        piDocRootsOnDoc = NULL;
0 m, c# f; N! B        + T6 Z! w- y1 p
        // Get CATIProduct handle on the root product.  q$ K; t3 c/ f* E8 M" t
        CATIProduct *piProductOnRoot = NULL;, D" S% S1 |0 l  K7 z, u, S
        rc = spRootProduct->QueryInterface(IID_CATIProduct,
+ G, f5 I& U* X' d, p' u" Z9 j, }                                               (void**) &piProductOnRoot);
2 p$ D9 ]& ]$ c+ t! k/ ~0 ?        if ( FAILED(rc) ) return 3;" Z! z6 j7 R' p6 \4 \1 Y! @: E
: g' p7 W) F( [1 G
        /* ---------------------------------------*/
6 H) o& y1 Z7 m, {7 O- U, }- F        /* 3. Retrieves children under the root   */
6 a0 Y5 {; A; ?9 L        /* ---------------------------------------*/
$ p2 h' r& }) g4 M2 t       
4 @5 A5 Z( y( ?! O        int nbOfDirecTChidren = piProductOnRoot -> GetChildrenCount() ;
6 M) b5 _# F, P8 e  ]0 w        cout << " Number of direct children under the root = " << nbOfDirectChidren << endl << flush;* v) G  W0 b& s/ h# X$ r9 @( s
        2 Q; u% f3 _! d" `
        // then on a root product, get all the children agregated to it.
: f4 R: c& q2 c: z! s        CATListValCATBaseUnknown_var*   ListChildren =
- y" i# S; o/ ~7 R) T                piProductOnRoot->GetAllChildren();8 D. a6 i' _- _! x) A- I
/** @anchor err_2 piProductOnRoot not set to NULL after release */
/ r- P# J, ?- a: i6 I        piProductOnRoot -> Release();
" _; l& _, K( `6 K        piProductOnRoot = NULL;8 B, D8 |8 B* ^4 w
        if(NULL != ListChildren). C# R/ B* X  `8 s$ t. W' P9 I- L
        {
/ [% _8 Y; L/ c2 ^3 L# I                / X0 W4 E6 G/ m+ _
                int numberOfChildren = ListChildren->Size();
. O7 e7 t8 `& e/ H                cout << " Number of all children under the root = " << numberOfChildren << endl << flush;
5 i( I$ u/ S$ a4 p# ]$ Z& q
  H  F& [& n, Q  U/ |+ m6 Z                /* -----------------------------------------------------------*/
: ?( R5 x$ c) {5 L                /*  4. For each child, get its partNumber, and InstanceName   */
0 U( a. \5 B; |8 M. h3 S                /* -----------------------------------------------------------*/
- D! v4 ?! a5 F. f4 H                CATIProduct_var spChild = NULL_var;& Q6 }8 A1 z" }+ C& H4 T' z
                for (int i=1;i<=numberOfChildren;i++)
1 N* s8 {0 A8 G( ?! T; w- O                {
' _( e5 [+ q3 n% R+ c. e7 Y% S% b                        spChild = (*ListChildren);/ h; q6 F+ V& t. l1 b" i, {# j9 ~
/** @anchor err_3 spChild not tested before use ( if !! ) */ - K1 v7 M/ {- w5 q
                        if ( NULL_var == spChild ) return 4;- w1 K7 x' X6 M, B& i
                        CATUnicodeString partNumber = spChild -> GetPartNumber();0 ^( c! }$ s' `, ~, [" N! \7 C1 B
                        CATUnicodeString instanceName (" ");
$ S; q8 }( j" D' r- j7 W; c8 {                        rc = spChild -> GetPrdInstanceName ( instanceName ) ;5 B0 u5 w+ k( j  o4 m. i) N9 F
                        if  ( FAILED(rc) ) return 4;2 \! B" z: e' q8 n; `; [0 B( a% \
                       
9 e7 ]! `% p$ x/ f* J                        cout << " child number : " << i << endl << flush;, ~1 A; H2 R3 w) G8 \2 @  J
                        cout << " has as part number : " << partNumber.CastToCharPtr()  << endl << flush;
4 _2 W1 F( N& R9 ]                        cout << " and as instanceName : " << instanceName.CastToCharPtr() << endl << endl << flush;
" u6 Q4 ?+ _- x- z                }
5 B& R2 E, A; x+ F8 \                delete ListChildren;, |1 U( `8 m: z8 u* V# E
                ListChildren=NULL;
6 N5 X. V6 W* U9 _        }        " @5 l/ z8 O( Z' I5 M
        /* -------------------------------------------- */$ {. f0 \4 F- b, Q+ Q# j5 s" s
        /*   Ends the session                        */4 }& N) z" u) d  `. d5 F6 V
        /* -------------------------------------------- */[/mw_shl_code]- {* g2 v0 T/ \! }  H0 W# C, \  w$ y
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.diantuankj.com/ doTeam.tech
回复

使用道具 举报

发表回复

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

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了