|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
) W4 b, L# o3 g# N, R/ S9 ^
5 {1 w1 X: X0 g% q4 p7 e0 X
' M6 z- x" ?% vCreate a New Feature 创建NXfeature的标准过程
2 N' ]5 u; J, m' k2 }9 P) [1.Create an instance of the builder object for the desired feature type providing a null object as input. 4 H1 u- ?, }8 D( c5 ?
创建一个builder实例,null作为输入+ \2 F1 P7 @+ L. `" |. v8 M" B
2.Edit the properties of the builder object to set the feature parameters and options. . Y# c9 ?8 o2 H3 X) T, ]
编辑创建的builder,设置一些参数或者选项
# j& }' u U0 x6 ~. C$ {2 Z8 ~! k: u3.Use the Commit method of the builder object to create an instance of the feature. The Commit method will return the new feature object.
. p" O, B% U2 v3 ` L( r3 n使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象5 c+ ?" j. a( s \
4.Use the Destroy method of the builder object to delete the builder object. 0 o! T( _! k) @4 ?! d# j
使用destory方法删除builder对象。4 r; `9 C5 S, [7 t: Y4 ~; f. x E
编辑特征也是同样的操作过程!7 P: `) |' t) I1 y- {
( M3 g! ?& O* S& n2 y
代码举例:5 q i+ H* e' @ X7 Y1 R L" o9 s+ T
Session *NXSession = Session::GetSession();
- K6 y. W E1 p: h c& kPart *workPart (NXSession->Parts()->Work()); X8 ?( p9 y0 S0 D8 L$ [! f0 ]
Feature *nullFeature (NULL); 3 j! S; D5 K2 i. ?; { t
Point3d origin = new Point3d(0.0, 0.0, 0.0);
0 L9 q- H! L' ~' `7 Q* s% L7 n//************************************************************************** - G' x) ?. Q' I% I4 d
//CREATE BLOCK 创建方块
8 Q- t9 n% p1 G; k' \9 CBlockFeatureBuilder *newBlock = NULL;) ?/ }9 X- @! P) u9 k4 e# A
newBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature);
5 c) q+ M# t7 N. SnewBlock->SetOriginAndLengths(origin, "50", "80", "100");
4 d" h8 O3 C0 J; {1 l6 r3 dFeature *blockFeature = newBlock->CommitFeature(); / T! e' \0 |/ { X0 y5 {
newBlock->Destroy(); ( Q, x* w! R/ h9 C* b
//************************************************************************** . P4 t( J7 d& ?$ { W4 M! D2 N
//EDIT BLOCK 编辑方块
9 c3 s. w. F7 x. ~1 p; Y( R2 WBlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature); 2 r" c q+ J+ T1 s+ R5 _
oldBlock->SetOriginAndLengths(origin, "100", "20", "50");
) d* j* a$ [) woldBlock->CommitFeature(); - e5 J" o# k1 g; I9 u
oldBlock->Destroy();
# P+ ~6 m, |! O* A+ m1 A" |% D1 n+ B& d! s ]% L* A
|
|