PLM之家精品课程培训

PLM之家精品课程培训

联系电话:18301858168   |   QQ咨询:939801026
NX二次开发培训

NX二次开发培训

UFUN/NXOpen C++和实战案例

适合初级入门或想深入了解二次开发的工程师,本培训结合ufun,NXOpen C++,大量的实例及官方内部的开发技术。
公众号二维码

关注公众号

点击扫描二维码免费在线高清教程

课程详情
Catia二次开发培训

Catia二次开发培训

市场需求大,掌握核心技术前景广阔

Catia二次开发的市场需求大,人才稀缺。掌握开发技能潜力巨大,随着经验积累将在汽车、航空等领域有所作为。
B站二维码

在线原创B站视频

点击关注工业软件传道士主页

课程详情
Teamcenter培训

Teamcenter培训

全方位培训,从基础应用到高级开发全覆盖

涵盖用户应用基础培训、管理员基础培训、管理员高级培训及二次开发培训等全方位内容,由多年经验讲师打造。
QQ群二维码

加入同行交流

点击扫描二维码加入QQ群

课程详情
×

PLM之家plmhome公众号

课程涵盖: PLM之家所有原创视频

×

关注B站视频

所有高清视频一览无余,全部在线播放学习

×

加入PLM之家QQ群

同行交流,疑问解答,更多互助

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

[二次开发源码] UG二次开发源码:计算曲线信息评估非常好用的方法分享

[复制链接]

2014-5-3 12:58:05 3854 0

admin 发表于 2014-5-3 12:58:05 |阅读模式

admin 楼主

2014-5-3 12:58:05

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

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

x
. z+ a& V% D3 T: U1 P, ]
, b3 ]5 I* @- r

