0 s+ J2 g. y2 z! R2 t& U- B: X' R1 Q
Create a New Feature 创建NXfeature的标准过程 w. A$ [6 `- i4 h* [5 e6 b: M9 ?1.Create an instance of the builder object for the desired feature type providing a null object as input. * Z, [8 P& F; Y) b. `: d5 N创建一个builder实例,null作为输入. y5 R. P5 y$ a
2.Edit the properties of the builder object to set the feature parameters and options. 5 F: T4 s6 O% X0 |9 S \9 r编辑创建的builder,设置一些参数或者选项/ }5 q% n9 q4 n
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. 2 M7 ^+ @2 S- B9 R
使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象 % u. W6 i% H! |1 ]4.Use the Destroy method of the builder object to delete the builder object. + S% C1 k, D" `3 e, X1 Y使用destory方法删除builder对象。) C0 I# U- y# F! l0 A8 U: ~& ~
编辑特征也是同样的操作过程!) c# V/ K$ Z( p0 U1 h
, N, @2 {- Y. t+ P2 B3 [代码举例: & t* h* K. Z% _8 R* `Session *NXSession = Session::GetSession(); 0 N! C4 z5 T* I& e1 J, n
Part *workPart (NXSession->Parts()->Work()); 2 J* m N5 n7 @! b
Feature *nullFeature (NULL); " p! x/ ?6 t I# j' j0 J; B- k
Point3d origin = new Point3d(0.0, 0.0, 0.0); ' Z: G1 l7 ~9 x& @
//************************************************************************** 0 {5 n' E' _9 `0 D! i* \6 _$ ^& @//CREATE BLOCK 创建方块) A0 J# f6 L# k) z) g, F$ r
BlockFeatureBuilder *newBlock = NULL; # ?& _& h& i8 W( @. e' onewBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature); u8 M! B/ ^0 @0 h
newBlock->SetOriginAndLengths(origin, "50", "80", "100"); 5 ]2 n0 o; t4 v4 s0 N4 ?; `# y4 DFeature *blockFeature = newBlock->CommitFeature(); 7 _. B7 Z( d7 c/ Q9 |5 z
newBlock->Destroy(); 9 p7 B; m& b2 L. l0 g8 m( t//************************************************************************** 8 E+ w/ d: f/ \! h; F0 a: i+ [
//EDIT BLOCK 编辑方块 + O& V5 p T: O! a U- k2 E6 uBlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature); ; @1 W0 {2 R I+ Z2 MoldBlock->SetOriginAndLengths(origin, "100", "20", "50"); ! }2 [4 c9 `2 B- M7 Q3 s" W
oldBlock->CommitFeature(); ( ?5 B0 B& a5 G0 e( F6 p. B" @3 WoldBlock->Destroy(); 4 K5 u" K! s' e& }& f2 i& e
3 P% F _' r0 e- U% Q
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.doteam.tech