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

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

[复制链接]

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

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

admin 楼主

2018-6-20 18:50:29

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

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

x
$ c8 X% z: E/ `6 ?1 c+ ~
NX二次开发源码分享: 创建 镜像 体
' B* `8 z  E, r3 X  w# J9 }* z) g$ z. c2 D% k5 G7 k2 N% B
默认的 JA 有个 bUG,这里看看怎么处理的!!2 r6 l% I' {3 h: D% o
& E3 M( H5 }& a1 p! T% p3 u3 x. ?
! t3 _7 i! p" j- L
int IR9027488::apply_cb(). z9 o- w" I4 x; R; z4 ]; h- l
{6 C; {0 j. P  V& ~) M2 v! j- X
    int errorCode = 0;  b6 |. B/ c( X& Z
    try
- c" m3 t" Q+ Q4 C    {
: ?# R( h5 E( Z  K/ O        // AIW - Begin0 B/ s' R1 ~! q1 w
        tag_t body = selection0->GetSelectedObjects()[0]->Tag();
3 _. @- {5 `1 t, J7 I# n        Plane *thePlane = dynamic_cast<Plane*>(plane0->GetSelectedObjects()[0]);
0 X! S0 I9 s6 @0 l4 X+ P  }& k5 i4 M4 U+ m
        NXOpen::Features::Feature *nullNXOpen_Features_Feature(NULL);
( y( N- _" \% e  {+ o3 L& x        NXOpen::Features::DatumPlaneBuilder *datumPlaneBuilder1;& R5 v6 H) r/ J: ?2 ]7 T
        datumPlaneBuilder1 = theSession->Parts()->Work()->Features()->CreateDatumPlaneBuilder(nullNXOpen_Features_Feature);# q# `7 l" K( f( l, _
8 z& c% u, x+ [/ d6 C5 a4 x
        NXOpen::Plane *plane1;
) v0 ^; h' h2 D        plane1 = datumPlaneBuilder1->GetPlane();
+ _, w, m* X! `5 e* q$ L9 j5 k: S) _7 {
        plane1->SynchronizeToPlane(thePlane);  // this is new in NX11.0.1  X7 O# V8 ?9 B: \6 C2 p( f
        plane1->Evaluate();
/ \3 `  H3 _: E+ \$ u, c) W) \1 x* z$ Y: u6 h/ ?
        NXOpen::Features::Feature *feature1;. t& N- v$ k, N- [' J7 R) T
        feature1 = datumPlaneBuilder1->CommitFeature();8 l1 Y* F3 M- `) [0 ]% R# Y

$ D) w" U- U2 b, F! i# q        NXOpen::Features::DatumPlaneFeature *datumPlaneFeature1(dynamic_cast<NXOpen::Features::DatumPlaneFeature *>(feature1));
6 \8 g1 y0 |" v        NXOpen::DatumPlane *datumPlane1;
( F0 n8 S3 l/ S' ^  o9 L( M        datumPlane1 = datumPlaneFeature1->DatumPlane();
- b! P$ e( n$ E* y3 p' S9 l% N; w' R& S- D
        tag_t mirror_feat;% X0 m- v0 |# R- V0 o
        errorCode = UF_initialize();8 u6 \+ o4 _0 n9 Y7 J9 ~0 I
        if (errorCode != 0) throw NXOpen::NXException::Create(errorCode);
* x9 \0 c  f: R7 L7 @9 q. c  a$ r9 \  J) b8 ~. r
        errorCode = UF_MODL_create_mirror_body(body, datumPlane1->Tag(), &mirror_feat);
3 ^8 b6 f* e! O: b, J' o        if (errorCode != 0) throw NXOpen::NXException::Create(errorCode);
5 W! `) Y$ k2 k# M9 ]        // AIW - End
4 `% a' R% V# D" m$ Q* V% m: e    }  t. `" A, J. h' |
    caTCh(exception& ex)( m9 r4 t. B) [* y1 ]& W( C
    {
1 y6 _& G9 e* J, i  ^; [  y/ t        //---- Enter your exception handling code here -----
4 P3 Z' |0 h# u# z        errorCode = 1;4 }' w1 u; k& ^' f
        IR9027488::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());
  F5 u6 l$ z) w2 u9 l! Y3 W  \$ u    }
) t* f& u/ R/ E4 W  X) @- a; F    return errorCode;, E9 o; N7 w/ j; y: m
}  O' u( N6 O. X' i, `; L8 y+ A

2 `: \1 d% d2 m1 s2 ~& d8 g
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.diantuankj.com/ 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二次开发专题模块培训报名开始啦

    我知道了