查看: 3880|回复: 0

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

[复制链接]

2477

主题

1280

回帖

8万

积分

管理员

PLM之家站长

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

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

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

×

; k9 K6 N7 v; R( b# g6 R/ |
' t/ K; |( O4 e# A# c9 P1 W
% {/ z3 y% K/ F0 Z
Create a New Feature 创建NXfeature的标准过程
" G3 d. R+ d7 K; h) E$ q7 z1.Create an instance of the builder object for the desired feature type providing a null object as input.
7 p5 E5 @! h9 M& L创建一个builder实例,null作为输入
5 _* ^( t! m  R% y9 J. W* {8 F2.Edit the properties of the builder object to set the feature parameters and options.
$ `+ h6 C5 w: y" S7 i7 x编辑创建的builder,设置一些参数或者选项. x. V9 ]$ g" D+ ^
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. 4 x4 h  e  a$ C7 Z) `) B' s
使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象
& n/ Y, M1 O, |4.Use the Destroy method of the builder object to delete the builder object.
) j. F4 I* r' M' r) f( v使用destory方法删除builder对象。
/ |+ Y  U$ ^/ j/ k
编辑特征也是同样的操作过程!
( v9 f3 A) n5 w, l4 O! @5 p" l/ \0 s
代码举例:$ O( v; Z8 W: @7 H2 g7 [5 u
Session *NXSession = Session::GetSession(); $ h; H9 C# l$ A- X# D: ?
Part *workPart (NXSession->Parts()->Work());
/ p$ |& V, t1 k1 Y$ P, n. FFeature *nullFeature (NULL);
* t; w2 n$ z# ]2 OPoint3d origin = new Point3d(0.0, 0.0, 0.0); : ?; m; [: L9 w( k3 D6 B5 L
//**************************************************************************
, u# T; q) ~3 ^5 u% I//CREATE BLOCK 创建方块
& |: |5 s3 i' q$ `: TBlockFeatureBuilder *newBlock = NULL;
1 M  A7 f- v- q, K2 P* M$ \8 c; ~1 WnewBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature);   V% i' |0 j% h. ?' [+ T, E
newBlock->SetOriginAndLengths(origin, "50", "80", "100"); ' V5 A) i' n% n0 b. e5 E: y
Feature *blockFeature = newBlock->CommitFeature(); + l+ w& }" L' @% h3 V* V" b
newBlock->Destroy();
! g- w- q. e/ l9 {$ U2 M//************************************************************************** ; |# a" h2 M% z0 E# A( [) @/ c! B
//EDIT BLOCK 编辑方块
" L3 _( R+ F& K$ _! m  H) `, QBlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature);
' G6 a, W2 b# Y1 C. g' N6 s2 qoldBlock->SetOriginAndLengths(origin, "100", "20", "50"); " Q) N0 M6 @2 C+ w+ [' H9 ?& ]
oldBlock->CommitFeature();
% A% i" }  l! i4 r. C& |1 ^oldBlock->Destroy();

( e+ C+ M7 ?- B$ L; l# f2 r- r
' F, s: N9 O( w" f7 |' F" Q
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

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

本版积分规则

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