5 S2 t' i- l- L" ?5 b' C, K
$ J7 h9 E. q0 F  Z/ P; k
  1. /******************************************************************************
    1 ^) ]/ \: {6 G1 _" P; J
  2.              Copyright (c) 1999 Unigraphics Solutions, Inc.% K( C! ?# B5 S; b; b5 `
  3.                        Unpublished - All Rights Reserved
    6 @3 U# C/ t$ c3 ^% T

  4. & O; Y) ^* W  {8 ]- m0 Q% L
  5. *******************************************************************************/( ^' c/ d! C! N- R
  6. /* This example demonstrates the UF_EVAL api for lines and arcs.) M2 a! w* W& L8 C5 D. q- V
  7. Some of the UF_EVAL routines operate on an evaluator
    / k8 h$ }; _" W- \. O0 p& V7 m* O7 G
  8. independent of type while others are type dependent.  No longer use: V# q. [3 p( x! {6 ]
  9. UF_CURVE_ask_curve_struct ( ),
    , \: C' I% r* t4 n: \
  10. UF_CURVE_ask_curve_struct_data ( ) and
    8 V5 V' k6 ?6 `# W* k
  11. UF_CURVE_free_curve_struct ( ): ^/ m0 u) e; C
  12. */! L/ J+ D/ Y1 {$ H
  13. 0 f/ @7 M4 r/ v0 c
  14. #include <stdio.h>7 z# y8 ]. u- B% y
  15. #include <uf_object_types.h>
    : X, C/ C3 t/ x" B4 A8 J4 ^  B
  16. #include <uf_curve.h>; z* N& H7 J2 _; J! |# V/ A
  17. #include <uf_eval.h>- w% e* X3 H5 @9 ]0 ?# F
  18. #include <uf_modl.h>
    3 ]' c- Q$ \8 A- e9 I' y' N, F
  19. #include <uf_part.h>
    / s& l: `7 N& t; G; \: f
  20. #include <uf_so.h>5 D# K3 P9 l& _" m- ~% g( ]
  21. #include <uf.h>8 v# b& f, t0 d  l) i+ t1 N
  22. #define UF_CALL( X ) ( report ( __FILE__, __LINE__, #X, ( X ) ) )
    4 L0 b. h6 ?' x* S& F2 X7 q! L* I
  23. static void show_edge_points(UF_EVAL_p_t eval, int n_pts);# F4 c2 ?: O) ^( V8 j/ D2 N  j
  24. /*---------------------------------------------------------------*/' x8 p1 u, A, [7 R% F  _7 I  d
  25. static int report ( char *file, int line, char *call, int irc )
    6 S2 {- D1 _6 ?# P% j6 K2 `
  26. {
    ; P1 V4 s0 i% B  _/ e# _
  27.     if ( irc )
    ! W. g8 _2 p1 A8 y2 @
  28.     {8 T8 I% \+ h6 V9 R/ ]4 G
  29.         char message [ 132 + 1 ];6 n+ R! S3 |$ O2 t6 f
  30.         printf ( "%s, line %d:  %s\n", file, line, call );' z8 C, e' i- O& U- B2 y& c
  31.         UF_get_fail_message ( irc, message ) ?
    0 S* S) q& ?; w. n' A
  32.             printf ( "    error %d\n", irc ) :: y2 L7 h5 ?. B: a
  33.             printf ( "    error %d:  %s\n", irc, message );" I' m; |( o1 l
  34.     }# v7 j2 O7 l* H- T# Q. l' t% ?
  35.     return irc;
    , d) S; j0 |, c8 S1 ^. J- ^# K8 H
  36. }- f  ?+ I/ E5 B
  37. /*---------------------------------------------------------------*/
    ; p$ @4 k; E5 `9 J) t& Z# Y
  38. int ufusr_ask_unload ( void )
    5 N6 F: x0 O* k. i' S; V) E
  39. {! c6 T4 ^3 c# F) @; S
  40.     return UF_UNLOAD_IMMEDIATELY;# w0 X  u! M, U. o6 G# n
  41. }
    9 n  u2 R! a* O. x
  42. /*---------------------------------------------------------------*/
    4 f" O  Z2 `1 \# [- s% ^
  43. /* ARGSUSED */, }5 L7 L( T# J& J! L
  44. extern void ufusr ( char *param, int *reTCod, int param_len )( }- D% t2 X3 ^& W6 B& f" g
  45. {4 i2 a2 S) ^  ^1 K3 t: ^
  46.     tag_t line;7 }, O  I2 s+ L
  47.     tag_t arc;2 _& i( r+ I; s+ J& H! z
  48.     tag_t edge;
    $ n5 N3 H4 }( L, j/ H6 k2 S
  49.     tag_t edges [ 3 ];6 O  z8 E# ~1 O! i8 `+ `' _
  50.     UF_EVAL_p_t line_evaluator;) E5 v  O+ ]( r9 c- a1 b! y8 |! f
  51.     UF_EVAL_p_t arc_evaluator;3 U% j& {4 i% h: @7 ^$ {0 g+ k
  52.     UF_EVAL_p_t edge_evaluator;' y  z1 |4 q7 G0 [
  53.     UF_CALL ( UF_initialize ( ) );
    ( h: g1 h$ e' U& P1 r% p3 R
  54.     /*  ; L: R4 c" H( c. Z; T
  55.         Create new part "ufd_eval.prt".
    & r! d2 |4 K7 k
  56.         
    - n  D7 @8 E. s- J
  57.         Close part if it already exists.& \" g5 w% k! f4 m" ~" h0 K
  58.     */% K1 T' P1 x6 g
  59.     {& ?5 o8 I* r- t0 k+ E/ \. n
  60.         tag_t part = UF_PART_ask_part_tag ( "ufd_eval.prt" );
    8 U3 ?; ^9 f( Q! a" D6 l+ \
  61.         if ( part != NULL_TAG )
    * L- R/ Q% a) n) \
  62.         {
    - o: M  N0 Z- d
  63.             UF_CALL ( UF_PART_close ( part, 0, 1 ) );
      q: ~, ?1 u5 `/ {; v
  64.         }
    : J$ T7 ]( X" ]0 o6 ]
  65.         UF_CALL ( UF_PART_new ( "UGd_eval.prt", - \8 v9 T* W1 H: B7 w8 z  D
  66.                                 UF_PART_ENGLISH, 8 z# c' x- \3 d+ G9 q( d
  67.                                 &part ) );
    ( G( w+ d9 N. @4 z! z
  68.     }
    " g  i" d! d1 I( n
  69.     /*
    ' L# H7 i% x: q. f! P( L
  70.         Create block and get edges. ' I; K8 G8 L4 @. j+ ?" n
  71.     */) Z, f! [5 h7 M
  72.     {5 t: P/ W5 k- M  v
  73.         double  origin [ ] = { 0.0, 0.0, 0.0 };% U5 ^; r% {) U1 t0 D2 H$ ^
  74.         char   *sizes  [ ] = { "1", "1", "1" };
    0 v' A* z. A$ ^5 z2 y* }
  75.         tag_t block_feature;% h. V- i  `0 j6 @, Q: A
  76.             
    - A6 D8 O8 N( e0 k
  77.         UF_CALL ( UF_MODL_create_block1 ( UF_NULLSIGN,
    " ^  @# s1 X3 m3 F# K3 J/ W) i( t
  78.                                           origin,
    # i, I) {' [: ^( d; r; o& Y
  79.                                           sizes,
    1 H- B' W( ?( U
  80.                                           &block_feature ) );
    # }$ X- g: g( y& o
  81.         {
    : B& y) r7 y( ?/ Y: I5 I  d. @
  82.             uf_list_p_t edge_list;
    # W8 H: U* w2 j  }; ^$ N
  83.             UF_CALL ( UF_MODL_ask_feat_edges ( block_feature, 0 P- r( _( T: }5 t% O: m
  84.                                                &edge_list ) );* u7 V0 \' x; ^, \8 [7 s
  85.             
    5 V( \1 n' }, d$ Y. w4 U- \
  86.             UF_CALL ( UF_MODL_ask_list_item ( edge_list,
      P7 b, u' _2 c, `' R
  87.                                               1, $ I( I) ^6 k# b5 S, f- H9 D
  88.                                               &edge ) );1 L: j5 i2 r$ S- ?; O0 K: @8 L' t
  89.             edges [ 0 ] = edge;
    8 Q. h. R/ i* N/ ]- y4 o
  90.             edges [ 1 ] = edge;
    + p4 {' c, n$ f' @) v' _9 y8 a
  91.             UF_CALL ( UF_MODL_ask_list_item ( edge_list, 9 c: f7 |6 v1 O8 l* @/ g: i. K/ D" {
  92.                                               0,
    . |7 q4 |6 I; C& Z9 J, [& m
  93.                                               &edges [ 2 ] ) );
    5 q. X: n6 T5 x# C5 a9 O
  94.             UF_CALL ( UF_MODL_delete_list ( &edge_list ) );
    5 i! }8 A  z0 B3 E
  95.         }
    0 I# U- {4 V+ t3 |) D  L; W% F4 \
  96. }
    0 o) |# C: J7 h' [, q6 i% f
  97.     /*  
    / D6 w5 `% `% ^( X$ W- e3 ~
  98.         Create smart line.. Z3 {; F7 ~. }: y( O; f3 M" H
  99.     */
    9 V) b% `4 T6 t7 G
  100.     UF_CALL ( UF_SO_create_curve_extract
    , U* L9 e7 [7 `. p0 M
  101.               ( 5 O0 `# }/ `$ D/ p
  102.                   edge, ; r0 M2 `4 U$ T# W
  103.                   UF_SO_update_after_modeling,
    * f! l, ^9 W& p$ v
  104.                   edge,
    9 S# C$ k9 V+ M, \# y4 Q, b( x! E' E
  105.                   UF_line_type, /* enforce line type */
    $ @$ c9 z$ M+ s& A  `
  106.                   0,            /* no subtype to enforce */
    - y% Q$ L- R5 `* c# F; h
  107.                   NULL_TAG,
    , \) P5 r7 X9 M
  108.                   &line   _. l' S: i9 \
  109.               ) );
    & y3 j5 H8 c! y$ M! G$ j% V
  110.         , `! @- G5 B1 T( x4 y0 a! J  D8 U
  111.     /*  
    : A2 ?2 H( L9 H6 @. t/ E
  112.         Create smart arc.
    $ u! b7 R4 w, ~  h7 t9 f1 c, ~
  113.     */" D8 ?4 ?: r* ^6 u' @; u
  114.     {
    # V! {7 B1 ]5 p" N# ], r% [
  115.         int i;2 `- I6 W  X+ O2 k( k/ t
  116.         tag_t points [ 3 ];. J+ u4 j2 z5 F$ [5 h5 A! n" ^! w
  117.         for ( i = 0; i < 3; i++ )
    % @3 `$ X6 v5 @- O1 O
  118.         {& H; D0 @! Z7 N) z3 _7 B. d
  119.             char *strings [  ] = { "center=1.0",
    * k8 _4 ^) K& o  ]0 K+ @5 v
  120.                                    "start=0.0",
    # w$ G* @: H1 v7 U
  121.                                    "end=1.0" };
    1 |0 W0 ~) O! |( j
  122.             tag_t exps    [ 3 ];
    , E- E$ {/ \0 S/ D
  123.             tag_t scalars [ 3 ];
    3 t( ^1 R, H0 {$ d2 a! q1 I
  124.             UF_CALL ( UF_MODL_create_exp_tag ( strings [ i ], ' n+ ?# K& u! A, n8 ~) d3 \7 e$ u
  125.                                                &exps [ i ] ) );/ J& D) |, `" ~. F) W
  126.             UF_CALL ( UF_SO_create_scalar_exp
    6 r) d% ~$ I6 f/ ~7 ?! g+ [
  127.                       (
    ) n9 U  T" T2 R" Q' u4 W8 v. [
  128.                           exps [ i ],7 c9 I" p+ C* i& d7 c
  129.                           UF_SO_update_after_modeling,
    ; [) S4 r& O+ H/ _1 A
  130.                           exps [ i ], : W$ C$ V! k# D+ }
  131.                           &scalars [ i ]* m! s( C0 E( ?0 j; B. l  W% X
  132.                     ) );' q# J6 P" O/ F" l
  133.             UF_CALL ( UF_SO_create_point_on_curve 8 ?" \. f$ ?, E# M* `
  134.                       (
    ; \6 h6 d9 n# Y2 d$ ~9 ?  C! i# r6 \
  135.                           edges [ i ],
      m& j! X  s' I$ I4 y$ d
  136.                           UF_SO_update_after_modeling, 0 W; Q" z5 H, Y$ L+ F, Y+ M+ u
  137.                           edges [ i ],
    + ?& v+ D5 F* R# Q$ K4 e& e
  138.                           scalars [ i ], , r( f# ?# J# P) R, w- l- \
  139.                           &points [ i ]
    9 [; m$ z. P. F& t  W5 m
  140.                     ) );
    " S+ j& W) q9 ?1 z1 J2 b% D
  141.         }" g5 |) m% H  B; n9 P3 q
  142.         UF_CALL ( UF_SO_create_arc_center_2_pnts 5 v0 ?/ U; d* D1 G& k" T
  143.                  (
    ) s( T0 a, l0 w* O. [9 s# D! _
  144.                       points [ 0 ], 7 R5 N1 X* N, b
  145.                       UF_SO_update_after_modeling,+ d1 U" P. Q/ H& N) @# D
  146.                       points, ! Z+ h$ r9 S) c! U( M
  147.                       &arc " o' z  J- |$ s
  148.                   ) );
    $ S% }+ X+ g2 J4 o6 r
  149.     }
    0 |, j! H# e& f  H
  150.         
    ' s! A' n1 F8 X4 V" t
  151.     /* , @, i0 ~) a4 B; Z8 ~
  152.        Smart objects are created as invisible objects by ' N$ i: N, Q. x, y8 V
  153.        default.  UF_SO_set_visibility_option ( ) can be : `# C- S6 I# M5 L% z- T& A$ O
  154.        used to make them visible in the graphics window.
    + e: {' A: G; Z: Y3 v) D. x
  155.     */" D, ]! C- F2 m7 f; D
  156.     UF_CALL ( UF_SO_set_visibility_option ( line, ! l, g8 }4 J& ~$ ^2 O9 \
  157.                                             UF_SO_visible ) );8 H2 ~; G( N- b) V" R( \" E2 M
  158.     UF_CALL ( UF_SO_set_visibility_option ( arc,  9 T9 x( b0 A6 O# C5 I/ u" W
  159.                                             UF_SO_visible ) );. k9 ~7 K; i( |6 F3 K/ k
  160.     /*  $ O/ X3 w9 |$ i' C- e  Z' d: o
  161.         Get line/arc/edge evaluators./ J2 `6 A. a* Q# i$ A  p7 V
  162.     */' m: ~. z4 _, ~: R/ \7 t
  163.     UF_CALL ( UF_EVAL_initialize ( line, &line_evaluator ) );
    ; u3 X8 Z" L: Y
  164.     UF_CALL ( UF_EVAL_initialize ( arc,  &arc_evaluator ) );) V1 O9 l; Y2 J: @' }% G+ ?
  165.     UF_CALL ( UF_EVAL_initialize ( edge, &edge_evaluator ) );
    , J% Y. ~9 l% y% H  J# b
  166.     show_edge_points(line_evaluator, 10);; ~& L& P2 s; ]% j
  167.     show_edge_points(arc_evaluator, 10);
    9 X2 o8 v, o. O1 C. K' a+ Z3 F( \
  168.     show_edge_points(edge_evaluator, 10);. L" f) L7 @; W
  169.     /*  
    4 ]8 I. c9 b9 `: a
  170.         Get line/arc/edge data.
    1 m! I+ L5 r8 R7 A9 c
  171.     */
    : B/ M' @0 q# i8 p) \" N
  172.     {
    5 k2 k. N3 G5 J4 h  p
  173.         UF_EVAL_line_t line_data;
    6 y* p# J1 I( S7 A
  174.         UF_EVAL_arc_t  arc_data;" n- N1 B& o' ?' ?
  175.         UF_EVAL_line_t edge_data;; X9 e$ [9 C0 q  C
  176.         UF_CALL ( UF_EVAL_ask_line ( line_evaluator, 8 t2 Z/ ]/ {- T2 l8 Q* h! n
  177.                                      &line_data ) );' ?7 w1 j6 m% Y! }, B: J
  178.         UF_CALL ( UF_EVAL_ask_arc  ( arc_evaluator,  
    + J% e- G* L+ s, ~* R
  179.                                      &arc_data ) );
    ) F5 v0 ~1 d. G, g1 J; E
  180.         UF_CALL ( UF_EVAL_ask_line ( edge_evaluator,    t; C6 }) x6 a* z# T
  181.                                      &edge_data ) );
    , C8 U7 J, j$ e; g: c
  182.     }
    0 P' G& S8 ?- r( y& @0 C+ }/ f, A
  183.     /*  
    ! l2 W4 V# F- ~' b
  184.         Check line/arc/edge periodicity.
    " {6 h0 i) a7 e" T. H: h% M: V. c
  185.     */3 j& p8 R7 n4 X
  186.     {
    ( b' I( Y0 s% \6 Z
  187.         logical is_periodic;
    # C# w6 [; K, e. o8 G; j* {0 V
  188.         
    * F' F$ |0 t# }  v9 E
  189.         UF_CALL ( UF_EVAL_is_periodic ( line_evaluator, * ?8 j) h! n/ v, A/ N
  190.                                         &is_periodic ) );2 ~3 N/ {% T% [
  191.         UF_CALL ( UF_EVAL_is_periodic ( arc_evaluator,  ' u( m% r4 _# {* x* [$ z# j
  192.                                         &is_periodic ) );* i$ z* Q+ J! t8 q
  193.         UF_CALL ( UF_EVAL_is_periodic ( edge_evaluator,  
    5 y0 R6 f* g8 ^4 z8 c# h* y8 Y* _
  194.                                         &is_periodic ) );$ s( F7 v+ e, a. |
  195.     }2 _; H1 F9 I" O7 S( g( }
  196. /*  
    6 P, H) q9 E' b$ |8 Y: q
  197.         Evaluate line/arc/edge.
    ' _+ D$ f% [" t- f1 k
  198. */
    7 B5 l9 u8 t0 M- w, m: `
  199.     {& E( Y8 Z+ Z6 ]( M4 X! L1 ?
  200.         double limits [ 2 ];        ! V$ g9 [* j3 |! s) S
  201.         double mid_t;* |8 I7 Y) c2 X* H
  202.         double point [ 3 ];
    . L9 O2 [6 o, n$ ]
  203.         double derivative [ 3 ];
    8 f0 G( n* a0 e$ _' D: u4 o2 W
  204.         double tangent [ 3 ];
    5 _# o8 p- f! l, J$ k
  205.         double normal [ 3 ];/ X5 o3 ]9 F* p) w7 Z/ J5 X
  206.         double binormal [ 3 ];
    " A- g9 @% s" {' n5 L7 G
  207.         UF_CALL ( UF_EVAL_ask_limits ( line_evaluator, limits ) );
    / _$ i9 V# o! n, O; d  i* g
  208.         mid_t = ( limits [ 1 ] + limits [ 0 ] ) / 2.0;6 ~5 y8 L3 l( O
  209.         UF_CALL ( UF_EVAL_evaluate ( line_evaluator,
    . f1 |$ |8 Y& Z  i/ s4 b" ~5 H6 \6 U
  210.                                      1, 3 ]/ }# Y" e- Q& s
  211.                                      mid_t,
    , _. R9 _( }* n4 r6 M) w
  212.                                      point,
    : k; D1 n+ u+ `7 s3 h' n8 s
  213.                                      derivative ) );/ D& O4 g( x" |% Q  P% }$ R
  214.                   
    * ^9 I- t# S3 o0 b! E9 U& m8 D
  215.         UF_CALL ( UF_EVAL_evaluate_unit_vectors ( line_evaluator,   }- l  i) a9 B  ?' {( }
  216.                                                   mid_t, : H3 [9 L- l: J0 E' q
  217.                                                   point, + I7 i8 \$ g  c9 P9 T8 C8 X
  218.                                                   tangent,
    5 ?$ l* a1 I4 |
  219.                                                   normal, ' d+ s2 U! Z4 |# }9 G
  220.                                                   binormal ) );
    1 h+ R3 ~: j) [
  221.         UF_CALL ( UF_EVAL_ask_limits ( arc_evaluator, limits ) );
    ; W& c" p& _0 `+ i
  222.         mid_t = ( limits [ 1 ] + limits [ 0 ] ) / 2.0;
    # ^1 o+ f3 I# Z, M0 {
  223.         9 q4 E, {9 ?5 D- ~) j
  224.         UF_CALL ( UF_EVAL_evaluate ( arc_evaluator, - |* y3 J6 |5 u0 M+ n% {: J( [
  225.                                      1,
    + ~0 Q) S! V: @6 J% H0 s% K
  226.                                      mid_t,
    " h# w- k( \% e5 p
  227.                                      point, * L7 K3 n( \0 c; n
  228.                                      derivative ) );: d5 O/ e9 \+ B. G2 U- D0 s
  229.         % v' ~2 m9 }9 m) k
  230.         UF_CALL ( UF_EVAL_evaluate_unit_vectors ( arc_evaluator,
    ! g$ s: Y/ c3 ^+ ^) E2 x
  231.                                                   mid_t,
    # I$ _- [' s! z) f
  232.                                                   point, 7 [# P8 X9 a  ~$ K
  233.                                                   tangent,
    " }$ d7 t, \2 Y$ Y4 J# _: Y
  234.                                                   normal, # a9 R0 |3 P9 o# \4 U
  235.                                                   binormal ) );! F+ E, _3 e1 T" N! n
  236.         UF_CALL ( UF_EVAL_ask_limits ( edge_evaluator, limits ) );- H0 \, O; ~0 n; T0 r
  237.         mid_t = ( limits [ 1 ] + limits [ 0 ] ) / 2.0;
    4 {" `: O; i; Y/ c  S$ F
  238.         UF_CALL ( UF_EVAL_evaluate ( edge_evaluator, - l# }( z/ W/ b: C
  239.                                      1, ! v4 Z; ^) p/ e$ W) {
  240.                                      mid_t,
    - f" w& R5 a6 I. T+ E
  241.                                      point,
    + K, l- ^& p6 w: V
  242.                                      derivative ) );% P9 M$ v6 y( ?# O5 Y& J6 x* a# [7 n
  243.         UF_CALL ( UF_EVAL_evaluate_unit_vectors ( edge_evaluator,
    + k9 }0 |5 g' }
  244.                                                   mid_t,
    $ X) w9 }9 D* o; I8 Y1 r
  245.                                                   point,
    ) i+ R2 n( H  M8 d8 @  t6 _; D* K
  246.                                                   tangent,
    + m0 I* q- C5 z* X2 `3 y1 E
  247.                                                   normal, & c4 P3 V# A( g( ^- N, y
  248.                                                   binormal ) );. K2 u" K4 m+ Q( a
  249.     }
    3 U" W' e+ e- l# U; X
  250.     /*  + l7 z, O0 e$ w8 E. {( E
  251.         Check line/arc/edge equality of evaluators.) t6 u6 U0 t; ^6 W2 e8 e; @
  252.     */0 e6 f+ o) c& q5 K1 B
  253.     {/ D9 u/ s8 U3 [2 h
  254.         logical is_equal;7 @! A/ Z/ `. i: q
  255.         UF_EVAL_p_t line_evaluator_copy;
    3 ?- t  ^6 b3 o$ [& i- d
  256.         UF_CALL ( UF_EVAL_copy ( line_evaluator,4 {7 T7 D8 U7 j
  257.                                  &line_evaluator_copy ) );
    5 m" h2 ~( \1 C- @- y" @- e
  258.         UF_CALL ( UF_EVAL_is_equal ( line_evaluator,
    . ^0 [' L9 b7 d" ^( o* w
  259.                                      line_evaluator_copy,- B' w. p; `& v6 @$ ~' e
  260.                                      &is_equal ) );
    $ C) M; S" ]# s$ j" Y
  261.         UF_CALL ( UF_EVAL_free ( line_evaluator_copy ) );5 x+ Q7 A* P- D; q
  262.         UF_CALL ( UF_EVAL_is_equal ( line_evaluator, 3 `' R0 v" e# f8 l' X" E" b
  263.                                      arc_evaluator, + q8 s7 @" |- \9 D5 L8 ~% e
  264.                                      &is_equal ) );0 P( N+ S. s0 ~4 O
  265.         UF_CALL ( UF_EVAL_is_equal ( line_evaluator,
    $ t& ^+ w" K# }4 S; K
  266.                                      edge_evaluator, 3 D- y! T; C; {8 e
  267.                                      &is_equal ) );& D3 z% W0 ~. |  R3 B! K
  268.     }
    ; a/ C9 |$ l. i
  269.     /*  
    . ]9 A) q7 z4 {
  270.         Check line/arc/edge type.
    . d) E5 n8 ^" S/ _# r! a' H# k
  271.     */" m- T" A; L( I8 d1 g! O
  272.     {
    ! ]- \4 A0 n2 U9 [. R
  273.         logical is_line;
    ! k! r' }# A0 m& G2 `  E" D
  274.         logical is_arc;
    + S9 z) U6 g4 n: N5 A6 H# k/ @
  275.         UF_CALL ( UF_EVAL_is_line ( line_evaluator, &is_line ) );
    $ C. C/ X7 q7 g/ m
  276.         UF_CALL ( UF_EVAL_is_arc  ( line_evaluator, &is_arc ) );: D( g1 t1 J# c% ?0 X, T( F  ~
  277.         UF_CALL ( UF_EVAL_is_arc  ( arc_evaluator,  &is_arc ) );
    ( w9 J- T1 K6 T% N
  278.         UF_CALL ( UF_EVAL_is_line ( arc_evaluator,  &is_line ) );' d/ w7 A/ X7 W9 M6 n; E
  279.         UF_CALL ( UF_EVAL_is_arc  ( edge_evaluator, &is_arc ) );4 E& ~, e9 r4 @9 O, ]) `# z4 m) O0 Q
  280.         UF_CALL ( UF_EVAL_is_line ( edge_evaluator, &is_line ) );
    , q! T0 b. B" s6 ~% N* m0 y
  281.     }
    - S1 V( u! ]) O2 ]; H# \
  282.     UF_CALL ( UF_EVAL_free ( line_evaluator ) );+ k; j! k5 n% x, E% @, H5 L- y
  283.     UF_CALL ( UF_EVAL_free ( arc_evaluator ) );/ D) d5 G2 m$ V* `' Y8 T
  284.     UF_CALL ( UF_EVAL_free ( edge_evaluator ) );8 R& J6 C+ g; D1 P6 V% b
  285.     UF_CALL ( UF_terminate ( ) );! d: x; p, c$ K5 P  G2 }2 o+ b5 ?
  286. }- R& P( i0 c. @

  287. 1 j) W6 O  r' Z7 I- f
  288. /* This function will disply n_pts equally spaced along the1 w1 D7 a! j) `$ j2 S0 f) _
  289.    input curve.
    ) J9 o, B) _* M6 A4 v
  290. */
    8 n7 r& @, g4 Q2 [# R
  291. static void show_edge_points(UF_EVAL_p_t eval, int n_pts)
    ' @! b" s$ k, E5 c' n+ N' V
  292. {* k6 ?" f/ @4 g3 v8 b$ B
  293.     int ii;0 V4 O' n# d* k% `$ B9 I0 s& ^# Q
  294.     double limits[2], p, point[3], end_parameter, start_parameter;% n2 F1 E3 c$ X: _7 A+ S5 z. A
  295.     UF_OBJ_disp_props_t+ W9 a; [* |* D* n3 n1 X
  296.         attrib = { 1, UF_OBJ_WHITE, UF_OBJ_NOT_BLANKED, UF_OBJ_WIDTH_NORMAL,6 P3 W# J4 R; X- ~9 k) w! a
  297.             UF_OBJ_FONT_SOLID, FALSE};
    . J4 B  L9 U1 _" g

  298. . p& x  H4 e' S
  299.     UF_CALL(UF_EVAL_ask_limits(eval, limits));
    & w  H; j/ Z4 o6 E9 |' z) U
  300.     printf ( "limit0 = %f\n", limits[0] );# Z& {5 S( P7 k" o- N
  301.     printf ( "limit1 = %f\n", limits[1] );: U( |3 s3 M8 @, p: ^+ C  h3 y
  302.     start_parameter = limits[0];
    7 \* s8 h, A8 L3 t6 W
  303.     end_parameter = limits[1];
    5 v* S+ v/ {8 u% o) x1 l" u- m  H
  304. $ L9 p% `5 }& C: q! q$ c4 L! Z
  305.     for (ii = 0; ii < n_pts; ii++)
    7 M* j  Y6 V4 K8 I" `$ I. R8 x
  306.     {" `4 O. N- V2 [* X0 t. ~% c
  307.         p =start_parameter + ii*((end_parameter - start_parameter)/(n_pts - 1));4 V% a; n5 `& V2 W$ }
  308.         printf ( "evaluate = %f\n", p );9 v7 B% q& W7 ], d  g
  309.         UF_CALL(UF_EVAL_evaluate(eval, 0, p, point, NULL));
    ' t* g$ Z: f. s
  310.         UF_CALL(UF_DISP_display_temporary_point(NULL_TAG,0 J2 J6 m9 u0 c5 @2 l* E; y0 b* E
  311.             UF_DISP_USE_ACTIVE_PLUS, point, &attrib, UF_DISP_POINT));8 m* ~# O0 ^# i8 x* S5 r8 y7 @
  312.     }# t& z, w8 q6 p! m7 {! H

  313. 6 l* Y: n' I/ q+ p7 v- V
  314. }7 g+ V, L. W1 P$ m6 m
复制代码
, g) T: n' }8 z+ U- b1 S- |! }
9 d# }1 g; K+ H9 G5 A
, N- j/ P: f7 y4 r
上海点团信息科技有限公司,承接UG NX,CATIA,CREO,Solidworks 等CAx软件,Teamcenter,3D Experience等PLM软件,工业4.0数字化软件的实施\二次开发\培训相关业务,详情QQ 939801026 Tel 18301858168 网址 www.diantuankj.com/ doTeam.tech
回复

使用道具 举报

发表回复

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

返回列表 本版积分规则

  • 发布新帖

  • 在线客服

  • 微信

  • 客户端

  • 返回顶部

  • x
    温馨提示

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

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

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

    我知道了