查看: 3363|回复: 1

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

[复制链接]

2480

主题

1280

回帖

8万

积分

管理员

PLM之家站长

积分
82278
QQ
发表于 2018-6-20 18:50:29 | 显示全部楼层 |阅读模式

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

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

×

$ w& x- b1 J) h  J; nNX二次开发源码分享: 创建 镜像 体
; Y5 z; G% g/ d% T. D6 v  ^
1 B* ^9 V# ~. D* Y3 E/ w默认的 JA 有个 bUG,这里看看怎么处理的!!( [3 p0 [+ j9 C4 b

2 Q& F. Z6 }+ `) P' e6 d4 x4 e
% Z1 q0 g( K: n/ e  d: Lint IR9027488::apply_cb()
' L! M6 x! t# p6 V2 P: ?5 N{
0 y2 I% z. a+ s  H8 r    int errorCode = 0;: {. |7 R7 h. x' A( C) t
    try
+ ?" S. K3 L8 N, [3 U6 r- g9 a    {1 b" o* t3 B1 j5 b
        // AIW - Begin
( J9 g7 C# c) \7 C  g2 U4 y        tag_t body = selection0->GetSelectedObjects()[0]->Tag();* O: a3 }$ q* T
        Plane *thePlane = dynamic_cast<Plane*>(plane0->GetSelectedObjects()[0]);) j1 O  x$ ~8 d5 ]' Y3 {
3 M3 [8 R; r; u! W
        NXOpen::Features::Feature *nullNXOpen_Features_Feature(NULL);
( W6 }  ?& f/ y, z$ J" L        NXOpen::Features::DatumPlaneBuilder *datumPlaneBuilder1;* R/ I1 _8 S8 J& q
        datumPlaneBuilder1 = theSession->Parts()->Work()->Features()->CreateDatumPlaneBuilder(nullNXOpen_Features_Feature);* ~: c4 i0 a9 D- K% R" o
; D7 A! H8 i4 _' k6 f
        NXOpen::Plane *plane1;& R' d! }+ m& R8 x( H2 Z0 }
        plane1 = datumPlaneBuilder1->GetPlane();! q2 G: C7 s  v# y+ s
& q9 N! @# K" F4 H( v4 D$ P7 G
        plane1->SynchronizeToPlane(thePlane);  // this is new in NX11.0.1# }/ U+ q) a8 g( {/ p+ Q
        plane1->Evaluate();/ y) G1 K0 d: }- G6 \
9 Q) x* S" b2 N! U
        NXOpen::Features::Feature *feature1;& q$ r; |9 y$ d0 C/ A( S4 ?/ h
        feature1 = datumPlaneBuilder1->CommitFeature();, J1 ^% z$ }" |5 {8 |3 w2 d

7 {) L$ `) w. W# X        NXOpen::Features::DatumPlaneFeature *datumPlaneFeature1(dynamic_cast<NXOpen::Features::DatumPlaneFeature *>(feature1));
# k5 t/ f) B1 B- U& O$ ]" r        NXOpen::DatumPlane *datumPlane1;
7 w: g5 }; s+ U& n        datumPlane1 = datumPlaneFeature1->DatumPlane();
( `/ S' ~, ~5 E' A; i+ S
' `( U. Z, x1 e' x" ^) n' Q# R$ ~        tag_t mirror_feat;/ G' D/ c1 L8 U
        errorCode = UF_initialize();  h) o) {7 {% B& D! A
        if (errorCode != 0) throw NXOpen::NXException::Create(errorCode);+ N; X2 L) H% Q9 g- @

7 H& g% q( j8 \3 j1 u# i        errorCode = UF_MODL_create_mirror_body(body, datumPlane1->Tag(), &mirror_feat);
7 o  O4 ^( M2 `! m  Q  B        if (errorCode != 0) throw NXOpen::NXException::Create(errorCode);% U/ ^* u2 x  B( Z
        // AIW - End0 {; E, V! e9 b* g: V4 I
    }& _! q" Z6 q/ q5 P( H- @& \
    caTCh(exception& ex)$ d) J: e: u! D$ `3 K
    {
( Y* c) V) a9 m& u7 d. d) v" V        //---- Enter your exception handling code here -----
  B- c' I5 k0 r" x* @        errorCode = 1;
  n2 t" m  m* k. K        IR9027488::theUI->NXMessageBox()->Show("Block Styler", NXOpen::NXMessageBox::DialogTypeError, ex.what());/ `9 _0 ~1 w) |' Z1 S
    }
0 s$ c. |5 }" [, d2 m0 u( x    return errorCode;
3 f" w! G# O0 k}0 b8 i% L% s. v) ]
9 `  k2 g. C* E! T6 V
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

1

主题

45

回帖

203

积分

培训VIP会员

积分
203
发表于 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.doteam.tech
回复 支持 反对

使用道具 举报

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

本版积分规则

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