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

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

admin 楼主

2018-1-10 10:12:25

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

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

x

* S0 W( l4 F4 }, `5 qCatia二次开发源码分享: 获取装配所有组件列表* Q4 p$ v. F3 J/ U0 L9 P

6 J) S. y1 z+ j
0 ?; R* Q& `% c0 H% z[mw_shl_code=c,true]/* ----------------------------*/
" R3 C0 x1 y/ ~3 Y        /* 2. Retrieves Root Product   *// r  M6 u- v) M3 @2 ?# u% Z$ b
        /* ----------------------------*/5 b" r9 V7 W/ p" C2 g7 k7 M
       
- W% p2 }2 U0 y% }, w3 n& Z        // Begin navigation throUGh the document => start with the RootProduct.& X0 u7 y2 z2 H1 s0 ~
        CATIDocRoots* piDocRootsOnDoc = NULL;
8 t( g: {0 R3 R$ }+ i        rc = pDoc->QueryInterface(IID_CATIDocRoots,
  B7 N8 Q( M! Z( ]3 C                                      (void**) &piDocRootsOnDoc);1 w* F. \! d0 N/ L8 Y. U  J1 F
        if ( FAILED(rc) ) return 3;
0 n& k& Q  ?0 _/ K) A0 A! K, d/ r        5 J9 R7 O' A- y/ d2 T/ R
        // get the root product which is the first element of root elements" G3 w: S" U0 n: D1 R/ ~
        CATListValCATBaseUnknown_var* pRootProducts =
/ g" Q8 d" l' s# h3 q                piDocRootsOnDoc->GiveDocRoots();! T1 G% M, c0 d! q. r5 c; k3 x
        CATIProduct_var spRootProduct = NULL_var;5 e5 N& N& l: m; \
        6 V- ]7 ?3 w( u
        if (pRootProducts && pRootProducts->Size())
1 ^8 u0 S% m$ @$ {( ?$ z& d  ]        {  
& O1 ^. g/ ]5 Z" f- e7 i                spRootProduct = (*pRootProducts)[1];% z1 r2 M: |% n
                delete pRootProducts;
4 f! p5 u5 f1 B: m2 _' A* m; p# A                pRootProducts = NULL;! B5 x3 n5 K1 @7 T; n# I/ ?
        }: t- u5 {' v# L6 X+ T, w4 b
/** @anchor err_1 piDocRootsOnDoc not set to NULL after release */ & H# h1 I% r4 M2 P! l
        piDocRootsOnDoc->Release();. N  I( s4 r' s% Y& U
        piDocRootsOnDoc = NULL;- w" Z$ S$ u* }% H. q
        ' f$ t6 _( k: N& U# Q( k- R' Y7 q
        // Get CATIProduct handle on the root product., ~, X2 b6 }# R: c  s% C% }
        CATIProduct *piProductOnRoot = NULL;
: f! t* x; w- t" s# {; p        rc = spRootProduct->QueryInterface(IID_CATIProduct,0 G  x+ k$ V& M# F) ^; Z7 F" D
                                               (void**) &piProductOnRoot);
0 q1 {! y+ u$ ~$ U/ U1 i( b# ^        if ( FAILED(rc) ) return 3;
* x# x3 |8 R# f2 H+ k( X
" D2 G9 Y8 U" k# u# o        /* ---------------------------------------*/
( M  |- f( r* v' Z: z% h, a0 W) ?        /* 3. Retrieves children under the root   */! u8 @% j% ]8 q# m; o. \5 e
        /* ---------------------------------------*/
2 i% [. U0 r) \1 ~: U. {+ k. _       
, l, W; ?. F+ W# Y7 ~6 d( N        int nbOfDirecTChidren = piProductOnRoot -> GetChildrenCount() ;' s7 ?' o8 R9 q, O& s
        cout << " Number of direct children under the root = " << nbOfDirectChidren << endl << flush;9 S* m5 V% C0 e* b! O5 b
       
4 w& y/ g/ L1 y) x$ O* G        // then on a root product, get all the children agregated to it.
* P3 c- Q+ n4 I1 N# A+ y9 f        CATListValCATBaseUnknown_var*   ListChildren =
# \. {* A4 D* g7 |" P- n) Q                piProductOnRoot->GetAllChildren();
$ n% t* r0 L3 L7 t" a/** @anchor err_2 piProductOnRoot not set to NULL after release */
; r0 I- z& S& {6 ~2 y$ r        piProductOnRoot -> Release();) ~0 }8 J3 N) v- E5 M, z
        piProductOnRoot = NULL;
+ s; x( H: P" D9 E+ }5 N! c        if(NULL != ListChildren)' o8 k2 ?" E: ]
        {
1 o2 M- U* D8 ]; ^               
1 O0 R6 @0 X) }/ k                int numberOfChildren = ListChildren->Size();
- M/ J! h: z/ L2 M; z" `/ x* a  K  X                cout << " Number of all children under the root = " << numberOfChildren << endl << flush;' B, v+ @6 p9 J* r/ m

' r& G. F: M+ j                /* -----------------------------------------------------------*/2 y5 _6 s) F& s* f, M
                /*  4. For each child, get its partNumber, and InstanceName   */
7 ?) _# p% s" D% \4 ?. J- F* u                /* -----------------------------------------------------------*/
  i+ U  Z. ]; \                CATIProduct_var spChild = NULL_var;
# E5 Q0 n+ K% I/ O                for (int i=1;i<=numberOfChildren;i++)
' s( V. G8 M+ L1 G' {                {" A% F- h6 E/ y4 z1 w
                        spChild = (*ListChildren);9 A' X$ b, u1 }# H$ p
/** @anchor err_3 spChild not tested before use ( if !! ) */
$ k: K6 Z# j# B& _1 D& v                        if ( NULL_var == spChild ) return 4;
* n7 m) f- t- x3 l5 d* k                        CATUnicodeString partNumber = spChild -> GetPartNumber();" b9 l: B- I3 z0 s6 e9 u
                        CATUnicodeString instanceName (" ");# m  {4 N; |4 s/ Y; m
                        rc = spChild -> GetPrdInstanceName ( instanceName ) ;; z2 {/ S0 N. R6 a4 z1 A( D
                        if  ( FAILED(rc) ) return 4;% j  c. [& h8 m2 B, y4 L
                        ( M% }9 N; w+ e5 k
                        cout << " child number : " << i << endl << flush;
1 g4 h. x8 r' Z  E0 t7 I7 Y) b6 k                        cout << " has as part number : " << partNumber.CastToCharPtr()  << endl << flush;
! C: a& K5 @0 O+ M                        cout << " and as instanceName : " << instanceName.CastToCharPtr() << endl << endl << flush;
5 x. b. {5 S# ~- n5 m- [                }
( X5 R% X0 S! P0 k$ s% i                delete ListChildren;
0 X, J2 C8 B; i' X! [                ListChildren=NULL;" E' N% M1 @6 y6 |* j
        }       
0 V/ L" d5 o# B% q( ~        /* -------------------------------------------- */
! H3 ?# o4 g( J" L        /*   Ends the session                        */
+ z! z" Q, q2 L+ g6 U: d) I3 F        /* -------------------------------------------- */[/mw_shl_code]2 `9 E% {- X4 G) T7 D
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了