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

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

[复制链接]

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

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

admin 楼主

2019-1-17 10:56:35

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

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

x
NX二次开发源码分享: 创建精确外轮廓, d) c% T( S7 }$ P3 B. U
  W* F/ {3 l2 n) {) k- B' W- L$ O
UF_CURVE_create_shadow_outline (view source)
& W+ \2 \1 A4 r! t
- ?) i* G+ @( k' |$ y0 TDefined in: uf_curve.h- i& @. e4 u9 a. W$ K
# s0 Z/ L" u! O. Q. `. z; U8 M( j! V+ j

5 b6 d, i$ _: V% A( `# w% SOverview
5 p. M1 N8 ]8 w! y0 y0 r
+ V" p$ N1 n2 @7 ~Create shadow outline for a given array of solids. Solids passed to this
7 Z& d  Z+ Q  r9 Y. x6 j& lroutine must be on a selectable layer and visible. If created shadow curves
9 Y  H( t/ y1 ecan not form loops, please use UF_CURVE_create_shadow_curves instead to get
) Z1 \. b! a. T; a* Y: Wshadow curves.
, K& a" P$ e3 R& O% _. M
2 g( g1 B3 E3 n1 m% k. n1 E
' i4 M% N3 N- |& e5 @[hide]9 H) A+ W: |( H$ U$ o

% W# T4 `% a3 a[mw_shl_code=csharp,true] void DoIt()) \( t9 X& }# C( e0 F
    {
2 q- P% r+ i5 s0 \* f        if (theSession.Parts.Display != theSession.Parts.Work)
' _8 q4 A/ ^0 Q            theSession.Parts.SetWork(theSession.Parts.Display);, Z5 K, S) V! Q/ E: }0 I, O

. t  m1 E9 `7 k6 J1 U
( E' O, j0 L, F' e/ F5 W5 E! O        TaggedObject[] theBodies = null;" Z# _) V: E  I
        if (SelectBodies("Select Bodies", ref theBodies) == Selection.Response.Ok)6 |/ i8 u. {; @
        {
! Q5 U; b2 i9 R+ z  S            Echo("Selected Bodies: " + theBodies.Length.ToString());1 J" B) `  ~9 r# E
            Tag[] theBodyTags = new Tag[theBodies.Length];
! t7 p; u2 ~2 M) M            for (int ii = 0; ii < theBodies.Length; ii++)$ f. u6 Y& y, B2 F( p9 ?3 x
                theBodyTags[ii] = theBodies[ii].Tag;* Q. p. m, ~; v7 ]4 X
2 N# e0 |( X! ?) {! U
            List<Curve> theOutlineCurves = new List<Curve>();6 @! `$ [' Z" y6 b1 I
            ModelingView workView = theSession.Parts.Work.ModelingViews.WorkView;
; C! V1 X, x7 A            int loop_count;
( \; Y1 L6 S! Z( b4 f            int[] count_array;
$ U6 a3 W* r. w* `1 j* a9 L            Tag[][] curve_array = null;; V8 X& r" Z# }4 ^# k* \5 v+ X
            double[] tol = new double[2];% p) G, K  U' z3 t9 V& d+ F- i
. w3 `" ~5 _- k: H: N% G
            theUFSession.Modl.AskDistanceTolerance(out tol[0]);9 A2 o0 e. `/ h8 Q6 L( a2 L
            theUFSession.Modl.AskAngleTolerance(out tol[1]);6 t4 ^! }% V0 r% C; u! ^

1 l& Q& z# s7 q  S, @! }( t! b            theUFSession.Curve.CreatePreciseOutline(theBodyTags.Length, theBodyTags," A& y( o2 M# O' b) x% y  b9 i" X" b
                workView.Tag, out loop_count, out count_array, out curve_array, tol);& Q; o& O% y0 f& |5 e

# y0 c# M2 O" C2 U            Echo("Precise Outline Loops: " + loop_count.ToString());5 [# b% v. t' e
            for (int ii = 0; ii < loop_count; ii++)
0 P+ p$ v: n; U% y$ L                for (int jj = 0; jj < count_array[ii]; jj++)
1 {/ G& Y& s7 n' ^/ p8 k                    theOutlineCurves.Add((Curve)NXOpen.Utilities.NXObjectManager.Get(curve_array[ii][jj]));/ \- j6 {1 j$ q5 K
            Echo("Precise Outline Curves: " + theOutlineCurves.Count.ToString());
7 e: b3 T7 P0 U6 h( x1 R5 Y5 _9 v" k# L8 j
            /* If created outline curves can not form loops, use UF_CURVE_create_precise_outline_curves instead ) v: P# H: R" ]- T9 `6 a' U
            int curve_count;7 _7 U* b$ z6 M# M/ w
            Tag[] outline_curves = null;
2 z- {# M- G% r# @) t            theUFSession.Curve.CreatePreciseOutlineCurves(theBodyTags.Length, theBodyTags, 0 M" e' c) \2 c) o+ [# ?  h. v- o
                workView.Tag, out curve_count, out outline_curves);
4 f/ V" g7 m1 l. S            Echo("Precise Outline Curves: " + curve_count.ToString());8 q* F" [" ^0 V6 W4 T, s. |$ p
            */- w; X( z( Z' O, B
        }
' L, B5 j; [( u- P. j. h( R. s( ?% r$ ]5 Q4 m
    }[/mw_shl_code]9 G3 X9 m1 ?" _( Y7 }) x
[/hide]: `7 g) U- [, G$ f" f& ^  H( s! F
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了