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 2387 0

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

admin 楼主

2018-1-10 10:12:25

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

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

x
3 K0 ]9 c& m4 ^
Catia二次开发源码分享: 获取装配所有组件列表; b% H7 D% M2 l6 Y2 Z

5 h; h5 A8 a( j5 X: X7 A0 s- J' E: o
[mw_shl_code=c,true]/* ----------------------------*/8 ]. J7 Y! W2 s& H
        /* 2. Retrieves Root Product   */
/ o: R, Q0 Y5 z' Z, ]" ]1 L5 G  J        /* ----------------------------*/
" W6 m0 C$ [/ G" \, c, c# [1 }" J       
, s& {9 J( ~; p% `- ~        // Begin navigation throUGh the document => start with the RootProduct.3 e7 V* ~6 n3 z
        CATIDocRoots* piDocRootsOnDoc = NULL;! X+ z  g3 G2 h. F6 w' V4 p: B* {
        rc = pDoc->QueryInterface(IID_CATIDocRoots,
4 \* H2 v' m9 U. F                                      (void**) &piDocRootsOnDoc);
5 n- c* A/ q, S/ ]% \- m& }6 c2 e        if ( FAILED(rc) ) return 3;- [! F# r* \& M* g) i
        6 M+ M. F, B. T0 e- `" A( u
        // get the root product which is the first element of root elements6 a7 u9 H: F& S. g& i' q$ f
        CATListValCATBaseUnknown_var* pRootProducts = ! j0 o2 d$ ^, F
                piDocRootsOnDoc->GiveDocRoots();8 O$ T' s1 X, E' O0 x! l
        CATIProduct_var spRootProduct = NULL_var;' e- K1 y/ |8 b# \# F
        ( q+ h, k% @+ Z: T7 f
        if (pRootProducts && pRootProducts->Size()): u) n: ?1 w1 s$ ~. s7 ?$ S
        {  8 L5 y" N8 Q" B$ U1 `4 @8 L- c
                spRootProduct = (*pRootProducts)[1];
  W& t$ |2 |6 y( Q                delete pRootProducts;
, r( o; q( M' [/ N6 q                pRootProducts = NULL;3 \. T; L: ~' A9 }
        }
) ?# z, e) r) L3 {! s  B/** @anchor err_1 piDocRootsOnDoc not set to NULL after release */ 9 H9 x1 S9 _6 [) n" S7 j! p
        piDocRootsOnDoc->Release();
* q( ?4 A  G) X        piDocRootsOnDoc = NULL;
& _' Q! F2 e; {) Q% L5 t! N       
- F! \0 ~9 g: ?3 Y' K  _1 ], b. S        // Get CATIProduct handle on the root product.  J$ x. }& M2 f+ |- d+ ]: z8 E
        CATIProduct *piProductOnRoot = NULL;
$ o$ Z3 }% M5 P/ l3 L& v        rc = spRootProduct->QueryInterface(IID_CATIProduct,# @3 Z- j% c4 F/ ?" m. |# l- H
                                               (void**) &piProductOnRoot);& P, I, Z% z1 f- t. m& m0 s' V
        if ( FAILED(rc) ) return 3;) {: J7 Y# h" i1 W5 m
$ A  P+ D0 u2 N& M& E7 }2 n: h
        /* ---------------------------------------*/5 A1 X( J+ F# p0 L9 |( h1 q
        /* 3. Retrieves children under the root   */
4 |7 ]0 p) a! y  [, e        /* ---------------------------------------*/: j. _- G) I& N: Z3 y
       
$ D* Y& i8 X( o  F) q; N        int nbOfDirecTChidren = piProductOnRoot -> GetChildrenCount() ;4 Y. Y) w; e& h  m" G/ e
        cout << " Number of direct children under the root = " << nbOfDirectChidren << endl << flush;0 {  _0 C+ k# o
       
2 ~. P/ W' S. T; Y) i: n- K. s        // then on a root product, get all the children agregated to it.
7 p0 B- E6 b# ?$ {8 v        CATListValCATBaseUnknown_var*   ListChildren =2 C& I4 U, U/ w
                piProductOnRoot->GetAllChildren();
5 Z6 ]# l5 ?2 N/ Q  J/** @anchor err_2 piProductOnRoot not set to NULL after release */ ( Z. y3 ]7 U' Z! `( m% r3 o
        piProductOnRoot -> Release();
/ F1 ^# U( A8 `' E4 l# T, `        piProductOnRoot = NULL;
4 ?, M; y7 p6 c: h9 ^' O        if(NULL != ListChildren)
8 X2 F2 M6 o. M" e% z1 i- S& e        {3 @# _) [' b% c7 [
               
( |1 V+ y2 R7 i- r% M' p5 N( B                int numberOfChildren = ListChildren->Size();( T9 A  J; b4 o3 w: |2 J1 y6 f
                cout << " Number of all children under the root = " << numberOfChildren << endl << flush;
/ M' A* h+ R- ~2 K. _
* u5 Y& `& B- b8 s1 \6 ~                /* -----------------------------------------------------------*/1 V2 G3 G1 t1 [' U
                /*  4. For each child, get its partNumber, and InstanceName   */
- s7 Z+ u: m9 ^8 O6 s) R                /* -----------------------------------------------------------*/
+ K; B4 T8 e" i8 C! P- v                CATIProduct_var spChild = NULL_var;
: K" i: O; `  X- i                for (int i=1;i<=numberOfChildren;i++)1 M% d/ F. X1 Z
                {6 `, ?2 r6 `) k% y/ y$ [7 |
                        spChild = (*ListChildren);
* m+ L$ d% j/ m9 X5 l/** @anchor err_3 spChild not tested before use ( if !! ) */
+ a( q5 F% A5 f' y. h6 r                        if ( NULL_var == spChild ) return 4;0 {: x$ \! U1 B. K$ L5 W
                        CATUnicodeString partNumber = spChild -> GetPartNumber();4 v% ~7 u* a$ q: ]7 m
                        CATUnicodeString instanceName (" ");
% \" i7 F; k" k4 x3 M9 ]                        rc = spChild -> GetPrdInstanceName ( instanceName ) ;. u( b$ q- G# V7 I
                        if  ( FAILED(rc) ) return 4;7 F# q. O- l& T$ Z3 Q
                        7 I7 ~6 r) B; _
                        cout << " child number : " << i << endl << flush;
9 d* L9 ?2 `6 D( L                        cout << " has as part number : " << partNumber.CastToCharPtr()  << endl << flush;
1 X! h( H8 D; K, T0 q                        cout << " and as instanceName : " << instanceName.CastToCharPtr() << endl << endl << flush;# h, n6 Q8 Q1 a  A% ~- o
                }5 w" H1 [8 `. p4 Q. l3 Z
                delete ListChildren;
5 P  B6 h1 G9 {* X& O) E* @6 g$ S                ListChildren=NULL;1 R/ B# H8 ?- o' y) }1 H
        }        ( m0 Z/ `( I2 f3 t* l- ^) z) o
        /* -------------------------------------------- */6 }" g3 x4 d+ c- {* N5 Y; {4 C* d1 u
        /*   Ends the session                        */
/ M. n7 w' ~% m( ~& u        /* -------------------------------------------- */[/mw_shl_code]
2 I% V: B; _4 }
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了