查看: 3620|回复: 0

[二次开发源码] 使用NXOpen C++创建和编辑特征的详细过程,一看就会!

[复制链接]

4

主题

3

回帖

48

积分

管理员

积分
48
发表于 2014-3-18 17:03:04 | 显示全部楼层 |阅读模式

请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!

您需要 登录 才可以下载或查看,没有账号?注册

×

# n. j# j: O$ w7 ?7 [; d8 G5 z, e2 d: j) P

! t1 e- a# @. p) x  m- i5 gCreate a New Feature 创建NXfeature的标准过程
) z2 q5 a( g; ?, i  x% M1.Create an instance of the builder object for the desired feature type providing a null object as input.
& W4 W6 O5 L, y# J创建一个builder实例,null作为输入  Z) S- ~4 g$ F' y
2.Edit the properties of the builder object to set the feature parameters and options. 1 a2 A0 e# w1 z, p+ v2 Y
编辑创建的builder,设置一些参数或者选项$ |7 d: Y8 T+ d) q
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.   ]9 C- A- @6 ]
使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象- t! {, T' D) d
4.Use the Destroy method of the builder object to delete the builder object.
# I( o5 o1 n' w0 V& o使用destory方法删除builder对象。
3 k1 m2 P# W$ T6 {
编辑特征也是同样的操作过程!
5 w+ S; \0 O, g/ |5 j) F0 F! y. ^1 r; k4 c
代码举例:
& Q* m* _) _/ U- v  K  aSession *NXSession = Session::GetSession();
% q9 [) e9 \( a% ?: J0 iPart *workPart (NXSession->Parts()->Work()); 3 B; m% r+ k$ n* l8 C8 R
Feature *nullFeature (NULL);
/ r; l1 Q  A7 A, U: S& mPoint3d origin = new Point3d(0.0, 0.0, 0.0);
( F' c" v1 e& j7 N* f//************************************************************************** % V+ o1 V# l6 i; }
//CREATE BLOCK 创建方块
* @, X( E  Q  [, a' v; vBlockFeatureBuilder *newBlock = NULL;
1 {2 p5 q& n" f7 |' tnewBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature);
- e. e' v$ t- [$ `newBlock->SetOriginAndLengths(origin, "50", "80", "100");
4 ?* N* B# i* h! n0 q5 k: C; Y( UFeature *blockFeature = newBlock->CommitFeature(); % w" @7 m6 L0 I9 Z% |- ^
newBlock->Destroy(); 2 Y2 F: s1 o( q
//************************************************************************** * ]; {3 o  D3 b1 i* m
//EDIT BLOCK 编辑方块
, T) j+ n5 t8 ]BlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature); 4 k# {( H7 D3 z% j5 e4 w  ]: S
oldBlock->SetOriginAndLengths(origin, "100", "20", "50");
' _. j2 M0 E8 @/ goldBlock->CommitFeature(); : D$ e+ E" z7 S# |/ t8 o9 E6 [
oldBlock->Destroy();
( _' ?& n" [/ ~4 r. o  U
" g) J* ~& V' D) p8 \. d0 R
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.doteam.tech
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

在本版发帖
关注公众号
QQ客服返回顶部