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

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

[复制链接]

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

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

admin 楼主

2014-3-18 17:03:04

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

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

x
2 ?6 J3 R7 w" p# g8 o) `/ t- Y- b, e! ^% P

8 \  ^: N1 ~! J# Q8 n
  r3 z5 R; s5 H6 l
Create a New Feature 创建NXfeature的标准过程3 ^; V* b( c& L& l
1.Create an instance of the builder object for the desired feature type providing a null object as input.
: o$ z/ K# H2 I) ?( b! K+ i$ m创建一个builder实例,null作为输入0 [3 Z. C, X/ w
2.Edit the properties of the builder object to set the feature parameters and options. 0 p9 f$ F( g0 o) E) m) Y7 a* s
编辑创建的builder,设置一些参数或者选项. p/ A/ x) u+ r5 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. 3 T& ?8 ?+ n" J/ N
使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象
# O2 s* C' N6 h8 t" L! o4.Use the Destroy method of the builder object to delete the builder object.
0 n. l1 r6 `5 `! X; k使用destory方法删除builder对象。
4 e! Z  A( Q) e9 O9 Z% D' ~! `; l
编辑特征也是同样的操作过程!9 K+ d! a/ q* S; k4 N4 Q- y2 e

( p  u% d0 K/ [' E8 a* t# K3 j代码举例:
# h0 X. Q8 \" ~! d/ t6 }/ H* ?Session *NXSession = Session::GetSession();
, d- S, Y( B2 U4 V( W) IPart *workPart (NXSession->Parts()->Work()); 3 E& e: \& Y5 H  O- v
Feature *nullFeature (NULL);
. b3 |$ s( A" e7 \7 B# R) o7 uPoint3d origin = new Point3d(0.0, 0.0, 0.0); 8 ?+ W9 K! a6 Q- p
//************************************************************************** & r, ^, y2 i2 [' G; \7 j$ t. G
//CREATE BLOCK 创建方块
; d* v6 G5 f. x5 p# P' q  qBlockFeatureBuilder *newBlock = NULL;
* H8 p) U* z- x* i, b3 O. VnewBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature); : J) ^( Y( j' s0 H! N/ m: C
newBlock->SetOriginAndLengths(origin, "50", "80", "100"); - x8 [+ h/ i5 R
Feature *blockFeature = newBlock->CommitFeature(); ) J" G- T: ]( M4 ?+ H0 Y
newBlock->Destroy(); $ Y, T  @1 Q# X; x" j2 M
//************************************************************************** 2 _% _0 p6 ~. l
//EDIT BLOCK 编辑方块5 i. Y# x$ C4 I" a2 F* Z
BlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature); 5 w) {8 n5 L) U6 e* f$ V' `7 W# n# j3 n
oldBlock->SetOriginAndLengths(origin, "100", "20", "50");
8 Z, }0 R/ c. W8 [$ koldBlock->CommitFeature();
4 Z5 {1 G% \6 h. K3 Q" koldBlock->Destroy();

3 H0 j7 o2 d/ j0 `# h1 @: p2 L2 t- t8 y* h; x+ y1 F: Z" q* B8 [% G
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了