青华模具培训学校

 找回密码
 注册

QQ登录

只需一步,快速开始

青华模具培训学院
查看: 10158|回复: 1

[疑难] 遍历子部件(组件不是几何组件)

[复制链接]
发表于 2010-8-24 13:53 | 显示全部楼层 |阅读模式
aaa.jpg
( w4 n- e8 C, ]  M/ H6 E5 l. H
+ b2 q2 c- r# W3 H使用UF_ASSEM_ask_all_part_occ_children方法只能取到B,返回的数量为1,我尝试着用NXopen/vs.net2008 c++,代码如下,请高手指点一下,小弟不胜感激 7 q1 |  r5 v% y4 l& H/ _
4 p4 ^; @" ~" n3 d
* U0 `# O" V- H+ t1 I. Q& s/ Z
//*.h文件
$ H) j% {! J+ S1 ~#include <NXOpen/Session.hxx>1 {* G: g' H/ f+ U  p: i( s/ I
#include <NXOpen/NXObjectManager.hxx>
& u* ]8 ]. U+ ^$ L+ Q, R6 x#include <NXOpen/NXException.hxx>
6 {; K4 J7 v. F& n) m2 E#include <NXOpen/Assemblies_Assembly.hxx>
# O4 ?- [( H2 Z6 }#include <NXOpen/Assemblies_Component.hxx>
0 G. E' G; ~: |! l1 C#include <NXOpen/Assemblies_ComponentAssembly.hxx>
$ t0 Z) o" U0 Z0 o4 W- G  f#include <NXOpen/Part.hxx>8 a9 ?% _, ]  u# q
#include <NXOpen/PartCollection.hxx>/ u% A' L9 [" I2 K" c0 U! r+ a# l
#pragma comment (lib, "libnxopencpp.lib")
0 `7 _2 c5 X5 M8 D) f5 b+ @  z$ U+ h3 ~
/ z* T7 I1 _1 q3 b
//*.cpp文件
6 ^$ n; f$ E: V' I" [ NXOpen::Session *theSession = NXOpen::Session::GetSession();' {& g! t' X: R* I( A/ P
NXOpen:artCollection *partcol = theSession->arts();/ E, ^% Y% t/ g7 W. A
NXOpen:art *displayPart(partcol->Display());
- M) U: n: l9 _' D NXOpen::Assemblies::ComponentAssembly *compa = (NXOpen::Assemblies::ComponentAssembly *)NXOpen::NXObjectManager().Get(displayPart->Tag());
( G6 s# h* N2 }$ X# c NXOpen::Assemblies::Component *comp = compa->RootComponent();8 z( \' z- O: p( f( p" Q4 ]: o6 N
std::vector<NXOpen::Assemblies::Component*> vt;
/ h4 c& G& w' k! d& X. R vt = comp->GetChildren();  //到这里就崩溃了,郁闷中。。。
) I3 P  L8 ^+ G int nn = (int)vt.size();
 楼主| 发表于 2010-8-25 13:11 | 显示全部楼层
自己解决:  O: M) Y/ R; ?# i) q3 F) @
UF_ASSEM_ask_all_part_occ_children方法遍历不到C
" c7 N5 i& l) C( s+ n. t" n1 n; ?0 `使用UF_OBJ_cycle_objs_in_part  }: r& t8 ]& d4 H7 z! p
type的参数用UF_component_type 就可以了。
回复 支持 反对

使用道具 举报

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

本版积分规则

QQ|关于我们|sitemap|小黑屋|Archiver|手机版|UG网-UG技术论坛-青华数控模具培训学校 ( 粤ICP备15108561号 )

GMT+8, 2024-5-28 16:19 , Processed in 0.072054 second(s), 28 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表