' n/ i9 [4 n0 S* Q& t+ K8 [ 3 J( |* v- ~* z/ n3 g' ? O ! e' S: Q) Y- k$ ~( iCreate a New Feature 创建NXfeature的标准过程 ' Y9 o( K6 X2 ]4 J. t5 h5 _1.Create an instance of the builder object for the desired feature type providing a null object as input. 9 _5 b' v; F! H/ ~创建一个builder实例,null作为输入" P6 ` p4 _$ l7 u
2.Edit the properties of the builder object to set the feature parameters and options. , e9 `2 H% J' R
编辑创建的builder,设置一些参数或者选项6 o5 g: y0 h a& {- R/ P7 X" p
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 t5 p$ o; N3 Q2 \) L' o使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象6 c7 m/ U, V: `9 ]
4.Use the Destroy method of the builder object to delete the builder object. 2 h9 D* F8 u+ G$ N: p使用destory方法删除builder对象。 ) Q; x/ }* w/ y编辑特征也是同样的操作过程!4 r V7 a) O: m3 b: ]
# e. d) P4 Q. v- O) S4 ]1 D! {: R' Q( N代码举例:" J: r9 l+ X f% k, J) f
Session *NXSession = Session::GetSession(); $ ^0 w$ y! D- y6 |( [) \3 FPart *workPart (NXSession->Parts()->Work()); 4 M' I+ e6 F1 X
Feature *nullFeature (NULL); 2 I8 c7 F1 c- }Point3d origin = new Point3d(0.0, 0.0, 0.0); ; P* w' X# r1 @6 X |+ r
//************************************************************************** 4 H- U; q% W# Q* f; b7 f2 G
//CREATE BLOCK 创建方块; r' B: u) A4 |) y& p/ l! _+ S
BlockFeatureBuilder *newBlock = NULL; 2 h$ x# T; R9 t4 @+ V; V' l9 w$ G& c snewBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature); 8 @+ w, ?0 x3 \1 k$ [. D& ZnewBlock->SetOriginAndLengths(origin, "50", "80", "100"); 5 f# k5 q$ Y) c: l* D8 t7 x4 wFeature *blockFeature = newBlock->CommitFeature(); 6 r H; U; t' I3 n/ g
newBlock->Destroy(); G/ d' X% z0 c; V. o. D8 G//************************************************************************** 3 y8 N9 m( B* S3 x" q1 ?
//EDIT BLOCK 编辑方块 * [1 c2 X& L0 mBlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature); 2 A, t, n% j. L& S7 ]
oldBlock->SetOriginAndLengths(origin, "100", "20", "50"); . t3 X8 F6 y/ N2 D( G: R( ]0 _oldBlock->CommitFeature(); $ S" G8 l5 A1 F& r P
oldBlock->Destroy(); 5 o7 g f$ b5 E" E
) C, q& n; n9 o+ ~" {
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.doteam.tech