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

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

[复制链接]

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

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

admin 楼主

2014-5-3 12:58:05

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

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

x
3 I; A2 k# G9 z/ h! O  \4 C# _
# @* v: R8 k: t/ ~; Y

1 I+ v' o2 `& p2 S9 f5 v. d
7 e. `- I0 [! C9 ], x  F' O4 ?
  1. /******************************************************************************
    ; W3 {9 c; T5 i( M- q7 `
  2.              Copyright (c) 1999 Unigraphics Solutions, Inc.
    $ }1 Y% z) ?4 }& S6 R" B
  3.                        Unpublished - All Rights Reserved. k7 h/ t' b& q

  4. 7 L0 t1 z* H* c' K& K
  5. *******************************************************************************/
    $ b! M& j5 N4 ]( C
  6. /* This example demonstrates the UF_EVAL api for lines and arcs.: F# ~% [& X+ P3 ~, p1 a3 O
  7. Some of the UF_EVAL routines operate on an evaluator! l& f# x; C" Z1 y
  8. independent of type while others are type dependent.  No longer use" Q4 S% X; C3 ?% T+ U$ i$ r
  9. UF_CURVE_ask_curve_struct ( ),
    $ A: s. W) w6 u4 r
  10. UF_CURVE_ask_curve_struct_data ( ) and
      T/ I* B+ \- C
  11. UF_CURVE_free_curve_struct ( )% u, E( H$ X9 j  k. H3 {, b2 M
  12. */
    8 V+ L+ ^5 l: X8 H8 n# v0 R, Y

  13. ! M  |8 U5 M2 Y: H& y- C! s
  14. #include <stdio.h>
    5 W9 w5 M% A3 u5 z9 p, ?( z6 Y6 [
  15. #include <uf_object_types.h>& W/ Q$ Q1 @8 }( o0 g
  16. #include <uf_curve.h>
    3 a  D- j0 x6 q5 D3 B- Q! S
  17. #include <uf_eval.h>6 l+ ?" [1 W6 e$ B$ R
  18. #include <uf_modl.h>, m/ j! A3 E) f( S; K
  19. #include <uf_part.h>
    : Y; y8 E, Q1 R5 E
  20. #include <uf_so.h>
    1 x( o& X8 b; z9 r2 r
  21. #include <uf.h>6 s4 w- w! k3 @. J6 W0 k
  22. #define UF_CALL( X ) ( report ( __FILE__, __LINE__, #X, ( X ) ) ), f! b2 {: ^+ ?% D' Q8 n, q
  23. static void show_edge_points(UF_EVAL_p_t eval, int n_pts);
    5 j8 P; H) O1 B. R  `2 a8 M: i
  24. /*---------------------------------------------------------------*/
    " }- L3 z" i+ O5 \
  25. static int report ( char *file, int line, char *call, int irc )3 ?0 y0 r: S- P& t
  26. {- }& D, l. k3 x3 K" E0 B! ^6 N
  27.     if ( irc ), [; F: j) k) R) P: x0 I& v* \
  28.     {0 n: a- {! F  ^, z% T- i; n
  29.         char message [ 132 + 1 ];
    ! e' ^9 I. n% T7 T/ k3 U
  30.         printf ( "%s, line %d:  %s\n", file, line, call );
    . k0 i  d3 I0 n& P6 F3 W
  31.         UF_get_fail_message ( irc, message ) ?
    4 x1 U/ g0 ]5 ]& u9 q0 H5 r
  32.             printf ( "    error %d\n", irc ) :
    ; k, ~. @3 y1 M4 s2 ~
  33.             printf ( "    error %d:  %s\n", irc, message );
    + [, ?$ T! A; e1 t/ n8 Q
  34.     }
    8 l$ P  c* A7 f3 p/ w
  35.     return irc;3 g1 r! |1 e/ n2 a6 e
  36. }! E" w3 u4 S$ b( u% `- O% D
  37. /*---------------------------------------------------------------*/) S" q3 r% F1 P4 y" E" r
  38. int ufusr_ask_unload ( void ): \: }7 B& v. H$ v# J+ P
  39. {' w& H3 v. D1 y+ [/ a
  40.     return UF_UNLOAD_IMMEDIATELY;
    / T2 O7 L5 o2 _1 i3 a+ H0 U+ I. V
  41. }# |* b+ s. L  j& F& r
  42. /*---------------------------------------------------------------*/4 I+ N2 g0 Y! T/ _
  43. /* ARGSUSED */& v9 w9 s4 k( a  s; ~% L) J. ]
  44. extern void ufusr ( char *param, int *reTCod, int param_len )
    & j8 V" P' ]$ r" T6 |+ h
  45. {% j4 D2 b) n" M4 L- ]& J, x
  46.     tag_t line;; C( C& S( }! o9 [; Z! O
  47.     tag_t arc;" k+ ?: F) F! @3 Z/ ^8 H3 p8 ~4 `
  48.     tag_t edge;7 b$ a. E4 L9 K+ c) S
  49.     tag_t edges [ 3 ];
    " O4 U' M" C$ x0 M6 w
  50.     UF_EVAL_p_t line_evaluator;
    3 ^  `* O. G; P- H
  51.     UF_EVAL_p_t arc_evaluator;& S$ \: z5 ?. p- I+ Y
  52.     UF_EVAL_p_t edge_evaluator;! v. ~; L* G+ X, `. Y' F; v- ^
  53.     UF_CALL ( UF_initialize ( ) );/ f, y2 s/ b, z" d( P  V$ z
  54.     /*  $ G$ y) ]4 Z; |6 e2 C! L6 t9 I
  55.         Create new part "ufd_eval.prt".
    0 D0 {2 U6 G; F/ F/ S6 j
  56.         ' d' [) ?& G0 P& |" K& A# y
  57.         Close part if it already exists.3 N) D! d5 e7 [, Z: [8 M
  58.     */( c7 K! D" z$ s  |9 C
  59.     {4 i$ l' ~. d; {0 N! k; v$ {
  60.         tag_t part = UF_PART_ask_part_tag ( "ufd_eval.prt" );
    0 M* }" a) r$ d7 p
  61.         if ( part != NULL_TAG )% B8 l6 r+ |7 J1 ~* `7 n3 o; ?4 C
  62.         {$ w/ O( W" L: p4 [$ s
  63.             UF_CALL ( UF_PART_close ( part, 0, 1 ) );5 b' r, h2 r3 V( J4 L- c% R2 c, r
  64.         }
    ! V  O! _1 ?4 ~
  65.         UF_CALL ( UF_PART_new ( "UGd_eval.prt",
    * v. u! ~6 i" o' _, e  O
  66.                                 UF_PART_ENGLISH,
    % T3 w( {( j) c4 P! ]
  67.                                 &part ) );
    - E8 b1 u' }. {. h5 s$ ~0 O. Y# Y
  68.     }
    7 x# T: D: A5 H; i8 k
  69.     /* $ u0 j* z- m. M" y
  70.         Create block and get edges. 8 S0 y4 ^- @1 z! ^" z
  71.     */8 q# X! V6 {" N0 X7 x' ~
  72.     {* q4 a' p2 Z* d/ p  ^2 t
  73.         double  origin [ ] = { 0.0, 0.0, 0.0 };
    $ L1 j/ L+ D& {+ M/ a: i1 N
  74.         char   *sizes  [ ] = { "1", "1", "1" };: x# T5 n: S- L7 F8 C
  75.         tag_t block_feature;! C4 U4 w( L  b) }- e
  76.             
    ! @, C) \: U" u8 E% j7 N% M
  77.         UF_CALL ( UF_MODL_create_block1 ( UF_NULLSIGN, # y, V+ _7 [( Z+ ?! O2 X
  78.                                           origin, " R% S! z( _8 h9 p; \: w- R
  79.                                           sizes,
    2 U/ h# O' l& `9 b5 Y9 g8 ^) K
  80.                                           &block_feature ) );. E) }, D( K+ D! z
  81.         {& j: N, [! v3 z" Y8 N
  82.             uf_list_p_t edge_list;  |, q7 @% g! S& f7 ^
  83.             UF_CALL ( UF_MODL_ask_feat_edges ( block_feature,
    9 _7 c! T8 E7 r
  84.                                                &edge_list ) );
    ) K, t3 B. r2 d% M  A
  85.             
    ) S. ^: s: D' c# e
  86.             UF_CALL ( UF_MODL_ask_list_item ( edge_list, % q$ C; B3 T3 z4 k
  87.                                               1,
    7 a2 N' U( Q: t, u. l5 {" s  d5 b
  88.                                               &edge ) );
    , i! P" j6 G& E) z% }
  89.             edges [ 0 ] = edge;5 j$ k1 ^6 F1 {. f7 C; n
  90.             edges [ 1 ] = edge;5 V' W9 |8 S! a; N5 o. Z$ K+ e
  91.             UF_CALL ( UF_MODL_ask_list_item ( edge_list,
    ) X  E" Y) l# h# h0 V$ _/ P
  92.                                               0, - ^5 u' a* k1 ?& J
  93.                                               &edges [ 2 ] ) );6 l& X+ v0 J  H; g( j
  94.             UF_CALL ( UF_MODL_delete_list ( &edge_list ) );/ f; z: K& ^8 t, N1 K
  95.         }
    . {& C4 y' g) b3 B  f1 }
  96. }
    % ~2 }6 m, U5 f  g8 B/ `# O0 @
  97.     /*  
      ]' {' m' ?. g7 |; f) k
  98.         Create smart line.
    5 X& \* A9 }, ]. h# R) r: D. _# @
  99.     */
    7 W1 s3 e# D0 r$ `6 Z9 c5 C. X
  100.     UF_CALL ( UF_SO_create_curve_extract   O7 w$ z. {; _, l% H/ t
  101.               (
    4 P. N- ?% Q& O
  102.                   edge, 8 i5 {5 _  a; s6 c
  103.                   UF_SO_update_after_modeling, # K( G6 o1 u" J* f9 g3 d9 e
  104.                   edge,
    / [- V. |6 o9 d& ]
  105.                   UF_line_type, /* enforce line type */
    3 q6 s7 t/ h9 q% q5 a
  106.                   0,            /* no subtype to enforce */# U% n; \" b8 T/ K: a
  107.                   NULL_TAG,
    1 O- i9 s( i( Q) I/ P+ |7 K0 w
  108.                   &line
    3 s0 Q1 Q; v# I) `
  109.               ) );
    " b5 |7 I- a( @  v( Q  B
  110.         
    1 ~3 @* q: w9 i; Y
  111.     /*  
    9 \" w4 T7 s! g7 E) m6 P
  112.         Create smart arc.
    . L6 i& Q% _* U
  113.     */# `* N% u* S7 y6 R) f
  114.     {( v% v) E% ~7 u5 U9 @
  115.         int i;* q% A8 ?. M# y6 N/ Q
  116.         tag_t points [ 3 ];; J$ k* q$ I) S
  117.         for ( i = 0; i < 3; i++ )
      b: _- o5 S  O2 d4 G
  118.         {2 L; @$ C2 J2 z3 t. ^& B
  119.             char *strings [  ] = { "center=1.0",
    ' k; h& p/ N+ V! q3 H
  120.                                    "start=0.0", , b5 o, s, i" r- Q4 w9 R- t
  121.                                    "end=1.0" };% ]& R$ e8 E* d1 i' j: z' L
  122.             tag_t exps    [ 3 ];8 F( D" b& `# d" v( L5 C
  123.             tag_t scalars [ 3 ];' d$ I; d% S# ~2 B0 E: }4 W
  124.             UF_CALL ( UF_MODL_create_exp_tag ( strings [ i ],
    2 S6 y9 c0 W% W
  125.                                                &exps [ i ] ) );3 i3 R. Z# v. M( |$ \3 e4 j
  126.             UF_CALL ( UF_SO_create_scalar_exp & j. G  V1 i' f9 H4 o% `
  127.                       ( * \8 q3 O/ b9 Y) U' N
  128.                           exps [ i ],
    + K7 D' l2 B+ u  F! M7 N
  129.                           UF_SO_update_after_modeling, 6 x$ Z4 R+ y% q4 k* k
  130.                           exps [ i ], $ Y* G2 H, n( t9 B7 H7 U0 q
  131.                           &scalars [ i ]
    8 U3 J) ?' O" H$ N& f! f
  132.                     ) );
    ) _) {' A! Q8 ~6 J! H5 c5 V0 L$ a: `
  133.             UF_CALL ( UF_SO_create_point_on_curve   ]5 w+ z* q. l
  134.                       (2 A3 a5 F% d) m1 d; p* M
  135.                           edges [ i ],
    0 s6 Q* O1 g! f% @. @7 R
  136.                           UF_SO_update_after_modeling, * ~% ^# L/ j8 n
  137.                           edges [ i ],
    " n) i  B! U& q& Z, c# W
  138.                           scalars [ i ],
    - C$ F% e" t- Y) X' W
  139.                           &points [ i ]& c3 v3 @! k% Z% t; Z
  140.                     ) );
    9 j2 x. f! d+ s
  141.         }, o# O2 ]0 N: p3 R
  142.         UF_CALL ( UF_SO_create_arc_center_2_pnts , {4 f, i; t) v& D, c
  143.                  (
    " e/ i) ]6 j3 T8 R% B; ~
  144.                       points [ 0 ], 5 S5 }: k; p5 l; p, |) `. h
  145.                       UF_SO_update_after_modeling,& q0 |3 V5 U9 T8 N. D& P
  146.                       points,
    5 ^+ f. F# N9 B7 u, O
  147.                       &arc
    ' c1 R' L" j. ?, s" h! Q
  148.                   ) );
    ; e( b% Z5 J" q# k  ?3 ^
  149.     }8 ?# [# p- A3 C
  150.         
    9 j3 X* k* p  D2 |5 I' P
  151.     /*
    1 p3 d% Q3 t: s2 `6 L
  152.        Smart objects are created as invisible objects by
    7 w' S" ~9 j- E4 |4 R+ i
  153.        default.  UF_SO_set_visibility_option ( ) can be
    - c  ~+ B: W3 y, V
  154.        used to make them visible in the graphics window.: n3 ~5 j' }1 L# B
  155.     */* L4 u+ G! B$ R
  156.     UF_CALL ( UF_SO_set_visibility_option ( line, 6 R* e) u$ _$ z
  157.                                             UF_SO_visible ) );2 R0 J; A! _9 Y
  158.     UF_CALL ( UF_SO_set_visibility_option ( arc,  . ?" r* X1 C7 O* p3 [/ _
  159.                                             UF_SO_visible ) );
    + V$ C* g7 h: {, _& h4 W
  160.     /*  
    2 f. j  y) K# r" X+ b
  161.         Get line/arc/edge evaluators.
    9 Q6 Q  `) w% D/ i4 M
  162.     */
    5 X2 h- i, X3 m9 C) ^
  163.     UF_CALL ( UF_EVAL_initialize ( line, &line_evaluator ) );# q4 {1 R$ H' B/ i& ^4 J, K! [
  164.     UF_CALL ( UF_EVAL_initialize ( arc,  &arc_evaluator ) );, C3 z/ ?. j5 S$ B; H, \; r0 k/ ~
  165.     UF_CALL ( UF_EVAL_initialize ( edge, &edge_evaluator ) );" W7 ~6 F1 b6 b5 S
  166.     show_edge_points(line_evaluator, 10);
    1 @( l2 \) l  c, y) S
  167.     show_edge_points(arc_evaluator, 10);* ~8 J  L: F" P/ d4 q* d& P
  168.     show_edge_points(edge_evaluator, 10);
    3 r. Q# u' Y4 u
  169.     /*  ! c" m$ V' X- E! I
  170.         Get line/arc/edge data.- n/ V5 @( k) U" O+ s3 `
  171.     */- P4 r& i! P! k+ ~0 n
  172.     {
    4 A& N! d' A- B" C% n0 N: d* H# `; h
  173.         UF_EVAL_line_t line_data;" l1 v$ C: U2 @% m" z. A1 n! _
  174.         UF_EVAL_arc_t  arc_data;" c: K5 S6 {- m
  175.         UF_EVAL_line_t edge_data;
    - `3 D; y, j! [( H/ K; G& T
  176.         UF_CALL ( UF_EVAL_ask_line ( line_evaluator,
    ; T9 N. x& j4 e/ O- }
  177.                                      &line_data ) );7 X9 _, ^7 S" @. W. x, p3 E7 K9 e
  178.         UF_CALL ( UF_EVAL_ask_arc  ( arc_evaluator,  7 y% h! ^- ]5 G* e+ v# ^
  179.                                      &arc_data ) );
    2 J* j  k& K) }! U! f+ M
  180.         UF_CALL ( UF_EVAL_ask_line ( edge_evaluator,  
    : p) u0 ^! b2 [+ G/ L
  181.                                      &edge_data ) );. Y8 o  [2 N6 ]
  182.     }
    & N+ ~* ^6 v: c; i  Y: N
  183.     /*  . Q- `, _9 i! G8 N
  184.         Check line/arc/edge periodicity.
    ; c+ l( v  D" O
  185.     */  M) M! z) Y+ N2 [# e
  186.     {
    7 ], ?( A4 d6 O6 H6 L# g0 B) ?
  187.         logical is_periodic;
    , H% ]6 `. k+ w! M/ F
  188.         
    # N7 {$ c9 S4 d* }6 G: U2 `) w+ p
  189.         UF_CALL ( UF_EVAL_is_periodic ( line_evaluator, - J+ g6 P9 R' u" v) L, ?& U, @
  190.                                         &is_periodic ) );
    2 b* V3 E6 H& A9 x" \) M- w
  191.         UF_CALL ( UF_EVAL_is_periodic ( arc_evaluator,  & T! \/ A( R/ S1 _7 }
  192.                                         &is_periodic ) );# r7 a* `/ M8 a, W
  193.         UF_CALL ( UF_EVAL_is_periodic ( edge_evaluator,  ( w) K# d" S+ Y. V' _* l
  194.                                         &is_periodic ) );
    $ l9 v2 x$ n6 Z* l
  195.     }
    ) W5 }, Z& f# }+ n3 [  W! Y
  196. /*  
    % N1 c$ @/ o, F2 C
  197.         Evaluate line/arc/edge.8 C& o2 o0 f  p4 f- |
  198. */2 v6 ]' |; c3 B' _: {
  199.     {
    8 [! s, f7 x7 m* `; ]
  200.         double limits [ 2 ];        
    # x: N2 M; t5 g
  201.         double mid_t;
    " d* {7 g4 F& n( u. P) h; L
  202.         double point [ 3 ];
    . b. A4 `5 n, D' c' R  f
  203.         double derivative [ 3 ];) s$ ^, _4 v* M+ p
  204.         double tangent [ 3 ];& {, Q9 j. m5 a7 i+ i
  205.         double normal [ 3 ];! R; I' n7 k0 d
  206.         double binormal [ 3 ];$ k" z4 B. t. v$ L# |7 u3 F, i1 I
  207.         UF_CALL ( UF_EVAL_ask_limits ( line_evaluator, limits ) );
    ( X$ B  R; s$ f2 M4 K
  208.         mid_t = ( limits [ 1 ] + limits [ 0 ] ) / 2.0;) G7 Z3 X* ?, H* I- `
  209.         UF_CALL ( UF_EVAL_evaluate ( line_evaluator,
    ) n; U6 \1 Z: b7 j
  210.                                      1,
      W7 `. j: X+ n
  211.                                      mid_t,
    / S9 t$ W% \' O" L& u# x; Q
  212.                                      point,
    7 y8 _9 C0 B2 v5 h* i! |
  213.                                      derivative ) );& l/ L# f2 `( f5 v5 d- u% y% Y
  214.                   
    ; Z& F% Z% ]2 J) C' o
  215.         UF_CALL ( UF_EVAL_evaluate_unit_vectors ( line_evaluator,
    - N2 Q/ u3 _, @4 c) H
  216.                                                   mid_t,
    + Y1 F$ ^  q3 t8 [/ g7 ~( ^
  217.                                                   point, ' K# ^9 C+ u0 d6 w3 B; P( z" e
  218.                                                   tangent, - b" H5 ?. X8 N# S
  219.                                                   normal, : K" y5 B) j6 T' M" ]+ I
  220.                                                   binormal ) );  e* v, C7 A5 c1 X. J& W: Z
  221.         UF_CALL ( UF_EVAL_ask_limits ( arc_evaluator, limits ) );
    7 R" P8 F# M# E( X/ B& B
  222.         mid_t = ( limits [ 1 ] + limits [ 0 ] ) / 2.0;/ D7 X, |; H4 h' C
  223.         # {& m+ _5 S3 F/ ~; H
  224.         UF_CALL ( UF_EVAL_evaluate ( arc_evaluator, + g  O' H% |! ^: L2 O0 n
  225.                                      1, ) {$ S& i. C. b7 b! G
  226.                                      mid_t,
    7 [, [" F* t' l; V/ S: q
  227.                                      point,
    ' _# N% Q0 ]- \1 X3 D9 s
  228.                                      derivative ) );' m4 `1 b& V5 G9 I5 Z
  229.         
    ( d4 N6 i5 l0 b9 B
  230.         UF_CALL ( UF_EVAL_evaluate_unit_vectors ( arc_evaluator, ; |+ b& N  l1 [5 v7 O6 D; C" W+ K# X
  231.                                                   mid_t,
    - X/ \/ s1 S4 C# F$ V8 j
  232.                                                   point,
    3 L: w0 a0 N0 N% A
  233.                                                   tangent,
    ) g2 X/ L3 x" R2 k
  234.                                                   normal, ) |# K( o/ |3 o, A' p
  235.                                                   binormal ) );$ a: v1 u! o: d% ]
  236.         UF_CALL ( UF_EVAL_ask_limits ( edge_evaluator, limits ) );5 f; i; C  A: r- x( I8 L
  237.         mid_t = ( limits [ 1 ] + limits [ 0 ] ) / 2.0;" }; S8 s' |- u( T* ~8 V0 F8 E
  238.         UF_CALL ( UF_EVAL_evaluate ( edge_evaluator,
    + c. ~& o5 |' a8 R2 x2 w4 Q
  239.                                      1,
    . \* _( s2 A- v
  240.                                      mid_t, 1 `5 J* ]& z" @' B2 W, V7 n0 [
  241.                                      point, # ^" G! r; c. S
  242.                                      derivative ) );
    , I( P  v- o5 ?4 {# N
  243.         UF_CALL ( UF_EVAL_evaluate_unit_vectors ( edge_evaluator,
    ! c4 ?, p7 R! o2 B
  244.                                                   mid_t, . e( R3 V2 h+ E1 x' {& P
  245.                                                   point,
    7 y4 f! w" }% d! E; k
  246.                                                   tangent,
    / Q: t& o# {% d( t4 f% a) I/ r; R- U
  247.                                                   normal,
    0 L3 w; ]& |- d; g/ _) _0 O
  248.                                                   binormal ) );
    ! v: r, ]: k- {! E7 E( F: o
  249.     }
    " {8 Z6 g, r. |. |
  250.     /*  3 o+ E2 a0 N; Y9 }: a
  251.         Check line/arc/edge equality of evaluators.1 v  K& ]4 A* w. @  n' H
  252.     */' |8 t4 g3 }+ [9 }4 y  |8 L
  253.     {# h  R9 d( e( p  I# p/ u  d5 h+ Y
  254.         logical is_equal;
    # o8 ~( n2 \/ ?, T% U( C- x2 N" {
  255.         UF_EVAL_p_t line_evaluator_copy;
    0 M* J+ ?0 S5 r$ p5 t
  256.         UF_CALL ( UF_EVAL_copy ( line_evaluator,
    - V0 P) j0 [6 o4 z$ J3 ^
  257.                                  &line_evaluator_copy ) );
    " ]5 m  i" D( I5 o8 W# V. k! c+ K
  258.         UF_CALL ( UF_EVAL_is_equal ( line_evaluator,
    0 u% y6 x5 n' ]5 r6 x' w# f
  259.                                      line_evaluator_copy,. _5 d6 I: q% H. R1 A
  260.                                      &is_equal ) );
    & a3 w) z; X9 x' D3 P, L8 d
  261.         UF_CALL ( UF_EVAL_free ( line_evaluator_copy ) );/ }+ h- ^" Q/ O( s, B
  262.         UF_CALL ( UF_EVAL_is_equal ( line_evaluator, - J' I0 v5 E9 i
  263.                                      arc_evaluator,
    & ~* }: Q* e/ _" }7 T" T
  264.                                      &is_equal ) );
    6 I* }. a. |/ Z# l
  265.         UF_CALL ( UF_EVAL_is_equal ( line_evaluator, ; o& E; o, B) R4 W1 k/ V/ {- {
  266.                                      edge_evaluator,
      q5 G9 V! R# ?% o
  267.                                      &is_equal ) );& p8 ?' \; N, L: \6 Y
  268.     }' P5 L# D0 w. J6 R2 A6 |  B
  269.     /*  5 F& Y" ]+ @5 v
  270.         Check line/arc/edge type.
    8 y+ `. t( q- L) h- p
  271.     */
    ( B* E2 ~; e! [& C" p! L. C. x0 r) \
  272.     {
    4 I& f* v/ B/ F% V: }
  273.         logical is_line;
    2 o* M; V  n4 y2 U8 F
  274.         logical is_arc;5 s4 x8 {( |: l% `7 a/ w
  275.         UF_CALL ( UF_EVAL_is_line ( line_evaluator, &is_line ) );
    3 S3 ^" j/ z/ p
  276.         UF_CALL ( UF_EVAL_is_arc  ( line_evaluator, &is_arc ) );4 N  k0 u& [! C" i
  277.         UF_CALL ( UF_EVAL_is_arc  ( arc_evaluator,  &is_arc ) );
    ) X, b* R- [/ n& k4 x' V. T9 n
  278.         UF_CALL ( UF_EVAL_is_line ( arc_evaluator,  &is_line ) );
    + |* L9 a# X& U5 j/ p# L' h, ?8 i
  279.         UF_CALL ( UF_EVAL_is_arc  ( edge_evaluator, &is_arc ) );2 A+ G* E3 u! Q
  280.         UF_CALL ( UF_EVAL_is_line ( edge_evaluator, &is_line ) );
    + x+ N1 g) v$ Z2 o4 j) A9 ~
  281.     }
    8 ^4 p+ P5 K6 N# L5 B( m
  282.     UF_CALL ( UF_EVAL_free ( line_evaluator ) );! m$ _1 R! a+ Y
  283.     UF_CALL ( UF_EVAL_free ( arc_evaluator ) );
    3 \  l# n. A+ i3 f8 @
  284.     UF_CALL ( UF_EVAL_free ( edge_evaluator ) );
    % ~  l" G! v: y: {5 K" B
  285.     UF_CALL ( UF_terminate ( ) );
    8 g7 G+ `( j& z2 ?: C5 z" d/ I1 F
  286. }
      Q4 q* n! @8 X

  287. / j, l. l3 F5 z$ G! O2 [# U
  288. /* This function will disply n_pts equally spaced along the
    * d! M. ]! U: z9 f3 o. X% e3 p
  289.    input curve.! H1 `8 w+ l- o& m5 j
  290. */
    0 y2 S* P- a2 L
  291. static void show_edge_points(UF_EVAL_p_t eval, int n_pts)1 i. r  r- r+ O' l5 g
  292. {
    $ I9 d$ _8 J+ S0 B/ h5 X
  293.     int ii;
    : K9 }6 b/ z, l0 \5 B  o% ?
  294.     double limits[2], p, point[3], end_parameter, start_parameter;
    ! z/ N/ @3 w2 S5 C5 I
  295.     UF_OBJ_disp_props_t. t8 }0 {6 C9 Y6 z; w/ x
  296.         attrib = { 1, UF_OBJ_WHITE, UF_OBJ_NOT_BLANKED, UF_OBJ_WIDTH_NORMAL,
    1 D4 b0 W( u" _0 |9 _" _# V- l
  297.             UF_OBJ_FONT_SOLID, FALSE};
    7 ]: Z8 o; O  [: |9 ^, v& _

  298. 2 ^% R/ l' S9 ?# r  a; ~
  299.     UF_CALL(UF_EVAL_ask_limits(eval, limits));
    8 |2 E6 p' ~. P4 L  S& N" r2 k
  300.     printf ( "limit0 = %f\n", limits[0] );
    7 T* z0 d" O% o3 f3 B
  301.     printf ( "limit1 = %f\n", limits[1] );
    1 k: c/ k% t1 A; m" a# v9 I. O
  302.     start_parameter = limits[0];4 m& m/ ]) T# _0 E4 }: l) {. b
  303.     end_parameter = limits[1];/ a  e8 a1 J5 c; F- T6 C

  304. 6 S2 U/ v, G  P+ o2 y. h6 u: M
  305.     for (ii = 0; ii < n_pts; ii++)
    % Q4 u: w4 _, M
  306.     {
    0 G6 g2 M* H9 c/ O
  307.         p =start_parameter + ii*((end_parameter - start_parameter)/(n_pts - 1));
    2 P( Z4 ]5 N, M  O* D7 J, Y$ D9 G
  308.         printf ( "evaluate = %f\n", p );
    7 s# ^: m1 k5 X4 V  W1 R& ~
  309.         UF_CALL(UF_EVAL_evaluate(eval, 0, p, point, NULL));# U7 O; ^3 l9 H; b" d: I
  310.         UF_CALL(UF_DISP_display_temporary_point(NULL_TAG,
    5 G* ?" I8 G3 d$ J; m
  311.             UF_DISP_USE_ACTIVE_PLUS, point, &attrib, UF_DISP_POINT));5 }% a# U2 T6 ^
  312.     }' m0 v6 y/ X' Z4 e0 {

  313. + o; v: ]& `" |
  314. }
    1 k6 Y  \' t; Z% |" C
复制代码

2 c8 X, Y' j, c5 K
! H% K' I+ f$ B2 {- n, W% M# F! ^6 D: i! M, N- e5 Y
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了