PLM之家PLMHome-工业软件践行者

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

[复制链接]

2014-3-18 17:03:04 3302 0

admin 发表于 2014-3-18 17:03:04 |阅读模式

admin 楼主

2014-3-18 17:03:04

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

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

x

# F, s. e% u8 @# M. j3 X$ A* p7 g' h  J2 B7 j+ h% `9 S& x

& h  _  ^* ^- T/ w( z8 wCreate a New Feature 创建NXfeature的标准过程. X: L% _% X; ?- h+ ]
1.Create an instance of the builder object for the desired feature type providing a null object as input. & K* Q; Q) d. j9 P, L- O* U" |; o2 n
创建一个builder实例,null作为输入. Z( n9 X4 W3 e# U0 t
2.Edit the properties of the builder object to set the feature parameters and options. & ?' O: s: D3 f, f0 o
编辑创建的builder,设置一些参数或者选项
8 y  J7 ]  H6 C" o& R& _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. 6 |* [' R+ U( m1 t
使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象* t6 J1 a: D. C5 a, I; e& @
4.Use the Destroy method of the builder object to delete the builder object. 0 T) A# v8 z6 {/ Q6 \
使用destory方法删除builder对象。
* e. V6 k: i2 Z7 b8 l
编辑特征也是同样的操作过程!6 Q# I+ m) }3 H) u/ _2 o; `

& y! a: ]5 f* M; R5 L% z! M" b代码举例:
' Z, [7 I9 n7 QSession *NXSession = Session::GetSession(); 7 E$ O) Z- g4 }! r+ @/ H- t- e& y. j
Part *workPart (NXSession->Parts()->Work()); % R- z( c, D  Y, \
Feature *nullFeature (NULL); / r+ V+ C: z/ r% E. f
Point3d origin = new Point3d(0.0, 0.0, 0.0); ( U5 g% u6 E8 D/ m9 O( Z  a/ Y4 y
//**************************************************************************
6 N0 L( h! J) ?, y" z4 \//CREATE BLOCK 创建方块2 T- f* O5 A' d% k5 @! l7 g
BlockFeatureBuilder *newBlock = NULL;
  b& F: S; @; rnewBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature);
! z! `! L) K3 g4 lnewBlock->SetOriginAndLengths(origin, "50", "80", "100");
+ Z9 v7 k4 w2 t- kFeature *blockFeature = newBlock->CommitFeature();
* n+ e9 g& m/ F  \( r; ?newBlock->Destroy(); # e1 m, V+ F$ w+ H) R8 _2 @1 n
//************************************************************************** ) G8 n3 k. H5 {* G8 B
//EDIT BLOCK 编辑方块
8 ^' @4 g" y8 eBlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature); $ M* y9 |; J2 F1 \
oldBlock->SetOriginAndLengths(origin, "100", "20", "50"); 4 e" V7 F. D+ `5 f" j' I( b
oldBlock->CommitFeature(); ; E3 b! M* r+ G
oldBlock->Destroy();

( y# E% ?9 G4 P( P3 F5 c
$ Q6 I& J* T/ A6 c/ `* @$ P
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

发表回复

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

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了