查看: 3616|回复: 0

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

[复制链接]

4

主题

3

回帖

48

积分

管理员

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

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

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

×
3 p  @" @1 [0 G5 ~& b
* P2 s) _& _, p

: D8 ?1 [6 R0 M5 XCreate a New Feature 创建NXfeature的标准过程
3 I$ Z. k: i/ O" k3 c0 \0 W1.Create an instance of the builder object for the desired feature type providing a null object as input.
9 [1 i# B/ L& i0 X创建一个builder实例,null作为输入- h# l" m, U* U5 p; P; Y
2.Edit the properties of the builder object to set the feature parameters and options. 0 [# R1 G6 S8 w, P
编辑创建的builder,设置一些参数或者选项
  W0 K- @$ t& K3.Use the Commit method of the builder object to create an instance of the feature.  The Commit method will return the new feature object.
. [6 r  I2 G7 D; k2 k使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象
6 A2 o- ]' R7 G) m7 H4.Use the Destroy method of the builder object to delete the builder object. ' P* K% `5 K+ }+ o1 U8 ^6 h
使用destory方法删除builder对象。

) D6 I5 A+ p8 ^! `  D编辑特征也是同样的操作过程!
  N' x; g1 `5 q& a2 C$ i5 B0 G% |3 Z
: {2 J! S* Z5 n6 T8 J代码举例:7 t$ `5 A) u" m* W* t7 M, D
Session *NXSession = Session::GetSession();
. s; S1 k# e! T1 f+ ?! b' c* \5 k: ^Part *workPart (NXSession->Parts()->Work());
9 S$ v, x: o2 H" I) ~! BFeature *nullFeature (NULL);
1 S, h3 A- z% N' m/ |Point3d origin = new Point3d(0.0, 0.0, 0.0); 1 A9 s2 X% N- J
//************************************************************************** % t  G+ z' z' D3 v1 O
//CREATE BLOCK 创建方块  t0 v3 \7 I9 e* c* s
BlockFeatureBuilder *newBlock = NULL;
3 N: ?/ T; w% L$ J  X- tnewBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature);
( t3 X/ ?% v- L" p" XnewBlock->SetOriginAndLengths(origin, "50", "80", "100"); - Y$ [3 i( q; x. A
Feature *blockFeature = newBlock->CommitFeature();
" l( v# P+ p% X, S3 m4 QnewBlock->Destroy();
" t: \2 u: m0 f' P, q//************************************************************************** 7 T5 e- ~: I, C
//EDIT BLOCK 编辑方块# d. {" |' Y6 I3 N1 V
BlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature); / f# w2 e9 L* I& a8 {
oldBlock->SetOriginAndLengths(origin, "100", "20", "50");
# b8 u. B  }0 K+ A4 ioldBlock->CommitFeature(); 8 C+ i: Q! |; d& w
oldBlock->Destroy();

* ?5 @9 t( k" P" D7 L! n! k2 k* ~% F4 s; G* h
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.doteam.tech
回复

使用道具 举报

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

本版积分规则

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