|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
1 O$ e' e3 y$ D- r2 ]7 a1 l& \) C0 t( }8 ?$ g# @" e" P
8 M$ C2 U% C3 YCreate a New Feature 创建NXfeature的标准过程
0 ^& a4 i1 x8 l1.Create an instance of the builder object for the desired feature type providing a null object as input. - h$ J5 [2 P! J
创建一个builder实例,null作为输入
+ J; S7 m$ i! J/ ]- `+ m" P0 y: s2.Edit the properties of the builder object to set the feature parameters and options. , F7 \6 [' P" Q- a" o* O' v+ R, U
编辑创建的builder,设置一些参数或者选项
9 v$ O G) T: i8 D; y3.Use the Commit method of the builder object to create an instance of the feature. The Commit method will return the new feature object. f2 U. @4 f# e8 S! I
使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象* T( u, [( u( Y
4.Use the Destroy method of the builder object to delete the builder object.
& ], Q5 {5 C3 t( \, {! b使用destory方法删除builder对象。) j$ B4 l5 U9 r; w% R- v$ J3 y: b) Y8 [/ W
编辑特征也是同样的操作过程!
% ]" M6 ?0 s! @: G, ?' W* u
- |" G1 C$ z" U: o代码举例:. p" }+ a8 M l |0 _
Session *NXSession = Session::GetSession();
! i, ?! F" J5 @; K2 h( o3 z; FPart *workPart (NXSession->Parts()->Work()); 4 K& e" q1 ]( }, j) m) R i& @9 T4 K3 H1 Z
Feature *nullFeature (NULL);
% A3 S8 I2 X, S" q c% G3 jPoint3d origin = new Point3d(0.0, 0.0, 0.0); 1 ^/ e7 A( J0 n
//**************************************************************************
/ u) d9 t5 C" ~2 E//CREATE BLOCK 创建方块4 B4 b# A C- S
BlockFeatureBuilder *newBlock = NULL;2 ?8 }3 F o0 R# h& h# H J6 i* W
newBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature);
& Y" W W- T6 fnewBlock->SetOriginAndLengths(origin, "50", "80", "100");
1 Z" w z+ n% B0 F, F9 @& KFeature *blockFeature = newBlock->CommitFeature();
6 [7 p+ X) x& unewBlock->Destroy();
# T8 | x/ O# q. o! s% z9 l//************************************************************************** 7 l6 r, a) i/ I) k* P
//EDIT BLOCK 编辑方块
5 p, ]& k* p2 n0 R9 v0 ^ \' BBlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature); - c y2 X- J4 `9 l z2 u
oldBlock->SetOriginAndLengths(origin, "100", "20", "50");
/ E* Z) u# K/ ^' i) O$ _# T! s: @oldBlock->CommitFeature(); ) {. q5 M+ L2 H- p7 {9 j
oldBlock->Destroy(); " F+ @( Y3 d( q" l# P5 U
9 P, ^6 O% A: s# \
|
|