PLM之家PLMHome-工业软件与AI结合践行者

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

[复制链接]

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

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

admin 楼主

2014-3-18 17:03:04

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

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

x
9 {/ r) N4 D  Y6 \/ Y! M3 Z

/ a: {! x, H0 p- |% c

( p2 q3 _4 B0 M7 {% OCreate a New Feature 创建NXfeature的标准过程
) k- |1 v. w, d% ^! W6 y& \- \: I8 e1.Create an instance of the builder object for the desired feature type providing a null object as input. 9 k+ v7 m8 @3 n5 ~! _
创建一个builder实例,null作为输入& B- f% l3 P; M9 k; J* \9 T% L! l
2.Edit the properties of the builder object to set the feature parameters and options. ) s1 [# r% J$ a  l
编辑创建的builder,设置一些参数或者选项0 l: h0 u! K  F1 @4 L- k
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.
( R* a6 Q0 g/ T4 g8 Y* O4 X' b使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象. i# h: ]( J7 }- c  \
4.Use the Destroy method of the builder object to delete the builder object.
6 e* `; s  E7 U$ ~' h: }+ S使用destory方法删除builder对象。
% x; H# ^) V9 G% j7 ~- ~& k
编辑特征也是同样的操作过程!! y( |6 h9 L5 {0 j
$ t/ Y7 I. V& z' t
代码举例:
+ A. L  D" i0 |$ N) j5 g. _Session *NXSession = Session::GetSession(); 2 N. W5 E( f9 D/ i+ v3 G7 e& v
Part *workPart (NXSession->Parts()->Work());
6 {7 ^3 Q6 s  BFeature *nullFeature (NULL);
0 A5 ^& t# ~: `Point3d origin = new Point3d(0.0, 0.0, 0.0);
4 \! c- A/ G5 ^: ^//**************************************************************************
3 ^+ I9 V2 }/ m" u//CREATE BLOCK 创建方块
2 t3 a& G5 b4 C5 {BlockFeatureBuilder *newBlock = NULL;  }2 h, W  Y/ w9 H6 v! A9 S
newBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature);
' }7 @4 T3 V7 snewBlock->SetOriginAndLengths(origin, "50", "80", "100");
8 b, l9 j" P! \6 [, s# Z% CFeature *blockFeature = newBlock->CommitFeature();
( T; h% ~0 u% x- b& y9 g& e( z9 }2 ^newBlock->Destroy(); % ?: L9 V& i+ n% d& o! I& o
//************************************************************************** 7 s% F: N% N+ }3 m3 Z; N
//EDIT BLOCK 编辑方块7 ?3 @  X' ?: o; b, m
BlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature);
4 O/ u! H. J% s; y4 U& R2 \4 holdBlock->SetOriginAndLengths(origin, "100", "20", "50"); 7 k5 V4 ^, G6 Z0 C, I# {" `
oldBlock->CommitFeature(); & I& r$ o2 D9 }1 \: o
oldBlock->Destroy();

: B& H! z3 G# x$ V- s# v  W; `4 p; o' j
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了