PLM之家PLMHome-工业软件践行者

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

[复制链接]

2014-3-18 17:03:04 3367 0

2470

主题

1275

回帖

8万

积分

管理员

PLM之家站长

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

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

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

x

  s' K) K6 ]5 [8 ~& m7 [1 }+ l  q& [5 C  y# }8 X: u& b: K

7 V9 O2 y$ q' a7 C, b; l% bCreate a New Feature 创建NXfeature的标准过程
6 {* _6 a; {3 L6 M1 D6 m3 D3 Z1.Create an instance of the builder object for the desired feature type providing a null object as input.
' \# B7 C: V! s0 b% i, ^1 H- s创建一个builder实例,null作为输入# p. g$ @$ ~9 r
2.Edit the properties of the builder object to set the feature parameters and options.
+ O" p+ \1 t* a; H编辑创建的builder,设置一些参数或者选项
* F* M9 }. Q! a3.Use the Commit method of the builder object to create an instance of the feature.  The Commit method will return the new feature object. 8 N1 u7 U4 ]; M) W3 z9 G5 R
使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象
4 ?; X. {! n% g4.Use the Destroy method of the builder object to delete the builder object.
3 Z0 v% C0 ?* l* O3 w  q8 V使用destory方法删除builder对象。
2 w1 w7 ~1 a2 v( }& F
编辑特征也是同样的操作过程!
! A' C0 K: u% `+ q' J
' |2 m& B6 A8 F% T" m1 J0 v代码举例:0 k( l# G, Y* V! g  r
Session *NXSession = Session::GetSession();
/ j! U& ]/ o" Q) _2 t/ j9 e' UPart *workPart (NXSession->Parts()->Work());
7 K' J' G8 S2 l* vFeature *nullFeature (NULL);
7 J, x. j7 p" N9 z2 _6 C, G+ JPoint3d origin = new Point3d(0.0, 0.0, 0.0);
8 l$ ~' ^' x# ]+ Y, [) v//************************************************************************** : X/ L! Z  ?3 W; ]9 @: y# E
//CREATE BLOCK 创建方块
( V3 @9 `+ k3 h$ aBlockFeatureBuilder *newBlock = NULL;* d/ b' v8 Q8 T
newBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature); 7 o; }9 G8 `2 x7 g7 R
newBlock->SetOriginAndLengths(origin, "50", "80", "100");
+ K. l1 w7 [7 x; [# t0 f+ R5 T1 UFeature *blockFeature = newBlock->CommitFeature();
5 `% c4 S8 K( ^" XnewBlock->Destroy();
3 @, ]" N# H- N5 U2 P$ |& N4 R3 x//**************************************************************************
: p$ B$ _6 y6 X# O  D/ P- L! ]9 ^! c# {//EDIT BLOCK 编辑方块! p# i* j- R& h' P
BlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature);
3 G5 c9 ^- K( e) n* VoldBlock->SetOriginAndLengths(origin, "100", "20", "50");
8 \  Q+ l5 |5 @6 a/ \" M# y9 aoldBlock->CommitFeature();
! {) w) v- u: b# `oldBlock->Destroy();

- ~' ]  g$ U- U) X: k& _- z1 y5 V$ @1 ?1 q# B' b
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

发表回复

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

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了