查看: 3906|回复: 0

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

[复制链接]

2477

主题

1280

回帖

8万

积分

管理员

PLM之家站长

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

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

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

×
. G2 V$ B8 ?- m& P# |7 T0 h
2 R: u4 n+ J+ d5 a4 P& l

3 V- H/ o1 x! Z% D6 D) oCreate a New Feature 创建NXfeature的标准过程8 B# K; x5 x  T, M( q% ?
1.Create an instance of the builder object for the desired feature type providing a null object as input. 7 W% A$ t: k& T' r, \
创建一个builder实例,null作为输入
6 p. |2 t  H$ F- j4 a2.Edit the properties of the builder object to set the feature parameters and options.
( p$ Z" b9 @' t3 Z1 T7 h; H编辑创建的builder,设置一些参数或者选项
8 F$ r) H( W0 Z! A- ^* v- b/ ?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 V! T7 ^4 Q$ C. S/ P$ Y
使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象
' H. K* }7 o1 i& T' ]4.Use the Destroy method of the builder object to delete the builder object.
; E$ [5 x6 u( i$ Z( N& C使用destory方法删除builder对象。

- ?% A0 o" `+ k编辑特征也是同样的操作过程!5 @. F8 `# N. y
# f7 n+ U# n# |) K; n6 R
代码举例:
  z6 z& T, }$ N9 I) @  kSession *NXSession = Session::GetSession();
  B2 x. ?) u6 O' a- G' O' j( L  wPart *workPart (NXSession->Parts()->Work());
* c" a- m, ^* ?) U. ?Feature *nullFeature (NULL); 8 g$ k  B1 |) Z! T% B) C) _) g
Point3d origin = new Point3d(0.0, 0.0, 0.0);
, O* n# [( l) ?! O+ V//************************************************************************** / P" h* ~8 P8 R( P* ~
//CREATE BLOCK 创建方块
, l# ^) O5 w3 n) ~. e' u* W/ cBlockFeatureBuilder *newBlock = NULL;6 j& Q8 H# _! [- g" P% X+ w
newBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature); ) L( E) A9 Y2 R8 Y
newBlock->SetOriginAndLengths(origin, "50", "80", "100");
3 P: @( h/ q. `) U6 RFeature *blockFeature = newBlock->CommitFeature();
5 d% |/ Z1 u+ cnewBlock->Destroy(); . Q0 q. Z" U0 [  L+ X' X
//**************************************************************************
# p' q2 y8 {) ~//EDIT BLOCK 编辑方块
3 N! v. M6 M3 r5 _$ BBlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature);
% I2 L3 x' H: J) n  KoldBlock->SetOriginAndLengths(origin, "100", "20", "50");
; E; c1 Q' f, }8 L& |1 boldBlock->CommitFeature();
, G1 D! ^5 q& i6 V  W, holdBlock->Destroy();

, a" a, ]9 H3 u" t
" ?. E6 ^* r$ c4 B8 E
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

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

本版积分规则

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