|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
4 w& Q" v9 m6 |" i* g, A- ~
$ n! @: n( x4 Q1 h- C N& R) ?* Z
& r( P- D) ?, h% z- V! N% w
Create a New Feature 创建NXfeature的标准过程
2 I7 L2 V7 T$ q7 h/ ^1.Create an instance of the builder object for the desired feature type providing a null object as input.
; z3 C1 K9 N0 b. [' p! [- z% R: p3 }. I创建一个builder实例,null作为输入
) p/ ~, F- Q" [; w% N u2.Edit the properties of the builder object to set the feature parameters and options.
4 t9 a. i$ f J' j8 d% W/ X编辑创建的builder,设置一些参数或者选项( k: _4 O$ B, N+ w( R, p3 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. J! p! ]. \$ q' |3 e
使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象
8 U# z2 l x) w. G t9 C4.Use the Destroy method of the builder object to delete the builder object. J' @; Q8 ~, P- h( d( b
使用destory方法删除builder对象。; ?% Y* i& k# {! f
编辑特征也是同样的操作过程!
# n) c. }0 ^9 Q8 x4 _
) A1 C$ i; p, o代码举例:
- _/ N/ w' \. j8 u3 [& Q, ?$ USession *NXSession = Session::GetSession(); : d( S& P. K: r+ B5 W3 N8 L
Part *workPart (NXSession->Parts()->Work());
! {, @1 ]% ] W; A4 H/ M& X5 v& \2 ZFeature *nullFeature (NULL); 6 I4 W9 t2 p" b6 p! C' `7 i
Point3d origin = new Point3d(0.0, 0.0, 0.0);
8 q& `( c2 G2 x//**************************************************************************
* \$ D0 t, z. I4 P7 e//CREATE BLOCK 创建方块
, |7 w3 K' Y3 n3 rBlockFeatureBuilder *newBlock = NULL;
: z4 ]) ]4 O, p# Z5 M D" EnewBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature); . e0 w; j! e9 _7 g$ S
newBlock->SetOriginAndLengths(origin, "50", "80", "100");
( m `, o E" s* F# MFeature *blockFeature = newBlock->CommitFeature();
# `# ^6 L; i/ P+ h2 [! L; bnewBlock->Destroy();
# _1 E( c& k6 h" B8 Y//************************************************************************** 3 Z# \- i' v5 ]! N% P
//EDIT BLOCK 编辑方块
/ @. N- I) B' c- o6 hBlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature); 0 ?) N% P3 r3 }5 |' f4 |' S3 @( p
oldBlock->SetOriginAndLengths(origin, "100", "20", "50");
( u& m7 [5 A+ e8 JoldBlock->CommitFeature(); 6 k/ ]% g& ~2 g7 v* ^7 k
oldBlock->Destroy();
! R' I* N8 t" ]% [; |+ u& k% Z8 W- a) g; G) S
|
|