|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
2 ?6 J3 R7 w" p# g8 o) `/ t- Y- b, e! ^% P
8 \ ^: N1 ~! J# Q8 n r3 z5 R; s5 H6 l
Create a New Feature 创建NXfeature的标准过程3 ^; V* b( c& L& l
1.Create an instance of the builder object for the desired feature type providing a null object as input.
: o$ z/ K# H2 I) ?( b! K+ i$ m创建一个builder实例,null作为输入0 [3 Z. C, X/ w
2.Edit the properties of the builder object to set the feature parameters and options. 0 p9 f$ F( g0 o) E) m) Y7 a* s
编辑创建的builder,设置一些参数或者选项. p/ A/ x) u+ r5 K
3.Use the Commit method of the builder object to create an instance of the feature. The Commit method will return the new feature object. 3 T& ?8 ?+ n" J/ N
使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象
# O2 s* C' N6 h8 t" L! o4.Use the Destroy method of the builder object to delete the builder object.
0 n. l1 r6 `5 `! X; k使用destory方法删除builder对象。4 e! Z A( Q) e9 O9 Z% D' ~! `; l
编辑特征也是同样的操作过程!9 K+ d! a/ q* S; k4 N4 Q- y2 e
( p u% d0 K/ [' E8 a* t# K3 j代码举例:
# h0 X. Q8 \" ~! d/ t6 }/ H* ?Session *NXSession = Session::GetSession();
, d- S, Y( B2 U4 V( W) IPart *workPart (NXSession->Parts()->Work()); 3 E& e: \& Y5 H O- v
Feature *nullFeature (NULL);
. b3 |$ s( A" e7 \7 B# R) o7 uPoint3d origin = new Point3d(0.0, 0.0, 0.0); 8 ?+ W9 K! a6 Q- p
//************************************************************************** & r, ^, y2 i2 [' G; \7 j$ t. G
//CREATE BLOCK 创建方块
; d* v6 G5 f. x5 p# P' q qBlockFeatureBuilder *newBlock = NULL;
* H8 p) U* z- x* i, b3 O. VnewBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature); : J) ^( Y( j' s0 H! N/ m: C
newBlock->SetOriginAndLengths(origin, "50", "80", "100"); - x8 [+ h/ i5 R
Feature *blockFeature = newBlock->CommitFeature(); ) J" G- T: ]( M4 ?+ H0 Y
newBlock->Destroy(); $ Y, T @1 Q# X; x" j2 M
//************************************************************************** 2 _% _0 p6 ~. l
//EDIT BLOCK 编辑方块5 i. Y# x$ C4 I" a2 F* Z
BlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature); 5 w) {8 n5 L) U6 e* f$ V' `7 W# n# j3 n
oldBlock->SetOriginAndLengths(origin, "100", "20", "50");
8 Z, }0 R/ c. W8 [$ koldBlock->CommitFeature();
4 Z5 {1 G% \6 h. K3 Q" koldBlock->Destroy();
3 H0 j7 o2 d/ j0 `# h1 @: p2 L2 t- t8 y* h; x+ y1 F: Z" q* B8 [% G
|
|