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

[二次开发源码] NX二次开发源码分享: 创建精确外轮廓

[复制链接]

2019-1-17 10:56:35 2061 0

admin 发表于 2019-1-17 10:56:35 |阅读模式

admin 楼主

2019-1-17 10:56:35

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

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

x
NX二次开发源码分享: 创建精确外轮廓8 H/ Q. Q# f1 Z6 {

: g9 C0 }4 x! w9 X' R  fUF_CURVE_create_shadow_outline (view source)
2 O; j5 A1 e  F- P / h) s4 V; ^) A
Defined in: uf_curve.h9 k. o" `4 z, _, C& @% x: o+ J
* r( j) n( r  H, @" b; d2 F

& t, a5 c; e3 Y7 B( u: W7 COverview
7 h  p5 `& W; t& H  n9 j( y
: D# U9 Z$ U# v8 D' z, N. uCreate shadow outline for a given array of solids. Solids passed to this
% l: J/ o5 u! p# }  Troutine must be on a selectable layer and visible. If created shadow curves
  ~6 e* ?. Y* u% Ocan not form loops, please use UF_CURVE_create_shadow_curves instead to get 3 \" U$ t5 P9 j% X
shadow curves.
6 ?" K2 K2 z" ?: V; Q7 Y( }  J$ C/ H8 T6 O7 [2 h1 u
* L* j. T7 H& a( C
[hide]
. p! v7 H% \" a! M. a
% `& e. e: e4 w# W! U5 b[mw_shl_code=csharp,true] void DoIt()9 G, k: n, I+ g; ]3 Q
    {
/ W# ^4 n+ r4 ]1 i4 d1 U, n2 i# a        if (theSession.Parts.Display != theSession.Parts.Work)
8 E' P0 Z9 l: |            theSession.Parts.SetWork(theSession.Parts.Display);
* e# t0 @" K; ^
+ S% f) H8 r( l' @$ n/ C
1 [3 y- j% ]0 v% @' i4 `7 ^0 r! O        TaggedObject[] theBodies = null;/ C# Y) M8 @; L- `
        if (SelectBodies("Select Bodies", ref theBodies) == Selection.Response.Ok)& J, n$ ^3 h( Y) K* ^
        {4 W  N1 b1 _8 E, w6 s9 z% x
            Echo("Selected Bodies: " + theBodies.Length.ToString());' w: \. @1 R2 k8 o9 G
            Tag[] theBodyTags = new Tag[theBodies.Length];, l9 a3 ]( ]+ _
            for (int ii = 0; ii < theBodies.Length; ii++)
+ O* Z- e( r; z; C: \" [9 {                theBodyTags[ii] = theBodies[ii].Tag;
* E1 f; r6 f  Y8 n! I; f" x
/ V$ m* q- I/ P3 H            List<Curve> theOutlineCurves = new List<Curve>();
, ]% J" f' o9 A$ D            ModelingView workView = theSession.Parts.Work.ModelingViews.WorkView;
5 R; `# t  g; I) c1 J+ r            int loop_count;
+ r- p, [0 u; F; R0 u9 c            int[] count_array;
2 h3 Q1 @- P7 D) x+ W            Tag[][] curve_array = null;3 ~1 g2 I: V; B
            double[] tol = new double[2];
8 K( \; l0 S3 X: e* F! x. j6 P
% Z- p$ D' m) _& Z3 U, e0 n( ?            theUFSession.Modl.AskDistanceTolerance(out tol[0]);+ ^, d0 c8 D8 T' i, g
            theUFSession.Modl.AskAngleTolerance(out tol[1]);
, z! ?  `0 K8 X; ^0 B% J) V
3 u7 F1 o4 O0 A            theUFSession.Curve.CreatePreciseOutline(theBodyTags.Length, theBodyTags,( r! O% _0 h5 N& k
                workView.Tag, out loop_count, out count_array, out curve_array, tol);, R3 t0 }) s' c8 _' P6 b
1 R$ _2 O2 ]* z
            Echo("Precise Outline Loops: " + loop_count.ToString());, A  y7 R3 [0 {( v1 x. A  C
            for (int ii = 0; ii < loop_count; ii++)' ?  G; }+ P7 e; y4 c$ j$ d
                for (int jj = 0; jj < count_array[ii]; jj++)
! I+ n& }* ]! b1 m                    theOutlineCurves.Add((Curve)NXOpen.Utilities.NXObjectManager.Get(curve_array[ii][jj]));
- g0 t# ~5 w7 y( _) l' J8 e4 V            Echo("Precise Outline Curves: " + theOutlineCurves.Count.ToString());
- ~, b5 E$ @( f
% E7 c7 G' t0 ^! X% i0 ?            /* If created outline curves can not form loops, use UF_CURVE_create_precise_outline_curves instead : r1 f! h1 u7 y5 a
            int curve_count;  R0 n. S, R0 a
            Tag[] outline_curves = null;. y$ N: k0 w; U8 L  ~  l5 P% W
            theUFSession.Curve.CreatePreciseOutlineCurves(theBodyTags.Length, theBodyTags,
2 p" a1 E2 J# H; y9 |1 `                workView.Tag, out curve_count, out outline_curves);
* F8 S9 t$ A1 a; ?            Echo("Precise Outline Curves: " + curve_count.ToString());
% @$ x& f8 G9 {6 w  g% {# t8 |# V9 _1 N            */
( m) @% g8 a6 p; d" x7 k        }
7 q5 c4 c* D% h1 }* l* q/ H# T- O4 `! P% `! }2 I
    }[/mw_shl_code]9 r% J! V/ E6 ~; p) `
[/hide]
8 g" [. X* Y; a! _0 H
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 doTeam.tech
回复

使用道具 举报

发表回复

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

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

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

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

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

    我知道了