|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
/ \# U+ e% E- l' Q
. _. [* @2 {$ F+ j
5 }& W8 a4 _' bCreate a New Feature 创建NXfeature的标准过程2 z. X2 H) O" J" N/ Y
1.Create an instance of the builder object for the desired feature type providing a null object as input.
" P6 }8 h( N) f8 _% o创建一个builder实例,null作为输入
5 L9 h: }2 B8 M: q) V6 D2.Edit the properties of the builder object to set the feature parameters and options.
5 l4 F F, d! ]9 A% Z: ?7 N2 a$ \编辑创建的builder,设置一些参数或者选项
& ~) }1 q7 p( k7 A3.Use the Commit method of the builder object to create an instance of the feature. The Commit method will return the new feature object. 5 ]1 t" m' X1 ~# |+ d; G
使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象
/ G4 g3 Q% W, Y4.Use the Destroy method of the builder object to delete the builder object.
3 u, W3 T% ` b) W1 A$ Q" \使用destory方法删除builder对象。3 m0 f* u# I% V# q1 u9 r
编辑特征也是同样的操作过程!) _, K( B; s+ w0 [
6 J, t. g `: b0 W! O代码举例:
4 j G) w% i% A0 b+ USession *NXSession = Session::GetSession();
% `; `: A. U Y3 p I" P# rPart *workPart (NXSession->Parts()->Work());
% \ R+ \" c3 N( S6 j/ b0 @( _Feature *nullFeature (NULL);
* W; q W4 Z0 G) h9 ?Point3d origin = new Point3d(0.0, 0.0, 0.0);
7 N" U5 e' d0 R- q//**************************************************************************
8 B6 q( |0 x4 g6 S3 o+ q//CREATE BLOCK 创建方块
) P8 ~% H' o) MBlockFeatureBuilder *newBlock = NULL;
- ?2 N0 A8 j. |$ |newBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature); ) }! u# {& D6 f& E. R6 s
newBlock->SetOriginAndLengths(origin, "50", "80", "100"); 7 }# _; _: I, q2 @3 e* H; W% W% H
Feature *blockFeature = newBlock->CommitFeature();
: c; ]# i m7 OnewBlock->Destroy();
* u! s3 {3 ]& r: A//************************************************************************** ( f9 q+ J6 q- w6 m
//EDIT BLOCK 编辑方块
# ~+ ~. p ?' f7 ?0 w# F4 V; FBlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature);
% e& o9 ]2 x+ M& E5 ]oldBlock->SetOriginAndLengths(origin, "100", "20", "50");
% b @" ^( B$ v5 \/ l1 {+ |oldBlock->CommitFeature(); ; `* U5 B. P' X
oldBlock->Destroy();
1 c' }$ S; b% F! }& ]$ w. B8 c+ F1 q
+ B' A L# w V. X3 h' T6 H6 c$ }2 Z7 D |
|