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

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

[复制链接]

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

2470

主题

1275

回帖

8万

积分

管理员

PLM之家站长

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

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

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

x

& V& D. V; h6 E3 e
- W- i- ^' a% l; t7 _6 _

9 h- l# [, d6 O3 m% cCreate a New Feature 创建NXfeature的标准过程2 A+ g8 {3 E7 H! ~3 q* R+ \  C
1.Create an instance of the builder object for the desired feature type providing a null object as input.
, T/ D& D  }: \, ^2 o创建一个builder实例,null作为输入0 o3 W4 K. T! O! t/ Q
2.Edit the properties of the builder object to set the feature parameters and options.
$ v: S2 n, o6 f. x0 Z$ s$ L- ~0 w$ \编辑创建的builder,设置一些参数或者选项
% \. W8 w% O7 G, ]3 m4 S3.Use the Commit method of the builder object to create an instance of the feature.  The Commit method will return the new feature object.
2 G7 W: l7 v9 Z  N; J4 }& J3 p使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象
, C( x8 Z: b: u8 Y" U- ~9 d5 T4.Use the Destroy method of the builder object to delete the builder object.
1 h$ `  F  c' H6 w/ q, Y+ e使用destory方法删除builder对象。
' _( E+ X+ R! b( ]2 x
编辑特征也是同样的操作过程!
/ |6 v7 s2 N3 [! Y/ U# r* w& M# [$ E
代码举例:
, E# e% Z7 U% z& kSession *NXSession = Session::GetSession();
% Q; O! j- {  `, l0 e  w$ tPart *workPart (NXSession->Parts()->Work());
/ g. \, J& z8 ^4 KFeature *nullFeature (NULL); & v2 s$ h$ E5 U- I. p2 b: V, e
Point3d origin = new Point3d(0.0, 0.0, 0.0); 9 o  S8 k, i$ D. l, M- i
//************************************************************************** 6 Y5 F4 W* m6 Z) f( c3 b
//CREATE BLOCK 创建方块
3 B; z1 N: q9 Q# Q9 q# P* QBlockFeatureBuilder *newBlock = NULL;& Z1 s/ B8 i3 E3 L  v( j. l
newBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature);
  D  F. G& `2 S" @: DnewBlock->SetOriginAndLengths(origin, "50", "80", "100");
) v6 z$ A6 R' b+ oFeature *blockFeature = newBlock->CommitFeature();
$ x" v9 v$ M1 `, H9 @' YnewBlock->Destroy(); / K" Q$ \- t! i/ l; [& M
//**************************************************************************
! a, t# P; h2 |( W" X# c1 b//EDIT BLOCK 编辑方块- ^% ]" H8 @: F
BlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature); ! N" N, T& `5 X, {8 Z6 E1 g  V
oldBlock->SetOriginAndLengths(origin, "100", "20", "50");
! Y0 D! \: s3 I' E' Q+ ]3 LoldBlock->CommitFeature();
# \4 U$ Q( M1 qoldBlock->Destroy();

/ d* Y  c* U* f( W: W2 V
6 c/ t& |8 r+ n9 O5 I5 n$ v4 v
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了