查看: 3854|回复: 0

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

[复制链接]

2477

主题

1280

回帖

8万

积分

管理员

PLM之家站长

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

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

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

×
) W4 b, L# o3 g# N, R/ S9 ^

5 {1 w1 X: X0 g% q4 p7 e0 X

' M6 z- x" ?% vCreate a New Feature 创建NXfeature的标准过程
2 N' ]5 u; J, m' k2 }9 P) [1.Create an instance of the builder object for the desired feature type providing a null object as input. 4 H1 u- ?, }8 D( c5 ?
创建一个builder实例,null作为输入+ \2 F1 P7 @+ L. `" |. v8 M" B
2.Edit the properties of the builder object to set the feature parameters and options. . Y# c9 ?8 o2 H3 X) T, ]
编辑创建的builder,设置一些参数或者选项
# j& }' u  U0 x6 ~. C$ {2 Z8 ~! k: u3.Use the Commit method of the builder object to create an instance of the feature.  The Commit method will return the new feature object.
. p" O, B% U2 v3 `  L( r3 n使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象5 c+ ?" j. a( s  \
4.Use the Destroy method of the builder object to delete the builder object. 0 o! T( _! k) @4 ?! d# j
使用destory方法删除builder对象。
4 r; `9 C5 S, [7 t: Y4 ~; f. x  E
编辑特征也是同样的操作过程!7 P: `) |' t) I1 y- {
( M3 g! ?& O* S& n2 y
代码举例:5 q  i+ H* e' @  X7 Y1 R  L" o9 s+ T
Session *NXSession = Session::GetSession();
- K6 y. W  E1 p: h  c& kPart *workPart (NXSession->Parts()->Work());   X8 ?( p9 y0 S0 D8 L$ [! f0 ]
Feature *nullFeature (NULL); 3 j! S; D5 K2 i. ?; {  t
Point3d origin = new Point3d(0.0, 0.0, 0.0);
0 L9 q- H! L' ~' `7 Q* s% L7 n//************************************************************************** - G' x) ?. Q' I% I4 d
//CREATE BLOCK 创建方块
8 Q- t9 n% p1 G; k' \9 CBlockFeatureBuilder *newBlock = NULL;) ?/ }9 X- @! P) u9 k4 e# A
newBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature);
5 c) q+ M# t7 N. SnewBlock->SetOriginAndLengths(origin, "50", "80", "100");
4 d" h8 O3 C0 J; {1 l6 r3 dFeature *blockFeature = newBlock->CommitFeature(); / T! e' \0 |/ {  X0 y5 {
newBlock->Destroy(); ( Q, x* w! R/ h9 C* b
//************************************************************************** . P4 t( J7 d& ?$ {  W4 M! D2 N
//EDIT BLOCK 编辑方块
9 c3 s. w. F7 x. ~1 p; Y( R2 WBlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature); 2 r" c  q+ J+ T1 s+ R5 _
oldBlock->SetOriginAndLengths(origin, "100", "20", "50");
) d* j* a$ [) woldBlock->CommitFeature(); - e5 J" o# k1 g; I9 u
oldBlock->Destroy();

# P+ ~6 m, |! O* A+ m1 A" |% D1 n+ B& d! s  ]% L* A
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

在本版发帖
关注公众号
QQ客服返回顶部