|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
) i! M) {1 v- h1 f
" [+ I' G* V. ~
N- }+ `) Y" C9 ~
Create a New Feature 创建NXfeature的标准过程
: a, w& S y! P' m1.Create an instance of the builder object for the desired feature type providing a null object as input. ( M, }1 a2 o% [' w" O( R+ W
创建一个builder实例,null作为输入1 b+ {% z: }7 ?: O
2.Edit the properties of the builder object to set the feature parameters and options. : |" k& j6 \$ ?* |/ I
编辑创建的builder,设置一些参数或者选项& L0 m3 J4 _! \3 o% F4 w; L
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.
, {- L$ F% n, P. j6 [$ O5 h使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象 o+ [ ~; v, Q) n& e& O1 t0 v. I
4.Use the Destroy method of the builder object to delete the builder object. ! h- W# _# b' s4 }; m/ u! J. |8 n
使用destory方法删除builder对象。) P0 f9 b- T& [0 H
编辑特征也是同样的操作过程!8 f6 Z, i1 G5 @: S+ k) w
/ j! S7 D8 C' s/ A+ N2 M4 I
代码举例:
! Y4 G H, ]0 NSession *NXSession = Session::GetSession(); + g8 V& ]* K# I& \" C6 Y1 e; i2 }
Part *workPart (NXSession->Parts()->Work()); & C J; U! Y! F6 o s! ~9 Z! N. u
Feature *nullFeature (NULL);
9 ^* z2 \ E3 `- g& P! uPoint3d origin = new Point3d(0.0, 0.0, 0.0);
. m+ v, T( v- D$ j' R//************************************************************************** 2 p% J0 h7 K2 U8 f0 O& y# G5 ^
//CREATE BLOCK 创建方块
4 j/ t% `* k8 h6 _BlockFeatureBuilder *newBlock = NULL;
H$ U H, j3 ]7 f3 s% Y0 hnewBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature); 7 T) G" m, H" `- v+ k4 v. z; Z+ d) E
newBlock->SetOriginAndLengths(origin, "50", "80", "100"); 6 s8 |) @. B9 v0 _1 j
Feature *blockFeature = newBlock->CommitFeature();
1 K9 I4 H! V( [! F0 @1 V" anewBlock->Destroy(); ) `. I v; @+ l4 l: E6 U4 k2 i
//************************************************************************** 5 _/ Z% ^; j R' k) I0 B% a
//EDIT BLOCK 编辑方块# u2 V5 B6 x+ U
BlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature); - @0 I+ E: j/ G, {' F8 O1 _3 v" c1 J
oldBlock->SetOriginAndLengths(origin, "100", "20", "50"); : f7 A6 v) i% u- P0 p
oldBlock->CommitFeature();
( k+ `6 K& {0 O: uoldBlock->Destroy(); ( Z+ {6 G& v8 E% F
2 h1 q, V" Q0 J$ e' T) B: S- ~ W |
|