|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
& d E* B% T: X/ T( |4 A7 q) y
+ w6 @9 d0 j7 n' ?: ]
* [8 \3 m& x' c" i! M& g- x( r5 KCreate a New Feature 创建NXfeature的标准过程1 c) h8 `& \! G( p
1.Create an instance of the builder object for the desired feature type providing a null object as input.
- J6 {$ Y7 S1 u) @创建一个builder实例,null作为输入
3 v: l. a; C( |; i& D9 Z2.Edit the properties of the builder object to set the feature parameters and options.
" o+ o7 u% Q! g; o4 M3 ?编辑创建的builder,设置一些参数或者选项
& Y+ G" q& o8 M/ n1 p" 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.
0 J# d: i2 i. m0 g3 I2 c/ ~使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象+ m4 @ [) O {( n9 l; p$ w
4.Use the Destroy method of the builder object to delete the builder object.
) |3 u1 r! i' d) `+ u) A使用destory方法删除builder对象。
: y) o* ]- J* d7 s0 k: z编辑特征也是同样的操作过程!
( L8 n$ H* j* b3 z" e( y5 q. V' G2 m2 u" J- H
代码举例:
6 M# n7 F5 o* T* f, G3 d2 BSession *NXSession = Session::GetSession();
7 z, L0 A- i1 a4 u# U) l4 n4 @Part *workPart (NXSession->Parts()->Work());
. u$ z, @* g( o1 ?9 cFeature *nullFeature (NULL); . c0 R# e" f( i1 }7 R# A
Point3d origin = new Point3d(0.0, 0.0, 0.0); ( {; A @: W' p0 N3 C% z; n
//************************************************************************** ; M0 Z, ^: u* s8 }6 x
//CREATE BLOCK 创建方块
7 T o" U0 f& ZBlockFeatureBuilder *newBlock = NULL;+ G; y, y* ^( M0 p% q
newBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature); ' q0 e. H0 z* N- d& D
newBlock->SetOriginAndLengths(origin, "50", "80", "100");
* o4 t0 J N( p; H+ o: C2 tFeature *blockFeature = newBlock->CommitFeature(); $ Q$ i$ B N; o0 `+ ?& a' C, s/ F* M4 ^: n
newBlock->Destroy();
% I( s* i6 p4 }0 q! m//************************************************************************** ( ~4 X- F& i" J: l
//EDIT BLOCK 编辑方块
& A5 i4 r+ b/ ?) OBlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature);
* t' l( O* s4 Y, p' ]$ H5 `oldBlock->SetOriginAndLengths(origin, "100", "20", "50");
% ] K: r! q! y# j. SoldBlock->CommitFeature(); ' b/ W% `- B1 ~+ @* s
oldBlock->Destroy(); 6 @( Y, J8 B; v
5 |4 A9 C. R# d& O
|
|