|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
2 j9 O. U& g, S
" [" }0 N3 S. b7 m
" ]' z" y9 t4 q& V, u$ JCreate a New Feature 创建NXfeature的标准过程 [8 f5 l1 x7 B$ I H7 J
1.Create an instance of the builder object for the desired feature type providing a null object as input. ) a$ [# ?6 t; F2 ^6 G
创建一个builder实例,null作为输入& Q7 ^9 |, B: ^/ b _' O
2.Edit the properties of the builder object to set the feature parameters and options.
/ b9 Y+ N3 g5 a# m& F编辑创建的builder,设置一些参数或者选项
% u' Y; {0 o- F& c3.Use the Commit method of the builder object to create an instance of the feature. The Commit method will return the new feature object. * U5 Z, t- I; P/ d' G% }
使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象
4 _$ f! {9 w7 K' ~3 K3 E. k4.Use the Destroy method of the builder object to delete the builder object. ?& ]4 N, z" H0 J N$ V$ y! f) ]
使用destory方法删除builder对象。
1 K1 i4 l% K3 m' W% d" M0 N" U编辑特征也是同样的操作过程!
" l3 Z) x0 L, a: N! F H$ `1 u/ S! E+ A1 t) e. V8 u
代码举例:4 Z( h1 {. \4 B/ q4 m( Y9 z
Session *NXSession = Session::GetSession();
9 h4 k3 b9 {- P8 Z \. g, x( {, `Part *workPart (NXSession->Parts()->Work()); ! D2 ^) S2 Q2 u
Feature *nullFeature (NULL); " T3 N7 u$ c! W5 w! ~4 ~" [3 n
Point3d origin = new Point3d(0.0, 0.0, 0.0); , L( ^- G. [/ j1 M% C( `
//************************************************************************** : G1 @0 P5 j; B$ @
//CREATE BLOCK 创建方块
& o0 d, L' e+ O6 I2 eBlockFeatureBuilder *newBlock = NULL;
7 c4 @, m+ f( t/ c9 A% k* jnewBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature); # _$ A$ H+ ]9 ?! n& S' n' D' t
newBlock->SetOriginAndLengths(origin, "50", "80", "100"); " S4 |! M# ^1 `
Feature *blockFeature = newBlock->CommitFeature(); 7 I' T, {" r1 k" n. N' A
newBlock->Destroy(); 6 E& z( i% l( z. R s b6 r
//**************************************************************************
7 o% D( t& `9 |0 K M6 x2 S0 z2 t//EDIT BLOCK 编辑方块% P9 a+ B0 Y* n4 i/ p, E
BlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature); 5 t# N. W# K7 i2 J: G9 k. Q
oldBlock->SetOriginAndLengths(origin, "100", "20", "50"); 7 {( M. R3 |" h+ H: g
oldBlock->CommitFeature();
+ N- o4 l9 M. L1 qoldBlock->Destroy();
7 T) h. }8 |3 m1 b. d# V7 ` A/ Q1 R; \; q" t7 C
|
|