查看: 3878|回复: 0

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

[复制链接]

2477

主题

1280

回帖

8万

积分

管理员

PLM之家站长

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

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

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

×

" s  M7 r# _3 A- _7 q& r' a2 N- ]
% N# h+ e* z6 h) n/ @
Create a New Feature 创建NXfeature的标准过程3 z  h: o& ^9 u' v9 e
1.Create an instance of the builder object for the desired feature type providing a null object as input. 3 j$ {/ T& y' T3 z
创建一个builder实例,null作为输入
8 s& O" y5 N8 T: r2.Edit the properties of the builder object to set the feature parameters and options. 5 S! [# ~  W' z! L4 l& ^
编辑创建的builder,设置一些参数或者选项
% P4 S, ^! c9 R7 _1 Y3.Use the Commit method of the builder object to create an instance of the feature.  The Commit method will return the new feature object.
* p$ O0 `/ Z$ f3 Z使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象
% j+ }7 t: F' P2 [4.Use the Destroy method of the builder object to delete the builder object.
3 o+ Y; @( E$ r; U使用destory方法删除builder对象。
- R* N7 N! n1 r; b: |3 P
编辑特征也是同样的操作过程!
" X6 D" B9 s# a. o6 h* ?8 @# \* k* m2 r8 f8 e
代码举例:
9 |! m$ @; n1 o* H9 g- `$ s' S  H! eSession *NXSession = Session::GetSession(); " [3 }3 R2 s3 [" C1 L6 f
Part *workPart (NXSession->Parts()->Work()); & g, }9 u( Q) n# j) e0 J
Feature *nullFeature (NULL); ! c9 V' {0 H; I' _: C5 m. P* x" f
Point3d origin = new Point3d(0.0, 0.0, 0.0);
/ L( N* y5 R5 E//************************************************************************** ) V! B& J$ `" C' B' ^
//CREATE BLOCK 创建方块4 _% Y( B/ H2 g* Y) J! ^
BlockFeatureBuilder *newBlock = NULL;! @1 J$ J* Z* j4 p  G& c- Q/ Q
newBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature); ! G: @1 [, T$ E0 u2 v7 D) r2 a( u
newBlock->SetOriginAndLengths(origin, "50", "80", "100"); 8 K9 e2 |0 W4 b% R1 ~3 m8 C. Q' ?
Feature *blockFeature = newBlock->CommitFeature();
; u6 r/ H2 }; dnewBlock->Destroy();
9 d7 H4 N: e* _- R# @/ A//************************************************************************** ' w5 d7 |7 `- w$ S# b6 H' ~( O+ N
//EDIT BLOCK 编辑方块
9 A' v/ j# o  H, vBlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature); 6 V. s5 ?, S. v; Y2 \
oldBlock->SetOriginAndLengths(origin, "100", "20", "50"); 3 {. ^6 `! S( g- e, V5 h- V
oldBlock->CommitFeature();
7 g& R- L' i; v* [6 |8 soldBlock->Destroy();

+ U5 b% N- m3 k! ~  U3 d$ w
! }& q  W- U( n& ^; {
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

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

本版积分规则

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