PLM之家PLMHome-国产软件践行者

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

[复制链接]

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

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

admin 楼主

2014-3-18 17:03:04

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

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

x

/ \# U+ e% E- l' Q
. _. [* @2 {$ F+ j

5 }& W8 a4 _' bCreate a New Feature 创建NXfeature的标准过程2 z. X2 H) O" J" N/ Y
1.Create an instance of the builder object for the desired feature type providing a null object as input.
" P6 }8 h( N) f8 _% o创建一个builder实例,null作为输入
5 L9 h: }2 B8 M: q) V6 D2.Edit the properties of the builder object to set the feature parameters and options.
5 l4 F  F, d! ]9 A% Z: ?7 N2 a$ \编辑创建的builder,设置一些参数或者选项
& ~) }1 q7 p( k7 A3.Use the Commit method of the builder object to create an instance of the feature.  The Commit method will return the new feature object. 5 ]1 t" m' X1 ~# |+ d; G
使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象
/ G4 g3 Q% W, Y4.Use the Destroy method of the builder object to delete the builder object.
3 u, W3 T% `  b) W1 A$ Q" \使用destory方法删除builder对象。
3 m0 f* u# I% V# q1 u9 r
编辑特征也是同样的操作过程!) _, K( B; s+ w0 [

6 J, t. g  `: b0 W! O代码举例:
4 j  G) w% i% A0 b+ USession *NXSession = Session::GetSession();
% `; `: A. U  Y3 p  I" P# rPart *workPart (NXSession->Parts()->Work());
% \  R+ \" c3 N( S6 j/ b0 @( _Feature *nullFeature (NULL);
* W; q  W4 Z0 G) h9 ?Point3d origin = new Point3d(0.0, 0.0, 0.0);
7 N" U5 e' d0 R- q//**************************************************************************
8 B6 q( |0 x4 g6 S3 o+ q//CREATE BLOCK 创建方块
) P8 ~% H' o) MBlockFeatureBuilder *newBlock = NULL;
- ?2 N0 A8 j. |$ |newBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature); ) }! u# {& D6 f& E. R6 s
newBlock->SetOriginAndLengths(origin, "50", "80", "100"); 7 }# _; _: I, q2 @3 e* H; W% W% H
Feature *blockFeature = newBlock->CommitFeature();
: c; ]# i  m7 OnewBlock->Destroy();
* u! s3 {3 ]& r: A//************************************************************************** ( f9 q+ J6 q- w6 m
//EDIT BLOCK 编辑方块
# ~+ ~. p  ?' f7 ?0 w# F4 V; FBlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature);
% e& o9 ]2 x+ M& E5 ]oldBlock->SetOriginAndLengths(origin, "100", "20", "50");
% b  @" ^( B$ v5 \/ l1 {+ |oldBlock->CommitFeature(); ; `* U5 B. P' X
oldBlock->Destroy();

1 c' }$ S; b% F! }& ]$ w. B8 c+ F1 q
+ B' A  L# w  V. X3 h' T6 H6 c$ }2 Z7 D
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了