|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
# n. j# j: O$ w7 ?7 [; d8 G5 z, e2 d: j) P
! t1 e- a# @. p) x m- i5 gCreate a New Feature 创建NXfeature的标准过程
) z2 q5 a( g; ?, i x% M1.Create an instance of the builder object for the desired feature type providing a null object as input.
& W4 W6 O5 L, y# J创建一个builder实例,null作为输入 Z) S- ~4 g$ F' y
2.Edit the properties of the builder object to set the feature parameters and options. 1 a2 A0 e# w1 z, p+ v2 Y
编辑创建的builder,设置一些参数或者选项$ |7 d: Y8 T+ d) q
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. ]9 C- A- @6 ]
使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象- t! {, T' D) d
4.Use the Destroy method of the builder object to delete the builder object.
# I( o5 o1 n' w0 V& o使用destory方法删除builder对象。3 k1 m2 P# W$ T6 {
编辑特征也是同样的操作过程!
5 w+ S; \0 O, g/ |5 j) F0 F! y. ^1 r; k4 c
代码举例:
& Q* m* _) _/ U- v K aSession *NXSession = Session::GetSession();
% q9 [) e9 \( a% ?: J0 iPart *workPart (NXSession->Parts()->Work()); 3 B; m% r+ k$ n* l8 C8 R
Feature *nullFeature (NULL);
/ r; l1 Q A7 A, U: S& mPoint3d origin = new Point3d(0.0, 0.0, 0.0);
( F' c" v1 e& j7 N* f//************************************************************************** % V+ o1 V# l6 i; }
//CREATE BLOCK 创建方块
* @, X( E Q [, a' v; vBlockFeatureBuilder *newBlock = NULL;
1 {2 p5 q& n" f7 |' tnewBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature);
- e. e' v$ t- [$ `newBlock->SetOriginAndLengths(origin, "50", "80", "100");
4 ?* N* B# i* h! n0 q5 k: C; Y( UFeature *blockFeature = newBlock->CommitFeature(); % w" @7 m6 L0 I9 Z% |- ^
newBlock->Destroy(); 2 Y2 F: s1 o( q
//************************************************************************** * ]; {3 o D3 b1 i* m
//EDIT BLOCK 编辑方块
, T) j+ n5 t8 ]BlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature); 4 k# {( H7 D3 z% j5 e4 w ]: S
oldBlock->SetOriginAndLengths(origin, "100", "20", "50");
' _. j2 M0 E8 @/ goldBlock->CommitFeature(); : D$ e+ E" z7 S# |/ t8 o9 E6 [
oldBlock->Destroy(); ( _' ?& n" [/ ~4 r. o U
" g) J* ~& V' D) p8 \. d0 R
|
|