|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
; j: M0 F1 i! Z; c a5 w5 j
$ U6 i3 L1 p* n! H8 Q- W
! ?/ C$ j8 P* E, U. lCreate a New Feature 创建NXfeature的标准过程( _# @0 y$ q# A4 l
1.Create an instance of the builder object for the desired feature type providing a null object as input. + ?: \1 |$ \6 s: o
创建一个builder实例,null作为输入, U4 ~1 c& C2 J" Z/ h
2.Edit the properties of the builder object to set the feature parameters and options.
: U8 V+ e- p9 B& z* I( V& @编辑创建的builder,设置一些参数或者选项2 D7 f( q9 o. D
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. 8 L5 j1 E) L& d7 I; S" ?; E
使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象) D f ~! I: G ?( ^
4.Use the Destroy method of the builder object to delete the builder object.
( D7 N. }: `/ z7 [" g9 a使用destory方法删除builder对象。* Q9 ]) _& N9 V4 N, J
编辑特征也是同样的操作过程!" D0 r% V! F' k( @6 ?) c- \4 i
: q( t: f; m+ R0 k; }- M8 A
代码举例:
& p- N. L t& ^ L, BSession *NXSession = Session::GetSession(); + [7 e+ Z G( o# m" {4 ?/ Q
Part *workPart (NXSession->Parts()->Work());
& E5 }1 U& q0 R4 B1 _Feature *nullFeature (NULL);
8 G: t" A; i0 B. W2 A) ePoint3d origin = new Point3d(0.0, 0.0, 0.0);
: I) ~- A2 M5 ~9 G9 t//**************************************************************************
" S( |% x6 B3 D0 v7 W' w2 y//CREATE BLOCK 创建方块
+ f7 l% A i! H D) P# [, N0 wBlockFeatureBuilder *newBlock = NULL;; I5 W) E+ m/ ~6 |) q7 x
newBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature);
% ^4 [. u( W5 pnewBlock->SetOriginAndLengths(origin, "50", "80", "100");
0 y: n- y& V3 Y: w4 N# SFeature *blockFeature = newBlock->CommitFeature(); 6 Y* @! n, a- P5 H% n2 v# B! i' R
newBlock->Destroy();
% |: R% D1 H- n//************************************************************************** ) s( N/ l; T4 Q+ g% Y: s% c3 E6 v
//EDIT BLOCK 编辑方块, K. X3 I, e# z( W
BlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature); / |0 l5 u+ y# O
oldBlock->SetOriginAndLengths(origin, "100", "20", "50"); & r) o- M5 M# k& I
oldBlock->CommitFeature();
, I. u8 [ U) Y. I8 v7 noldBlock->Destroy();
1 R/ }" A" S+ }" c2 D3 P. `8 M
# ?$ m; b0 X% O- g2 H. O S |
|