|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
1 X/ K' g0 m# b/ S* e f6 H) Y* k
) h4 V; C6 g/ R% z, X, W/ d
9 D2 f: b0 j+ I) fCreate a New Feature 创建NXfeature的标准过程
$ ], T5 U8 v5 [: |9 _, I* J1.Create an instance of the builder object for the desired feature type providing a null object as input.
8 _! z. K3 y0 j1 R' [ M3 n+ }' S创建一个builder实例,null作为输入0 j# y: n/ }8 k9 z5 ?
2.Edit the properties of the builder object to set the feature parameters and options.
0 o9 S' \9 f# H' h" G编辑创建的builder,设置一些参数或者选项/ _8 ?4 l2 t" @ \ X$ ~: M
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.
' F% a& v0 u2 A/ q+ ]使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象
, V0 b+ I8 J, a/ f6 M4.Use the Destroy method of the builder object to delete the builder object.
v9 R5 Q9 w7 u& o; @ i! C$ A* c3 }使用destory方法删除builder对象。
5 ]+ ?4 D3 O7 M' d5 k' q& S* K1 j& R编辑特征也是同样的操作过程!
5 j" ?% V& {8 }/ f7 v% f. B# L) p/ v# @* d" }1 k
代码举例:' q# H; t8 t# V2 c7 C7 s
Session *NXSession = Session::GetSession();
4 W7 a1 S* q$ F3 d* D8 [, ZPart *workPart (NXSession->Parts()->Work());
7 [% I$ k. n7 ^4 a: X9 ^# x$ U8 PFeature *nullFeature (NULL); . J# d4 n; m$ f! Q+ V
Point3d origin = new Point3d(0.0, 0.0, 0.0); 7 |0 V S. O9 D7 S7 ~
//**************************************************************************
( g7 Q; n G6 |0 g//CREATE BLOCK 创建方块: `' Z4 n' G w/ j$ m% }- |
BlockFeatureBuilder *newBlock = NULL;
$ {+ S1 B! }* u% l1 s: X! D3 ~newBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature); + {( t# k- O1 ?3 {5 \
newBlock->SetOriginAndLengths(origin, "50", "80", "100");
: X' e, \1 a; C7 A# m! q' gFeature *blockFeature = newBlock->CommitFeature(); * \& C7 A& w5 ?7 a x
newBlock->Destroy(); ' Z% \% ~8 C8 {) V2 G2 L
//**************************************************************************
8 O' P& A, l% U6 G5 w//EDIT BLOCK 编辑方块
. a+ G( w9 O( j+ k& q) Y, h/ SBlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature);
' V1 d7 @/ f m+ ^0 {: A6 zoldBlock->SetOriginAndLengths(origin, "100", "20", "50"); % i7 T/ ~4 t4 |
oldBlock->CommitFeature(); 2 t" W/ x; I4 E2 T' Q ~
oldBlock->Destroy();
4 ]: P* j( S, m) _& m5 d* I0 t3 }1 c) _* v* G
|
|