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

[二次开发源码] NX二次开发源码分享: 创建 镜像 体

[复制链接]

2020-9-26 21:49:38 2751 1

admin 发表于 2018-6-20 18:50:29 |阅读模式

admin 楼主

2018-6-20 18:50:29

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

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

x

! U5 Q# h- @4 ]5 Q# k( NNX二次开发源码分享: 创建 镜像 体
2 h; Q' }; L# J7 N3 }1 \2 k3 y
/ I) w: g) l9 j8 g# B" f; u默认的 JA 有个 bUG,这里看看怎么处理的!!
& {( ?5 K( u7 t) ^& g
( f& }( ~3 {: t. O$ Y9 n) A: P6 O
int IR9027488::apply_cb()" q2 Z( x* z0 |4 }4 H6 Q  F2 o
{
/ A3 I, i5 M& n; J    int errorCode = 0;
9 G( l& c- l4 P    try8 e0 ~0 h/ ?: X3 W3 Z. v8 T# C7 X
    {
9 r+ v( v; l+ J5 J        // AIW - Begin
4 X/ t( @7 f! H        tag_t body = selection0->GetSelectedObjects()[0]->Tag();1 [8 m! L. `' b, b
        Plane *thePlane = dynamic_cast<Plane*>(plane0->GetSelectedObjects()[0]);
1 K' [' }1 U& I# a7 U
+ w  r( g0 c- D3 W  D! G  {        NXOpen::Features::Feature *nullNXOpen_Features_Feature(NULL);
3 L) `" d. R& M2 Z8 b        NXOpen::Features::DatumPlaneBuilder *datumPlaneBuilder1;- c* b* |4 i$ P( P' J
        datumPlaneBuilder1 = theSession->Parts()->Work()->Features()->CreateDatumPlaneBuilder(nullNXOpen_Features_Feature);" B: ~7 u0 A" I, S1 e
# g' d( V) x8 n4 l  h* ^
        NXOpen::Plane *plane1;" M* d5 o3 A. M- O6 V: z
        plane1 = datumPlaneBuilder1->GetPlane();/ H; h3 g8 b, C) U  [% u* \/ ~
; ^8 E' b3 N' ^$ h
        plane1->SynchronizeToPlane(thePlane);  // this is new in NX11.0.12 a8 u# S1 [+ }0 `. {3 {- {
        plane1->Evaluate();3 H# T8 r0 S& u$ D" o0 s8 D8 y+ z
$ S& y! n0 o4 c/ i5 g$ Z$ y
        NXOpen::Features::Feature *feature1;
8 w7 h' y; Q8 v" M. k+ f( a" x3 i        feature1 = datumPlaneBuilder1->CommitFeature();0 m% T4 u* T3 b' C% }8 K

0 l$ F# h9 X7 a" J- k  \        NXOpen::Features::DatumPlaneFeature *datumPlaneFeature1(dynamic_cast<NXOpen::Features::DatumPlaneFeature *>(feature1));
5 w9 K# @% ]1 e! t        NXOpen::DatumPlane *datumPlane1;
, g1 [, M% |' S8 y! `        datumPlane1 = datumPlaneFeature1->DatumPlane();+ x" \: Z: v6 q$ T

2 V9 z, W) J+ p) t        tag_t mirror_feat;
$ W+ k- _& f4 Q        errorCode = UF_initialize();
" g& b" _; W5 ~1 @9 u1 Z        if (errorCode != 0) throw NXOpen::NXException::Create(errorCode);  n. ]% h8 q6 ^5 P" z5 q

$ C# N. }* w# k        errorCode = UF_MODL_create_mirror_body(body, datumPlane1->Tag(), &mirror_feat);6 f' r1 b2 e$ [+ U" ]& z+ n
        if (errorCode != 0) throw NXOpen::NXException::Create(errorCode);
( K; V+ y; G/ K: ~0 H* S+ q        // AIW - End8 z2 X# m/ k" r2 s: _7 W
    }
0 t9 B& U5 }& m1 n9 Q    caTCh(exception& ex)
5 e0 t+ J$ R1 {1 e    {/ J* r" I2 o5 x. o% v4 V+ ^+ f9 t
        //---- Enter your exception handling code here -----
: X) J  {* ?+ R  v* ]2 L+ C# o; a* M        errorCode = 1;; Q+ e: S" Z$ i/ h+ [
        IR9027488::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());3 j1 p: E  }  c0 ~: r
    }- z. A7 n! o8 |5 f. ^
    return errorCode;
$ J# k* C' `, f& N}3 R0 s# D, C& y
* U# m5 r3 c! S2 m% u  @
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

全部回复1

licxsw 发表于 2020-9-26 21:49:38

licxsw 沙发

2020-9-26 21:49:38

为什么不能用OPEN 直接做镜像 需要赚UF呢?代码中OPen的作用是用来获取基准面吗?
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.diantuankj.com/ doTeam.tech
回复 支持 反对

使用道具 举报

发表回复

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

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

    本网站(plmhome.com)为PLM之家工业软件学习官网站

    展示的视频材料全部免费,需要高清和特殊技术支持请联系 QQ: 939801026

    PLM之家NX CAM二次开发专题模块培训报名开始啦

    我知道了