|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
×
, x7 ]6 K8 |) d+ q2 R$ T6 a8 p/ ?7 D( s7 {/ D, _$ G1 ~7 o8 M; n4 e
$ V* B$ y( v/ L
Create a New Feature 创建NXfeature的标准过程* r @% N3 S1 o: p" q
1.Create an instance of the builder object for the desired feature type providing a null object as input.
( ^! X$ O; Q& q创建一个builder实例,null作为输入
* Z, E4 ^6 C: Y/ v1 w2.Edit the properties of the builder object to set the feature parameters and options.
" G) P0 _- s$ j编辑创建的builder,设置一些参数或者选项" {3 E5 H0 e! u, h5 ^0 d+ g
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.
7 T2 s& i0 T4 F% U. j使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象
9 A8 E2 M6 j" n, N4.Use the Destroy method of the builder object to delete the builder object. 5 M+ t& ~/ v) r! ]2 X1 O I
使用destory方法删除builder对象。
. C7 p+ ]; F9 J% V8 P: ]! r# M7 c9 P编辑特征也是同样的操作过程!
1 n# ?, V* m/ F& {! d) r( q
/ D1 U6 \& B- S/ W8 F' C" n0 H, N* m代码举例: J; L9 }# y3 T/ J5 ]+ N
Session *NXSession = Session::GetSession(); / v* t6 Y$ j- S; s6 r' S
Part *workPart (NXSession->Parts()->Work()); , ^1 _: E5 z- h! E
Feature *nullFeature (NULL);
" ~* H. S7 E( g5 z9 N- CPoint3d origin = new Point3d(0.0, 0.0, 0.0);
) N" z/ W+ e; M//**************************************************************************
1 y: A, G" Y: c b- L6 R, g//CREATE BLOCK 创建方块
7 h" Z# |: `* F2 {4 C2 kBlockFeatureBuilder *newBlock = NULL;+ o7 b2 h- D; b! ~: s
newBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature); 3 m" z6 j' r' J
newBlock->SetOriginAndLengths(origin, "50", "80", "100");
, S* Y7 Z/ ~3 c" W9 K1 y: HFeature *blockFeature = newBlock->CommitFeature(); : [' D; O) n3 E% O( W
newBlock->Destroy(); " G5 t" N5 f- K- j: _$ o
//************************************************************************** 2 N4 g! B: Y# R" _: M
//EDIT BLOCK 编辑方块
- h( K0 E6 S/ C' jBlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature); + g8 C1 h2 a) \1 [; l
oldBlock->SetOriginAndLengths(origin, "100", "20", "50"); # x# I3 B$ P1 r' C0 d
oldBlock->CommitFeature();
0 o3 i! e% x+ s1 @% C: [$ uoldBlock->Destroy();
+ q0 |2 O' T' m) `7 M
3 F. ^7 d! G% d) k" r |
|