查看: 3489|回复: 0

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

[复制链接]

4

主题

3

回帖

40

积分

管理员

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

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

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

×
! V. D# l( _1 E$ g  E
7 a3 G0 E3 t8 U+ m1 P# W% y
3 {  T% w1 P/ }/ h; u- |$ F5 ~
Create a New Feature 创建NXfeature的标准过程
4 g; {9 R7 G. s1.Create an instance of the builder object for the desired feature type providing a null object as input. / S1 s6 D4 w; k/ s0 Z9 N
创建一个builder实例,null作为输入( y) o4 [, j% l) f5 O
2.Edit the properties of the builder object to set the feature parameters and options. - K! {8 R6 F' C2 A4 r$ Q, N6 X+ D
编辑创建的builder,设置一些参数或者选项
( t- Y6 `, l, b5 L3 R1 {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.
1 c9 C. h# C+ }/ q! ~9 v使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象
% l' J" J: q. n; i6 a- l. S4.Use the Destroy method of the builder object to delete the builder object.
8 ]  O) j- a7 w1 n使用destory方法删除builder对象。

8 s8 [4 C$ c/ Y+ R/ \( L& [% P编辑特征也是同样的操作过程!$ d' O% }+ S% u( K
& A" k+ ?8 B% C+ |( H1 _# I* K
代码举例:
* p3 ^* ^7 @7 n5 x8 h+ oSession *NXSession = Session::GetSession(); ! M$ Z6 {# f  G: }
Part *workPart (NXSession->Parts()->Work()); 9 ~' o, G8 g' b$ t5 |4 G( _1 x
Feature *nullFeature (NULL); . Y8 t1 V; f4 h; _5 T
Point3d origin = new Point3d(0.0, 0.0, 0.0); % s, _  }  K) A$ J
//************************************************************************** 7 y* W1 a8 L5 Z
//CREATE BLOCK 创建方块
( [8 A& s5 _- u$ YBlockFeatureBuilder *newBlock = NULL;- P0 m1 v5 `( Z* i  ]
newBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature); 5 D7 X3 R6 R! L
newBlock->SetOriginAndLengths(origin, "50", "80", "100");
( ^% p1 R; {4 |4 D+ NFeature *blockFeature = newBlock->CommitFeature();
1 m& l8 R1 s, c/ N: qnewBlock->Destroy(); $ n/ v8 f  F0 `1 [+ I
//**************************************************************************
6 ]; u2 {- l+ C$ L! @: Q3 V//EDIT BLOCK 编辑方块
: a- J0 P% u/ O, tBlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature); 1 G( M  K* l/ w4 ^( j
oldBlock->SetOriginAndLengths(origin, "100", "20", "50");
; g% k& L2 ]% [  a+ U& PoldBlock->CommitFeature();
  U1 R: m3 S' YoldBlock->Destroy();
# B) i. Q7 `9 y/ ^& S

. Q( `+ \+ p* D( k$ z7 H* f
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.doteam.tech
回复

使用道具 举报

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

本版积分规则

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