PLM之家PLMHome-工业软件与AI结合践行者

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

[复制链接]

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

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

admin 楼主

2019-1-17 10:56:35

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

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

x
NX二次开发源码分享: 创建精确外轮廓
1 P: K5 k1 M9 v
4 R- X$ ~$ ]4 a7 tUF_CURVE_create_shadow_outline (view source)2 O2 h( U1 j# D( g8 W1 q' N

" @( F2 {7 ^# r! w1 |Defined in: uf_curve.h
( @1 Y  X( H& m5 T9 C8 G
% C5 d5 d' B* Y0 r
' V9 B" R' @; UOverview
2 r* S5 A6 |* b9 u0 L% R2 E0 _( W+ D+ r. A$ j: i9 M. ^
Create shadow outline for a given array of solids. Solids passed to this
& M( l6 T2 q+ Groutine must be on a selectable layer and visible. If created shadow curves
: N( _5 B0 q" s  Mcan not form loops, please use UF_CURVE_create_shadow_curves instead to get " O9 J! q& T' c2 t
shadow curves. ) {- I& l% h) ~# |# b
( t  e% r6 c& i" ~
3 e/ Z' e/ j9 J! u* L
[hide]. {! `$ S. U, U- B

! w" d$ \" T2 f4 ^; w- K% ~[mw_shl_code=csharp,true] void DoIt()- e& V6 d  }4 K( {7 q; H- @4 `
    {
- m0 L1 c& I( X' z$ z" [0 ]3 r        if (theSession.Parts.Display != theSession.Parts.Work)
" z% y4 h3 B8 N: \: n            theSession.Parts.SetWork(theSession.Parts.Display);
" F  C" x1 T" K. d8 S2 D& p9 v
8 t1 R0 v, B  V5 z# h2 {% k) w# G  v# f! G  `& H8 ]
        TaggedObject[] theBodies = null;
1 L' `  n9 r9 y; t        if (SelectBodies("Select Bodies", ref theBodies) == Selection.Response.Ok)
/ Q+ F; Q6 e3 g# L% C        {1 G( A6 p$ B" f/ k7 C7 |) G* ?. ^
            Echo("Selected Bodies: " + theBodies.Length.ToString());( m1 l# i, E9 M- y1 H' e! V
            Tag[] theBodyTags = new Tag[theBodies.Length];) P/ V' V+ A% a6 J. K& F, i0 j, w" r
            for (int ii = 0; ii < theBodies.Length; ii++)
, V2 k$ l, P3 L- b: `0 d                theBodyTags[ii] = theBodies[ii].Tag;
2 @& b0 O/ ^& Q; l
& i9 f  T3 R, i, `& a, L2 b, B            List<Curve> theOutlineCurves = new List<Curve>();  `5 D$ P% o8 h- J3 R; d* w: c
            ModelingView workView = theSession.Parts.Work.ModelingViews.WorkView;
) |" L) z8 I' f8 X/ P8 P. Z" }' g            int loop_count;' m0 G" Y7 G4 i8 d' |( a
            int[] count_array;
( L! Q! Z6 H, z1 n            Tag[][] curve_array = null;
8 r2 t9 u. I. I1 E; M            double[] tol = new double[2];
: c' {9 a7 Z8 T5 F
  f8 a7 `9 o0 A0 h* `0 c            theUFSession.Modl.AskDistanceTolerance(out tol[0]);
; ?% E6 K% j" ]2 u; M            theUFSession.Modl.AskAngleTolerance(out tol[1]);; H0 d7 D0 }4 [) x; a( |

  t: h% d- [; s  |/ k7 V5 s            theUFSession.Curve.CreatePreciseOutline(theBodyTags.Length, theBodyTags,4 _% N! ?& l& V# J: }- j
                workView.Tag, out loop_count, out count_array, out curve_array, tol);
7 f" K1 d' t4 A9 `8 c
/ c( g  I3 m5 z- R" W            Echo("Precise Outline Loops: " + loop_count.ToString());) S( @! Z- B9 [! t4 g7 C5 v$ d
            for (int ii = 0; ii < loop_count; ii++)
( t6 M4 N6 e' d2 g8 e/ X+ ~* C4 X: v                for (int jj = 0; jj < count_array[ii]; jj++)+ G8 `- k8 x  y3 G! j  E4 s9 |* x
                    theOutlineCurves.Add((Curve)NXOpen.Utilities.NXObjectManager.Get(curve_array[ii][jj]));8 Q2 w4 u  O% k
            Echo("Precise Outline Curves: " + theOutlineCurves.Count.ToString());9 U$ L2 l8 d" x& p8 D$ @
" K* I- `1 w0 {* r% h  O
            /* If created outline curves can not form loops, use UF_CURVE_create_precise_outline_curves instead
: _2 W8 e2 ?: N            int curve_count;1 f5 H3 o2 n& d- t# w$ d  s
            Tag[] outline_curves = null;
6 Y+ |# w4 [2 {1 H            theUFSession.Curve.CreatePreciseOutlineCurves(theBodyTags.Length, theBodyTags, + q0 W" n# |6 W& w, U7 F
                workView.Tag, out curve_count, out outline_curves);/ a/ l+ \# d/ N; U) @4 Y: {
            Echo("Precise Outline Curves: " + curve_count.ToString());
( s" \, ^3 \% r( Y# V& U            */
! l: S! j! H" Z  {- {6 i        }
6 d3 p0 ]0 Q8 U- r2 J9 y8 e. E! Q* G" Y+ Y
    }[/mw_shl_code]
3 G; Q5 s$ c3 I6 }9 |[/hide]% J! f; ^! i1 ^" q5 z( c" q
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了