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

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

[复制链接]

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

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

admin 楼主

2014-3-18 17:03:04

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

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

x

. x# O4 n, g* v/ k( w; E2 G5 ]3 \; r# k4 R
, h; }2 `8 z" _" E  p9 g4 ]% }; Z# D
Create a New Feature 创建NXfeature的标准过程
  q/ Q; _; E2 C4 ]1.Create an instance of the builder object for the desired feature type providing a null object as input.
9 F* S8 s* \" A* U: M, h创建一个builder实例,null作为输入* z5 O. j0 U1 O% O2 f, Y" s
2.Edit the properties of the builder object to set the feature parameters and options.
8 u  X! c, I; [! Y+ ]: f7 `+ h1 X' }编辑创建的builder,设置一些参数或者选项. a, d) y: k/ G  s# x1 C
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.
# u9 B* }2 w+ r# g' k# Y9 ]使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象
5 R- y  ^( }5 K' |" L  w$ h6 {( h4.Use the Destroy method of the builder object to delete the builder object. 5 j6 ?; {; ]- ?) D( N( I2 I
使用destory方法删除builder对象。

; g9 C5 A! w, A% z. _, J/ g. Q编辑特征也是同样的操作过程!: n6 w0 G2 }) |. L6 ^- [
, T, ~, \$ \  ?& \6 v1 z) k
代码举例:7 R9 }( C: v& o6 i
Session *NXSession = Session::GetSession();
  K- p, b$ T: _; T5 k  v! mPart *workPart (NXSession->Parts()->Work()); & C. P# V/ r# g. V7 W! X
Feature *nullFeature (NULL);
1 o" M9 M- ~- F: `+ dPoint3d origin = new Point3d(0.0, 0.0, 0.0); & f( h/ b2 S+ u' t9 H
//**************************************************************************
8 Y9 D% E- j1 I+ l. D. y# e, y//CREATE BLOCK 创建方块
) S. s4 V5 C) Q' f0 V# lBlockFeatureBuilder *newBlock = NULL;! d- z7 J& g/ o/ Y- G
newBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature); # ]! @* {9 ?% c$ J# q1 ?
newBlock->SetOriginAndLengths(origin, "50", "80", "100"); . S: E9 Q( E% R  d. h
Feature *blockFeature = newBlock->CommitFeature(); $ W, C/ @3 t) P8 t& _- ^
newBlock->Destroy();
& H0 j* T0 L; w$ N% b) l2 M; x) F# g9 P//**************************************************************************
, \& D9 s3 I( l4 ^  G//EDIT BLOCK 编辑方块
6 E: P- c4 {5 NBlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature);
; Z' o# C1 Q. i/ p  B3 T* ToldBlock->SetOriginAndLengths(origin, "100", "20", "50"); 8 F$ B0 F- d: u. o7 x
oldBlock->CommitFeature();
+ j' b  ]: s6 Z2 b& D9 foldBlock->Destroy();

5 _  ?: N1 E4 A' ~/ _/ r- Q& K" z! @1 y: W7 c/ b( U6 R: S! C
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了