NX插件
送教程
DoTeam
培训报名
AI · CAD · PLM
首页
Portal
社区
论坛
NX技术
TC技术
Catia技术
自研系统
更多
登录
NX Toolkits 「PLM之家插件」
Castsim「铸造PLM系统」
EchoCAD「大模型CAD」
视频在线
实践教程
前沿咨询
高清购买
国产软件
PLM之家PLMHome-工业软件践行者,大模型驱动工业生态建设
»
社区
›
工业4.0产品数字化-Siemens NX/UG学习论坛
›
Simens NX二次开发专区
›
使用NXOpen C++创建和编辑特征的详细过程,一看就会! ...
返回列表
发新帖
查看:
3489
|
回复:
0
[二次开发源码]
使用NXOpen C++创建和编辑特征的详细过程,一看就会!
[复制链接]
admin
admin
当前离线
积分
40
4
主题
3
回帖
40
积分
管理员
积分
40
发消息
发表于 2014-3-18 17:03:04
|
显示全部楼层
|
阅读模式
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要
登录
才可以下载或查看,没有账号?
注册
×
! V. D# l( _1 E$ g E
7 a3 G0 E3 t8 U+ m1 P# W% y
3 { T% w1 P/ }/ h; u- |$ F5 ~
Create a New Feature 创建
NX
feature的标准过程
4 g; {9 R7 G. s
1.Create an instance of the builder object for the desired feature type providing a null object as input.
/ S1 s6 D4 w; k/ s0 Z9 N
创建一个builder实例,null作为输入
( y) o4 [, j% l) f5 O
2.Edit the properties of the builder object to set the feature parameters and options.
- K! {8 R6 F' C2 A4 r$ Q, N6 X+ D
编辑创建的builder,设置一些参数或者选项
( t- Y6 `, l, b5 L3 R1 {
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.
1 c9 C. h# C+ }/ q! ~9 v
使用commit的方法来创建这个feature的实例,这样就可以返回一个feature对象
% l' J" J: q. n; i6 a- l. S
4.Use the Destroy method of the builder object to delete the builder object.
8 ] O) j- a7 w1 n
使用destory方法删除builder对象。
8 s8 [4 C$ c/ Y+ R/ \( L& [% P
编辑特征也是同样的操作过程!
$ d' O% }+ S% u( K
& A" k+ ?8 B% C+ |( H1 _# I* K
代码举例:
* p3 ^* ^7 @7 n5 x8 h+ o
Session *NXSession = Session::GetSession();
! M$ Z6 {# f G: }
Part *workPart (NXSession->Parts()->Work());
9 ~' o, G8 g' b$ t5 |4 G( _1 x
Feature *nullFeature (NULL);
. Y8 t1 V; f4 h; _5 T
Point3d origin = new Point3d(0.0, 0.0, 0.0);
% s, _ } K) A$ J
//**************************************************************************
7 y* W1 a8 L5 Z
//CREATE BLOCK 创建方块
( [8 A& s5 _- u$ Y
BlockFeatureBuilder *newBlock = NULL;
- P0 m1 v5 `( Z* i ]
newBlock = workPart->Features()->CreateBlockFeatureBuilder(nullFeature);
5 D7 X3 R6 R! L
newBlock->SetOriginAndLengths(origin, "50", "80", "100");
( ^% p1 R; {4 |4 D+ N
Feature *blockFeature = newBlock->CommitFeature();
1 m& l8 R1 s, c/ N: q
newBlock->Destroy();
$ n/ v8 f F0 `1 [+ I
//**************************************************************************
6 ]; u2 {- l+ C$ L! @: Q3 V
//EDIT BLOCK 编辑方块
: a- J0 P% u/ O, t
BlockFeatureBuilder *oldBlock = workPart->Features()->CreateBlockFeatureBuilder(blockFeature);
1 G( M K* l/ w4 ^( j
oldBlock->SetOriginAndLengths(origin, "100", "20", "50");
; g% k& L2 ]% [ a+ U& P
oldBlock->CommitFeature();
U1 R: m3 S' Y
oldBlock->Destroy();
# B) i. Q7 `9 y/ ^& S
. Q( `+ \+ p* D( k$ z7 H* f
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.doteam.tech
回复
使用道具
举报
返回列表
发新帖
高级模式
B
Color
Image
Link
Quote
Code
Smilies
您需要登录后才可以回帖
登录
|
注册
本版积分规则
发表回复
回帖并转播
回帖后跳转到最后一页
在本版发帖
关注公众号
QQ客服
返回顶部
快速回复
返回顶部
返回列表