|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
: h' J' i$ j1 _4 o- b7 P$ a% F. |' f T( V! u3 A- W) \
- ~2 U3 ^9 }: P. s7 T' m
Create a New Feature 创建NXfeature的标准过程: g0 y4 C1 R% Q& K, [
1.Create an instance of the builder object for the desired feature type providing a null object as input. " g/ B; g: K; ]2 s* ^+ _
创建一个builder实例,null作为输入
% y' [+ j5 R' S; J6 W0 c2.Edit the properties of the builder object to set the feature parameters and options.
( b8 j- a5 w' T a- p编辑创建的builder,设置一些参数或者选项) G9 C$ L) j) g1 G
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.
. q: X1 p' d3 | t$ ~使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象
2 I1 _3 X# _- L3 h4.Use the Destroy method of the builder object to delete the builder object. ( [1 H# K" V$ @% s o. R* Q% ~
使用destory方法删除builder对象。
+ v+ \4 b0 n8 f, F( Q) {5 x编辑特征也是同样的操作过程!
( Q- s( g5 D: c* d$ f7 n1 }1 h* y
代码举例:5 N' ]( |' e3 r
Session *NXSession = Session::GetSession();
7 b% l4 L( s& D. Q5 ?Part *workPart (NXSession->Parts()->Work()); ) ?* C; ~/ @6 u( H! L4 l
Feature *nullFeature (NULL); ! y& M z8 L& ?0 K3 b
Point3d origin = new Point3d(0.0, 0.0, 0.0);
2 u# H, h# y/ Z$ M/ F1 z' W//**************************************************************************
: m1 W, q3 \6 y# i7 ^3 p//CREATE BLOCK 创建方块
0 c7 [ F& C2 w0 f$ x e/ sBlockFeatureBuilder *newBlock = NULL;7 s: e0 p! P1 O* ^6 t
newBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature); % h: @: F( K+ U& u. m7 H
newBlock->SetOriginAndLengths(origin, "50", "80", "100"); % @. {2 O% I7 E& y) ~0 b a
Feature *blockFeature = newBlock->CommitFeature();
, w1 E2 @5 R% M$ N* `6 _: ]; SnewBlock->Destroy(); # g6 E& ^; h" w1 F) O# F
//**************************************************************************
- C6 z9 b2 Z8 M//EDIT BLOCK 编辑方块
. k4 G, I5 v, C' D2 ?$ ^BlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature); ; Q! z' ]6 N8 e
oldBlock->SetOriginAndLengths(origin, "100", "20", "50"); / H' l+ }0 @9 z
oldBlock->CommitFeature(); U% A. L8 O; _) X& P* @$ P" }
oldBlock->Destroy();
! b! ?7 ^7 V5 [. t9 Y
* L; U9 I! H- C: ] |8 A0 O/ u |
|