|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
; f/ J+ u+ M5 V! `- ^2 k
' s Y6 @' v- Y% w, t. n
+ C2 y8 v( [/ Q: z* P% m' JCreate a New Feature 创建NXfeature的标准过程
. A4 B$ g5 ]7 k& u8 Y1.Create an instance of the builder object for the desired feature type providing a null object as input.
) O d* P. T) E0 J' _创建一个builder实例,null作为输入
, B) _/ G& e7 W7 f& N2.Edit the properties of the builder object to set the feature parameters and options.
1 @; l4 g) o4 Y2 s' Q编辑创建的builder,设置一些参数或者选项
4 I) A; Q/ _2 ~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. + d# u7 f6 R) p; z2 t3 f( }: @
使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象) v) t5 q2 J5 M D. o
4.Use the Destroy method of the builder object to delete the builder object. , [7 R8 Z! N5 m: V; B
使用destory方法删除builder对象。
9 G# I2 r }! C& u) N1 Y编辑特征也是同样的操作过程!; r7 Y0 [; N+ w. H/ J5 \0 E
6 h1 f, q3 R4 |+ x% u代码举例:
& [8 d$ F/ ~! ?Session *NXSession = Session::GetSession();
/ H" q. W0 y+ L' y, K7 vPart *workPart (NXSession->Parts()->Work());
, B* Z3 m& f+ h/ [2 B! [Feature *nullFeature (NULL);
) Q# |/ g, P& w4 r7 ^1 D* i8 rPoint3d origin = new Point3d(0.0, 0.0, 0.0);
2 @. O4 L1 }- Q# L//**************************************************************************
" Y1 c) A& W5 F5 c. z//CREATE BLOCK 创建方块
+ X* ~( `) C) V& ?BlockFeatureBuilder *newBlock = NULL;
; C1 q6 d4 W8 \6 ]newBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature); $ u+ B4 P. l' ]/ u
newBlock->SetOriginAndLengths(origin, "50", "80", "100"); , n! Y- [5 ~; D6 O) F: V
Feature *blockFeature = newBlock->CommitFeature();
2 N' ^; z/ f2 o& S$ S0 cnewBlock->Destroy();
3 q2 p' t0 E! k# w3 Z1 }//**************************************************************************
! L1 n3 f# I7 e! | O9 I//EDIT BLOCK 编辑方块8 _' _" n, l6 W
BlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature); & R7 B: s! O( y' B/ a6 x
oldBlock->SetOriginAndLengths(origin, "100", "20", "50"); . v9 J( z$ ~7 I9 F- S
oldBlock->CommitFeature(); - k: i- }( R5 R: J% z5 s
oldBlock->Destroy();
9 Z9 e0 ~" @5 I* E* Y+ [
( q$ M$ X" o% g; Q. s |
|