查看: 3494|回复: 0

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

[复制链接]

4

主题

3

回帖

40

积分

管理员

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

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

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

×
9 `" k2 x7 }* i. \
& w0 p* X7 [; [5 i$ ~% H

3 j( Z* N9 H4 l$ j" @. O. G* F& ^Create a New Feature 创建NXfeature的标准过程& U& K0 ^) w) X- _: ~% L5 ]3 `
1.Create an instance of the builder object for the desired feature type providing a null object as input.
- ^3 }4 f% D, U1 f5 S3 l' ?# O创建一个builder实例,null作为输入" I% j! }/ y4 D6 L
2.Edit the properties of the builder object to set the feature parameters and options.
4 F8 u6 \( e# X  `" u  W$ l编辑创建的builder,设置一些参数或者选项" I1 ^: I/ ?( m8 {' Q5 M* A1 l
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.
) M$ G. m* I% I使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象4 Q0 z8 N3 w# _9 `. p# b$ Z0 N
4.Use the Destroy method of the builder object to delete the builder object. , j" F( V* r% X+ ]) Q
使用destory方法删除builder对象。
2 T# O8 J  I" Q/ K0 _0 w
编辑特征也是同样的操作过程!: S" }; p+ |$ K4 S

: {8 o# t5 X* {( E+ x代码举例:
2 I# ?  D( I) i5 t9 a1 {! ?Session *NXSession = Session::GetSession(); 6 d1 i* O, i2 Y: `
Part *workPart (NXSession->Parts()->Work());
+ J  F: V6 o* P6 o) D6 `) rFeature *nullFeature (NULL); 6 K- X$ j, n; ^6 {7 L
Point3d origin = new Point3d(0.0, 0.0, 0.0); 1 L7 b6 m& z: @
//**************************************************************************
3 q5 q8 d0 f. F7 P$ V//CREATE BLOCK 创建方块" K* E* ]* G8 e4 p: F* I" h
BlockFeatureBuilder *newBlock = NULL;. l: u5 U* ?! B3 s2 z, d; s- e
newBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature); 8 E6 B3 P- D0 ?, _4 j, q3 K
newBlock->SetOriginAndLengths(origin, "50", "80", "100");
  ^# [7 c. D6 Q* vFeature *blockFeature = newBlock->CommitFeature();
- P8 M  t3 c% ?% P. F( z$ lnewBlock->Destroy(); % I0 s6 a6 m" M" }& p) H( L
//**************************************************************************
; v% C' [* p  Z1 }3 ~- O2 d//EDIT BLOCK 编辑方块
5 a) i8 s: @2 V5 s4 a6 p/ eBlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature); & L- X. ]4 C2 ^; b
oldBlock->SetOriginAndLengths(origin, "100", "20", "50");
& p) [9 k" x: s2 A$ y7 ~oldBlock->CommitFeature();
( m* i3 `5 R: I/ {: @0 Y% SoldBlock->Destroy();

, U* v9 d- R1 W+ c0 b: @2 ?# c, H$ d
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.doteam.tech
回复

使用道具 举报

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

本版积分规则

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