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

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

[复制链接]

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

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

admin 楼主

2019-1-17 10:56:35

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

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

x
NX二次开发源码分享: 创建精确外轮廓
4 H6 E8 d& \. S
. h& k3 l# [# `7 ?% cUF_CURVE_create_shadow_outline (view source)  I: a" z# Y. o" W  ~- \
8 z3 j+ m3 J/ E" ]9 M4 L1 E4 J
Defined in: uf_curve.h2 J9 Q1 u, Q8 S' ?
2 t' K/ j* h5 P! L& G2 f
$ y" t* p0 k9 @- r( R+ E# w4 T! t
Overview+ K: ?" e7 Q; Y. ^: G) n

1 J/ P: K- a7 G' T' L6 n& c' I' gCreate shadow outline for a given array of solids. Solids passed to this
( b  X1 b; q' [+ d  I: {0 w8 groutine must be on a selectable layer and visible. If created shadow curves
% e% Z# U0 z3 y. ~2 xcan not form loops, please use UF_CURVE_create_shadow_curves instead to get
/ ^7 W& ]+ }, Z' Pshadow curves.
" r) I' g5 a- B6 g: C0 T! k8 k7 ?2 N7 j; ~, p. o- R

* @' a% V, ?6 C$ D# T+ ?. D[hide]! E; j) Z  [9 _/ \
, O$ e3 E/ {; r5 z0 P: R( A5 m
[mw_shl_code=csharp,true] void DoIt()) Z. v6 e6 u) H
    {
0 Z2 d, L. k/ b) r        if (theSession.Parts.Display != theSession.Parts.Work). l3 O; G/ y! E6 r, D- v; \# Q) ~  |
            theSession.Parts.SetWork(theSession.Parts.Display);
2 r" ~) F. c* o
2 J, \! B) i) |8 }& n7 v5 G" J; n9 n
        TaggedObject[] theBodies = null;# {! [  ~7 Q. Q  Y
        if (SelectBodies("Select Bodies", ref theBodies) == Selection.Response.Ok)
% Q2 C% a- ~# n* v0 j0 T        {
$ A* k6 f6 Q8 b1 J1 F            Echo("Selected Bodies: " + theBodies.Length.ToString());* a! ~. Z, Z7 M/ l1 D# C7 j/ u* w
            Tag[] theBodyTags = new Tag[theBodies.Length];: c: M# ~* a% R" O( p3 C
            for (int ii = 0; ii < theBodies.Length; ii++); y# j/ L) ?/ T( X  E
                theBodyTags[ii] = theBodies[ii].Tag;3 {3 L: f& U8 L8 @1 x
% H: V5 S+ x9 P6 ^# L$ f! i
            List<Curve> theOutlineCurves = new List<Curve>();& [" q) k* z0 T, Q( r/ t
            ModelingView workView = theSession.Parts.Work.ModelingViews.WorkView;
  @' w1 w# X  x4 S1 o4 Q            int loop_count;, A( d! n6 v) R, S
            int[] count_array;. \  U! X3 m0 ?' ?
            Tag[][] curve_array = null;/ Q; u+ }* w: b' J
            double[] tol = new double[2];) w. M4 j2 m. |4 i3 Q$ r
: u+ p% N$ q" T9 V: A# V2 @
            theUFSession.Modl.AskDistanceTolerance(out tol[0]);
% E  V% U3 O, V; c1 J* R7 q            theUFSession.Modl.AskAngleTolerance(out tol[1]);& C4 e' ^9 _+ k# ]

" n1 [  I4 ?% z, a            theUFSession.Curve.CreatePreciseOutline(theBodyTags.Length, theBodyTags,5 M- ~" I/ \& {; v/ J8 h
                workView.Tag, out loop_count, out count_array, out curve_array, tol);
8 o3 v% E  a9 H/ G# D) G
% M4 J1 z2 Y: c# _* f" a4 y            Echo("Precise Outline Loops: " + loop_count.ToString());
" R6 ?- _7 M4 |0 u0 v$ O$ ?7 D            for (int ii = 0; ii < loop_count; ii++)) Z2 A  T& L) U* g' ~8 j9 G
                for (int jj = 0; jj < count_array[ii]; jj++)
( f- X' E7 T' _6 X6 f                    theOutlineCurves.Add((Curve)NXOpen.Utilities.NXObjectManager.Get(curve_array[ii][jj]));+ d3 r( ~7 Q& m9 y1 K
            Echo("Precise Outline Curves: " + theOutlineCurves.Count.ToString());
) J  B6 I$ L6 ]" b1 t4 @
! J4 z/ ~2 v! U            /* If created outline curves can not form loops, use UF_CURVE_create_precise_outline_curves instead " o; F; ]$ f* Z- _
            int curve_count;
; X' G( V' E0 g2 u, ^            Tag[] outline_curves = null;
0 e9 g! O9 Z6 t, e            theUFSession.Curve.CreatePreciseOutlineCurves(theBodyTags.Length, theBodyTags, " x# c! N" x9 [
                workView.Tag, out curve_count, out outline_curves);
9 j0 Z6 g/ Z( G( L3 m  Q$ s            Echo("Precise Outline Curves: " + curve_count.ToString());- m/ b% @+ m! z6 e
            */
1 _& {7 n. h; T4 L' `* G        }
. A  \. `, N3 N6 }% I  Q4 g5 R" ?& @
    }[/mw_shl_code]
% a9 k, @+ ?% t[/hide]
" F! W' J9 S# ~' H0 t+ B
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了