查看: 3904|回复: 0

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

[复制链接]

2477

主题

1280

回帖

8万

积分

管理员

PLM之家站长

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

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

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

×
% v0 q8 W8 k# h

; _2 z/ J( M1 o

# ]) }9 W! v+ n* ^3 k% DCreate a New Feature 创建NXfeature的标准过程" J: l2 D- p: O/ P! A
1.Create an instance of the builder object for the desired feature type providing a null object as input.
: `/ d. D1 m- u  u5 g% o创建一个builder实例,null作为输入- L! H% z3 B$ h7 m+ f& Y. R4 _
2.Edit the properties of the builder object to set the feature parameters and options. 7 S+ `, q& E% B; G
编辑创建的builder,设置一些参数或者选项) h4 B" ^( J2 [$ 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.
+ u8 h, h6 N7 K' L使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象
  t& o# @9 X4 K/ {0 @; t4.Use the Destroy method of the builder object to delete the builder object.
; E: A) ?, Y; b* U' c" f" ]3 x+ A. `使用destory方法删除builder对象。

9 D) o; d/ l2 i' w1 o- {1 p编辑特征也是同样的操作过程!
/ S* I& ~- X7 j7 @+ }' X% u# R6 N; w& T' g' p  f+ C- ]7 Y) \
代码举例:; J; M  s, Z1 ]+ W8 t
Session *NXSession = Session::GetSession();
7 y6 @/ P6 T  g4 n1 iPart *workPart (NXSession->Parts()->Work()); , ~$ J8 ?" j% \' {7 {
Feature *nullFeature (NULL); 1 l6 [6 M8 M: p; y# [
Point3d origin = new Point3d(0.0, 0.0, 0.0); + f9 a! B3 f8 y  p) T  t  [4 J7 f6 U
//**************************************************************************
6 e- K' F8 x9 k- `, b( Z//CREATE BLOCK 创建方块
0 t/ O3 b+ l" M" \6 WBlockFeatureBuilder *newBlock = NULL;  q1 t5 S9 U% ^" ^5 p6 f
newBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature); 6 U$ x" Q* Y8 G- x  Q9 ^
newBlock->SetOriginAndLengths(origin, "50", "80", "100");
" K: H% Y9 }. \: ZFeature *blockFeature = newBlock->CommitFeature(); % Y1 L" L& K6 r7 `9 C0 V3 ~
newBlock->Destroy();
& X, t- Q0 B$ y( D, Y//**************************************************************************
, }9 ]% O* Z6 D( o//EDIT BLOCK 编辑方块
, m! @9 f9 f  V: Q! A, pBlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature);   \8 v7 ?1 e* S, V: b9 B
oldBlock->SetOriginAndLengths(origin, "100", "20", "50"); ' a: K2 f5 A) J8 p! |$ k
oldBlock->CommitFeature();
' H( l- ?4 x2 q0 ^. foldBlock->Destroy();

: E5 t+ q/ s" |
6 o- z' L8 r6 E9 |& n
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

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

本版积分规则

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