|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
2 r; I; z% g$ {& [6 P
5 K& X1 l' X; z+ j% q- }, k
8 F# g' A6 Y( t: s) d" b% h
Create a New Feature 创建NXfeature的标准过程
; z! b2 n& l5 L# k1 v4 l1.Create an instance of the builder object for the desired feature type providing a null object as input.
0 l# F2 P$ u, W! F' _创建一个builder实例,null作为输入
2 [* [5 m' J0 C( b2.Edit the properties of the builder object to set the feature parameters and options.
2 n+ e3 s# V U编辑创建的builder,设置一些参数或者选项$ b5 v0 D# ~ U. f: d: ?2 u
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. 5 g& d. R7 Z4 Q' a( J y
使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象
! L1 N5 t$ d# z( r, X h& A% ]4.Use the Destroy method of the builder object to delete the builder object. * ]8 a3 [1 |7 \( \3 B
使用destory方法删除builder对象。
/ N- N; g Y/ l2 v编辑特征也是同样的操作过程!2 F" c- w" \7 A- b
( ]; o% i& Y. c7 u- ~6 H4 H! k1 z
代码举例:
, ^) n r3 C: N w; HSession *NXSession = Session::GetSession();
2 O) N7 X' l) \3 a6 C7 pPart *workPart (NXSession->Parts()->Work());
O% a; x! r MFeature *nullFeature (NULL);
: t$ r# h' ?' f- B' m3 M+ L( QPoint3d origin = new Point3d(0.0, 0.0, 0.0); 2 U3 |; u9 |7 B) N t. b
//************************************************************************** ' P ?4 U( h1 I* q
//CREATE BLOCK 创建方块
# q- T$ T, H# t9 k* {BlockFeatureBuilder *newBlock = NULL;! a0 m: r3 \- }
newBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature); 9 t! k5 ^+ H, \7 L& q7 Y
newBlock->SetOriginAndLengths(origin, "50", "80", "100");
* O9 Y# @# g+ W# cFeature *blockFeature = newBlock->CommitFeature();
' H9 T0 i* R5 c( w& e$ W+ y) OnewBlock->Destroy();
* W2 ?: b( {) i6 n# s; m//**************************************************************************
, b. v; Y3 F4 x6 H& s" j//EDIT BLOCK 编辑方块
0 A3 p/ S+ ]) pBlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature);
0 {4 V" G7 ]/ W9 S) r; f9 ~oldBlock->SetOriginAndLengths(origin, "100", "20", "50");
- {4 U& K# d0 d6 IoldBlock->CommitFeature();
9 N9 t$ n1 O; h( b6 uoldBlock->Destroy(); - X- a0 W1 x; B5 R; T7 X
. k: g/ F+ o$ G0 b& F6 Y
|
|