|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
0 d5 Y) J: z# s. c2 {5 ]; b9 [
% z! U, ~0 t! N! B- J. O
D2 U8 V0 i: Z) UCreate a New Feature 创建NXfeature的标准过程% x& y1 K1 P0 S- s: c3 p I) g1 E
1.Create an instance of the builder object for the desired feature type providing a null object as input. % V4 y. t3 {8 x( Y
创建一个builder实例,null作为输入; l1 }; W& d7 I d/ U
2.Edit the properties of the builder object to set the feature parameters and options. , l1 L+ K# e$ U ?0 p0 X$ R* X/ p
编辑创建的builder,设置一些参数或者选项5 X7 l2 o, O4 s2 A" o
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 l& V! Q n+ @6 V$ {! Z4 J使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象0 c. d+ w1 r4 X7 Q2 B" ]1 e! Q
4.Use the Destroy method of the builder object to delete the builder object. 1 w; _$ z2 s9 W3 F% t- }0 k2 u# E
使用destory方法删除builder对象。
' l/ J9 m" W# J( U/ \! o S* G! Q编辑特征也是同样的操作过程!* e0 b2 E9 c0 c- o+ F1 B' M
* w/ V9 m$ Z7 a) R! g
代码举例:3 U0 D7 U2 s' e' @' W
Session *NXSession = Session::GetSession();
! @0 M. r; Z4 W/ L1 x6 HPart *workPart (NXSession->Parts()->Work());
% P0 W8 @5 ^7 ^2 I1 GFeature *nullFeature (NULL); 6 A8 f7 W/ C8 ?, v% P' m, U
Point3d origin = new Point3d(0.0, 0.0, 0.0);
) {3 N, }: B5 G9 f! b//**************************************************************************
' }, a, P9 {2 t//CREATE BLOCK 创建方块
( s$ N9 v2 c+ p% m+ JBlockFeatureBuilder *newBlock = NULL;, Z+ O/ g8 U$ ^+ I) w
newBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature); 0 n2 B& p& i! Z; a
newBlock->SetOriginAndLengths(origin, "50", "80", "100");
5 k, d9 P! V; K! XFeature *blockFeature = newBlock->CommitFeature(); & z7 s0 d. D6 k9 `
newBlock->Destroy(); # u- X; j; U# q
//**************************************************************************
& y; I4 N; ]6 u& n- R//EDIT BLOCK 编辑方块
8 V! a V8 {. l, b& h9 e0 sBlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature);
. j/ \) i, T, n4 koldBlock->SetOriginAndLengths(origin, "100", "20", "50");
! d/ Y" p# w4 v: goldBlock->CommitFeature();
2 y; r$ p* k! IoldBlock->Destroy(); 5 i6 [3 y2 i. g: x9 O4 u
- f- ]8 D) H D0 E) C e1 V
|
|