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

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

[复制链接]

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

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

admin 楼主

2014-5-3 12:58:05

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

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

x

, M& S7 Y! i' A5 i, B3 d2 ^* D* M$ t/ P, ?! I6 S& y

' k% [) b& h: z0 @  J! n5 k5 Q/ [) W8 x& j' F
  1. /******************************************************************************% d9 t7 X' I9 P
  2.              Copyright (c) 1999 Unigraphics Solutions, Inc.
    0 N- j3 V/ I* U0 d% k: Z" x. f
  3.                        Unpublished - All Rights Reserved$ `- U/ l6 J1 e, C5 h5 M

  4. + ^8 q7 c& H% |0 ]& V3 M" m& Q# s
  5. *******************************************************************************/
      \& r( E& ]0 d- K2 s4 o, a
  6. /* This example demonstrates the UF_EVAL api for lines and arcs.7 |! d4 t8 b( }: j
  7. Some of the UF_EVAL routines operate on an evaluator# A9 \, X; b5 |4 }; \9 I0 w
  8. independent of type while others are type dependent.  No longer use* y4 B) ?* P6 m- L  n
  9. UF_CURVE_ask_curve_struct ( ),
    ! d" p' g1 ^  y( {4 Y2 K7 q: j
  10. UF_CURVE_ask_curve_struct_data ( ) and
    4 T0 D2 y7 n9 I# m( z- i# p
  11. UF_CURVE_free_curve_struct ( )
    8 z9 v" g: w& q" R
  12. */
    : k4 ?- P2 o4 G5 z6 j

  13. 9 A$ z# ^( y% a6 p( N7 C+ K- y
  14. #include <stdio.h>
    % A( H7 u6 t$ @- Z* i. P
  15. #include <uf_object_types.h>
    7 w/ X% W: k4 {; S- n& Q) h) t" B; n
  16. #include <uf_curve.h>
    * K' w  D+ W# L# a- o  v( @4 Z
  17. #include <uf_eval.h>
    8 R0 T) b5 W9 R" C; Q
  18. #include <uf_modl.h>
    4 i$ G) e4 d0 e* U( A
  19. #include <uf_part.h>
    8 g/ L3 p( e, K
  20. #include <uf_so.h>
    + P5 A7 \( J/ }# ^6 G2 ]; N5 V
  21. #include <uf.h>& O- H5 ^  B) r
  22. #define UF_CALL( X ) ( report ( __FILE__, __LINE__, #X, ( X ) ) )3 p- H/ x$ H8 j
  23. static void show_edge_points(UF_EVAL_p_t eval, int n_pts);
    2 A# l0 q. ~' Z+ Y# ?
  24. /*---------------------------------------------------------------*/
    6 F) w7 K4 g$ y6 V! p  j+ |
  25. static int report ( char *file, int line, char *call, int irc )
    : s$ x! n7 {9 O) r. B4 P- ~
  26. {
    0 \$ q1 T0 J2 ^- Z4 L7 s
  27.     if ( irc )1 O7 q  m5 ]5 f$ z, F" ?
  28.     {
    " d! k. L; ^; M4 o
  29.         char message [ 132 + 1 ];; V! g3 f4 n! D- C0 R3 M+ W0 s% J
  30.         printf ( "%s, line %d:  %s\n", file, line, call );7 E' Y' S7 Y) J4 A9 O
  31.         UF_get_fail_message ( irc, message ) ?
    ' E8 B, |- J* m: F
  32.             printf ( "    error %d\n", irc ) :9 x" W8 t: L6 H1 f$ z5 B+ \. p$ G
  33.             printf ( "    error %d:  %s\n", irc, message );
    $ D- l9 `. \- L4 T
  34.     }6 \% v" z3 A7 b% p4 X) f& m) H) K
  35.     return irc;3 k9 I' M; E8 G* X  x& t
  36. }1 C: R3 e8 U1 I- q/ G- B
  37. /*---------------------------------------------------------------*/! @. A+ g: p8 d$ a$ {, V
  38. int ufusr_ask_unload ( void )
    ) A+ I' x$ S( i# x, o7 w: {
  39. {' |0 {1 g& J  D
  40.     return UF_UNLOAD_IMMEDIATELY;
    7 R, R7 g& B( b) y  p9 ]' d
  41. }3 d  k8 ~% g" f0 [
  42. /*---------------------------------------------------------------*/0 P3 ?( k0 _* e
  43. /* ARGSUSED */) F8 I: B) Q+ X+ _
  44. extern void ufusr ( char *param, int *reTCod, int param_len )- G- m7 M; L, C' d
  45. {
    6 g. I/ \2 C: v. \+ N
  46.     tag_t line;0 ?  C  x2 i' c; v/ k! y" T
  47.     tag_t arc;( u; X: l& \3 c6 G
  48.     tag_t edge;
    % ~& y+ ]/ ^. D9 l, Y
  49.     tag_t edges [ 3 ];+ }0 L4 t7 |  V5 c8 I4 w9 P
  50.     UF_EVAL_p_t line_evaluator;
    ; M( q6 B7 M" d! v# j
  51.     UF_EVAL_p_t arc_evaluator;6 W* e: U3 K0 ?. ]
  52.     UF_EVAL_p_t edge_evaluator;
    0 a* G# w) f  ?7 Z; ~
  53.     UF_CALL ( UF_initialize ( ) );
    1 g, |, P4 q4 S; N& E7 `
  54.     /*  0 j7 p- L( e6 _) m
  55.         Create new part "ufd_eval.prt".! e; ^; @+ R1 N( d$ x4 `
  56.         9 n; b3 `) h$ l0 Z$ w, w# e
  57.         Close part if it already exists.
    6 P: n  b. ?% g+ {5 O. g5 R) }
  58.     */# k) X7 K7 L0 S6 k; ]/ D& M
  59.     {+ J) d  Y1 x1 x* U" V6 @
  60.         tag_t part = UF_PART_ask_part_tag ( "ufd_eval.prt" );
      z2 t# D0 c% W
  61.         if ( part != NULL_TAG )
    4 ]' d6 t; h+ t5 T( i
  62.         {# P% _9 n( D$ u+ \7 c! B
  63.             UF_CALL ( UF_PART_close ( part, 0, 1 ) );
    ( B, [  F  K; e! |  s* N  H
  64.         }
    , Y0 t( M  T8 L' L$ H4 d
  65.         UF_CALL ( UF_PART_new ( "UGd_eval.prt", / y2 N$ I8 H* `
  66.                                 UF_PART_ENGLISH, - D& d1 M$ @$ m
  67.                                 &part ) );
    4 ?8 x( l  d" U9 n
  68.     }
    - I- {. U1 ^9 ~1 r% ]
  69.     /* # n& X: S4 H7 h% n3 s, C5 l
  70.         Create block and get edges. : U/ S+ o0 X8 v: e: c( _
  71.     */6 `' g1 P% O# s. \/ b
  72.     {
    , C; |3 B5 {+ m/ t0 x
  73.         double  origin [ ] = { 0.0, 0.0, 0.0 };- z& E& B, z2 C7 ?9 }8 J6 e
  74.         char   *sizes  [ ] = { "1", "1", "1" };( C; E- B. c* V, R. o
  75.         tag_t block_feature;( h+ z8 {/ a0 T7 {
  76.             
    1 o- n5 X7 [, I: @7 i. {
  77.         UF_CALL ( UF_MODL_create_block1 ( UF_NULLSIGN,
    , G, H$ z; m. q- m: Z2 ^  K# v
  78.                                           origin, ( m- o6 n; q* T/ j, s
  79.                                           sizes, 6 s( }0 ~6 ^% g6 |+ O/ i
  80.                                           &block_feature ) );2 w0 Q& a! T& i3 m& T2 S
  81.         {
    8 c8 c  Q( w! r5 a& Y
  82.             uf_list_p_t edge_list;9 }. ?' g& z- D/ D' `
  83.             UF_CALL ( UF_MODL_ask_feat_edges ( block_feature, - w* @' s* T1 G+ x8 c# j' ?( n
  84.                                                &edge_list ) );
    ' i* v; C6 J7 X! B% q2 h+ S
  85.             
    ( K, g4 d* u& L8 [/ I
  86.             UF_CALL ( UF_MODL_ask_list_item ( edge_list, - r6 D5 y  t6 d9 H0 Z! I$ [
  87.                                               1, " d9 z& i6 h. P; }2 w
  88.                                               &edge ) );: d; Q" [; [$ D' B" ^! e$ v5 {
  89.             edges [ 0 ] = edge;
    ; c" Q, y  Q% `" o
  90.             edges [ 1 ] = edge;% ~- l2 P/ D9 X; }7 m3 s/ g
  91.             UF_CALL ( UF_MODL_ask_list_item ( edge_list, 4 d* V/ q. R2 f1 V' U* F( ?
  92.                                               0, 6 t) w( C4 D- Z1 |% j: L3 d# A6 C; q
  93.                                               &edges [ 2 ] ) );' h1 e' T0 y) k2 @1 F& h
  94.             UF_CALL ( UF_MODL_delete_list ( &edge_list ) );' R+ o6 d" F0 n: Y4 I9 w* \. }
  95.         }- I* i% I) D6 X' {: a: H# K
  96. }( m' l* J+ }3 ~4 ^% E
  97.     /*  + B: k3 @' W- d" n$ s
  98.         Create smart line.
    2 S# H! T; H5 m
  99.     */
    4 _7 o" A: [% p; q' k
  100.     UF_CALL ( UF_SO_create_curve_extract # w& e- `! \' G) A' C" I8 X5 p
  101.               (
    3 ]% l& y2 d- I' ^0 ]% {+ \
  102.                   edge, 0 n: s; B6 R# o) z
  103.                   UF_SO_update_after_modeling,
    8 }" }, l0 L: E) \4 I% q
  104.                   edge,; }# r) Y6 Y( n' o5 M
  105.                   UF_line_type, /* enforce line type */( ~' q! D3 s8 W- v% W
  106.                   0,            /* no subtype to enforce */% ^$ E* T- c0 {6 T: c' A( `
  107.                   NULL_TAG,$ ^# d4 ?( l8 E# D
  108.                   &line ; z( i6 T0 P4 b. o9 ?4 ~  [! m) W
  109.               ) );" m1 c* H- |3 J4 X2 [0 _
  110.         8 [0 W9 C3 [* l
  111.     /*  
    ; }7 k3 a' x: _6 ?; z# A+ x, Y5 i
  112.         Create smart arc.
    ) y+ b/ i! u' R: `" m1 S+ c  H
  113.     */
    $ y9 ~/ e2 w& R. e
  114.     {; |! M( |; ^/ G+ ~& M% i
  115.         int i;  M$ e: F  Q/ ]  J
  116.         tag_t points [ 3 ];  x; R( R2 t) l7 j  V6 c+ l
  117.         for ( i = 0; i < 3; i++ )+ r( P) b: W) V7 e8 m2 K; U9 B) [
  118.         {) D* y. |! {$ P6 q* M7 o
  119.             char *strings [  ] = { "center=1.0",
    ' y* _' N4 s0 I9 V
  120.                                    "start=0.0", 4 u$ ^/ ], g' F+ }4 P, i' Q1 I0 q
  121.                                    "end=1.0" };  F, X( H' Z, q3 s1 z7 M1 Q) d# m
  122.             tag_t exps    [ 3 ];
    3 W" U& R, v0 z! y- w
  123.             tag_t scalars [ 3 ];
    ! u6 y) p) ^& W5 W8 ~1 f7 q0 u
  124.             UF_CALL ( UF_MODL_create_exp_tag ( strings [ i ], % l& [) [+ ~: c. X2 N
  125.                                                &exps [ i ] ) );5 y, s% \5 j. B
  126.             UF_CALL ( UF_SO_create_scalar_exp
    % n0 g$ B. b2 u& K8 r
  127.                       ( : L. n7 P: {# ]
  128.                           exps [ i ],
    6 D" g0 x8 A  ~, O3 L  E- I4 O
  129.                           UF_SO_update_after_modeling,
    8 M8 g% ?3 e5 ]: Z; |" P  l
  130.                           exps [ i ],
    8 Z( O5 l* N% P. Y& c$ i" B
  131.                           &scalars [ i ]
    8 c( A, l0 g8 P
  132.                     ) );7 M# Z7 }' [1 Y+ B/ N7 {% Q) I
  133.             UF_CALL ( UF_SO_create_point_on_curve
    ; z8 K; B! @  x# M
  134.                       (
    2 z1 e6 Z1 V. F. x
  135.                           edges [ i ],
    3 M$ t) z. X1 k" I! y
  136.                           UF_SO_update_after_modeling,
    " s/ l1 m2 V. @1 ]& Y& E$ j1 n
  137.                           edges [ i ],
    5 f$ t1 `, X# m: g# _
  138.                           scalars [ i ],
    3 s- t9 C* y" z; Z5 N
  139.                           &points [ i ]
    , X8 X1 n$ C/ f" S/ n( _* J
  140.                     ) );1 Y( d* q2 [7 B
  141.         }" A: H" f6 v1 ?; Z& `
  142.         UF_CALL ( UF_SO_create_arc_center_2_pnts * Y/ P! L3 C) ?) e- D: t
  143.                  ( 7 L2 a, @; t, q9 w, E. I) _
  144.                       points [ 0 ], 4 o+ q( x9 J" X# j5 U
  145.                       UF_SO_update_after_modeling,5 Z% h# o2 `2 }% M1 g; q  x; L
  146.                       points, # H+ Q! J- [: g# T0 Y0 ?; O5 t& l1 m
  147.                       &arc
    $ \  N, u% @' `2 N  ~; a* a
  148.                   ) );& e8 }% ?/ P& P( L. M
  149.     }( y; A, w2 e2 r" x/ D: _. {% Y
  150.         
    - I0 T# L* A& q& p& h
  151.     /* . m4 [' F8 ~6 R3 E  k
  152.        Smart objects are created as invisible objects by : ]/ ?- F9 d" P$ j8 U2 B9 W
  153.        default.  UF_SO_set_visibility_option ( ) can be 3 f8 Z6 [  H- B0 K' C  c0 c: Z
  154.        used to make them visible in the graphics window.
    - t. @9 a+ E  r% o! M
  155.     */" w( {  V: q6 d2 }6 f
  156.     UF_CALL ( UF_SO_set_visibility_option ( line, + r' L& L2 w* {
  157.                                             UF_SO_visible ) );
    4 V) U  N* ]; v* D8 C
  158.     UF_CALL ( UF_SO_set_visibility_option ( arc,  
    7 F1 A. ~& R6 ~7 c
  159.                                             UF_SO_visible ) );: k3 g1 K, X4 ]8 \
  160.     /*  9 q1 _- `/ v6 t( ~& w, k$ Y
  161.         Get line/arc/edge evaluators.
    / I7 Z  m4 C2 `0 d" L) T  ?6 o
  162.     */# B* @6 ~- X; j5 p- E& ]
  163.     UF_CALL ( UF_EVAL_initialize ( line, &line_evaluator ) );
    ( y; `- `0 O- @2 I. [' Y; ?6 n
  164.     UF_CALL ( UF_EVAL_initialize ( arc,  &arc_evaluator ) );
    1 ~9 ?# X% R4 ^, I' ~, h& b
  165.     UF_CALL ( UF_EVAL_initialize ( edge, &edge_evaluator ) );
    ) ?( a2 ^6 b, c) m
  166.     show_edge_points(line_evaluator, 10);
    0 k" Z5 |% r# ?( k/ A' s4 o
  167.     show_edge_points(arc_evaluator, 10);
    8 i4 G1 i6 g/ `
  168.     show_edge_points(edge_evaluator, 10);* _; M# \' g, P& I# `6 @
  169.     /*  
    , M  ?& |0 W6 w+ J% T
  170.         Get line/arc/edge data.% A( R$ g& D' H5 l$ P1 y
  171.     */$ v5 }0 p# a" P5 p. i
  172.     {2 v- {* D+ V; ]; {" C
  173.         UF_EVAL_line_t line_data;1 H* q  K2 _. ^5 x5 i) b  t0 d
  174.         UF_EVAL_arc_t  arc_data;
    ( l( ?2 G, ~' b, h, W8 a9 E
  175.         UF_EVAL_line_t edge_data;1 z! |  u5 ~/ s
  176.         UF_CALL ( UF_EVAL_ask_line ( line_evaluator,
    2 T' F/ ]1 q4 B9 B2 e& T
  177.                                      &line_data ) );
    - k/ ]' v  P% F; f5 l# K
  178.         UF_CALL ( UF_EVAL_ask_arc  ( arc_evaluator,  / ]$ L0 B& f% x
  179.                                      &arc_data ) );
    6 g/ X8 d# z4 n
  180.         UF_CALL ( UF_EVAL_ask_line ( edge_evaluator,  
    % ~7 E  U  T: s) l3 I6 q
  181.                                      &edge_data ) );
    " I$ P8 n4 b# p/ a0 Y
  182.     }4 e, E9 r7 n& q' s$ g0 Z
  183.     /*  
    0 r, g3 u3 g$ A
  184.         Check line/arc/edge periodicity.
    + S+ r' F! s& v2 K) @- D
  185.     */
    2 h# B$ b# L8 g1 i6 u4 G* L
  186.     {
    : R8 h, J: U8 Y; A* X- ?; n4 \
  187.         logical is_periodic;
    ! m# V! I: ^* R
  188.         1 e# }$ v6 V& \1 T& P
  189.         UF_CALL ( UF_EVAL_is_periodic ( line_evaluator, : \. O: u" U9 @3 w8 T
  190.                                         &is_periodic ) );5 z7 t$ V  W' J/ q+ h9 Z
  191.         UF_CALL ( UF_EVAL_is_periodic ( arc_evaluator,  ( j  i6 ~! \$ d( K5 A
  192.                                         &is_periodic ) );
    8 A7 C! K/ ]1 _, P- d8 u
  193.         UF_CALL ( UF_EVAL_is_periodic ( edge_evaluator,  " K8 g) v  \. }  g/ e: E, R& j
  194.                                         &is_periodic ) );
    ' F: @1 s7 O5 I* J* [4 a" N
  195.     }
    : [1 B* `. R: V: ~6 s2 M
  196. /*  * H3 j6 y2 J/ l( W9 Q
  197.         Evaluate line/arc/edge.
    # K" i  Z1 E2 G* @" Z+ p7 T/ ^9 V% t
  198. */
    7 g! b. l; r) z1 Z& |
  199.     {+ w6 _3 m2 \' @, S( M6 k
  200.         double limits [ 2 ];          b. T5 h. t+ m. u2 V
  201.         double mid_t;
    : V- O9 j+ y$ |/ s
  202.         double point [ 3 ];4 M5 k2 ]/ I' E* h: P. f
  203.         double derivative [ 3 ];3 L3 P; I2 @. v# I0 M9 j
  204.         double tangent [ 3 ];# ]1 O0 q' X6 m5 T+ v' y
  205.         double normal [ 3 ];6 z1 Z, r  ]& A5 v( `
  206.         double binormal [ 3 ];5 M6 n. w* z. R( h
  207.         UF_CALL ( UF_EVAL_ask_limits ( line_evaluator, limits ) );* t8 M7 R' L2 t4 ?
  208.         mid_t = ( limits [ 1 ] + limits [ 0 ] ) / 2.0;
    * L% }9 _8 d+ P8 I) i) U
  209.         UF_CALL ( UF_EVAL_evaluate ( line_evaluator, ; V9 t7 O# l% m9 s) E0 z0 ~
  210.                                      1, - |, j0 Q* G) x, w- w% ~
  211.                                      mid_t, 7 l0 A" I# x2 ^& Y$ @1 _# Y
  212.                                      point,
    ( I* F, L8 ~0 k
  213.                                      derivative ) );
    - k7 x6 b2 h* q% b6 r3 [$ t/ U
  214.                   
      g- `" f8 J+ z* @
  215.         UF_CALL ( UF_EVAL_evaluate_unit_vectors ( line_evaluator,
    $ u9 B' A' F' G8 m
  216.                                                   mid_t, & W) j" W% L. g! @( c. v9 e4 N: `& S; G
  217.                                                   point, ! Q8 n( J; h  E% u
  218.                                                   tangent,
    - c& a0 [6 l6 ^# O4 v, O1 k7 x
  219.                                                   normal,
    " r4 W' l  j6 g2 l
  220.                                                   binormal ) );$ {6 x9 ]% D' ~! G# t, R$ e
  221.         UF_CALL ( UF_EVAL_ask_limits ( arc_evaluator, limits ) );+ t* G9 t) F* ]7 V
  222.         mid_t = ( limits [ 1 ] + limits [ 0 ] ) / 2.0;
    # f$ \, o$ C9 C
  223.         
    2 S( `4 }1 Y" R* r% l; I7 o. C
  224.         UF_CALL ( UF_EVAL_evaluate ( arc_evaluator,
    + P+ I) P  Q) h" m) v$ x/ c
  225.                                      1, 7 R8 {: ^7 J" p/ U! [
  226.                                      mid_t, . ^% s* N. [9 @' c7 o2 l
  227.                                      point,
    - X! i  c4 G3 a  k  K* F8 a" B
  228.                                      derivative ) );( S% K1 }5 a  M6 \* x8 |
  229.         1 H! e0 @$ K# l* ~: J2 V+ ]
  230.         UF_CALL ( UF_EVAL_evaluate_unit_vectors ( arc_evaluator,
    & `; ^, |8 f7 _8 v: q
  231.                                                   mid_t, - O; |9 |( n, z' v: r. b2 |
  232.                                                   point, - O3 m. n+ Y! A& N8 d6 ~
  233.                                                   tangent, - _. x9 H% p; f- |8 e* [5 _  ~
  234.                                                   normal,
    / u: ^  x; m; \$ |. }
  235.                                                   binormal ) );
    - v" D+ K8 I/ H7 K9 |: u! Z
  236.         UF_CALL ( UF_EVAL_ask_limits ( edge_evaluator, limits ) );( c! q4 N7 E" _; B: }' J: V
  237.         mid_t = ( limits [ 1 ] + limits [ 0 ] ) / 2.0;2 s! ^9 I' u* [5 G3 p" F; G8 P' Y3 Q
  238.         UF_CALL ( UF_EVAL_evaluate ( edge_evaluator,
    6 k: m/ B8 N- j; ?
  239.                                      1, 4 b' X+ ]  |5 Y$ X) d
  240.                                      mid_t, , L$ ^$ Q0 D( ^) [! o8 f9 c
  241.                                      point, # {! G$ y  Q5 [- d" M' e
  242.                                      derivative ) );
    7 F1 j1 P% I  @. t
  243.         UF_CALL ( UF_EVAL_evaluate_unit_vectors ( edge_evaluator, ) ?4 d% E! W6 V  K
  244.                                                   mid_t,
    - ]" i& p/ [' |. `/ A  g2 s
  245.                                                   point, 0 k: h% t3 S2 x8 D
  246.                                                   tangent, 0 Y! a" S" G4 W1 L4 a
  247.                                                   normal,
    : y; E+ w3 @6 Z
  248.                                                   binormal ) );" i/ U! c, ?( q- P! W8 F+ Y
  249.     }
    - b8 b& ]+ z0 k" O, |
  250.     /*  ; i& ^6 W6 c# C6 [- x* h
  251.         Check line/arc/edge equality of evaluators.
    " [. }5 e5 f, G0 M, ^- ?; T
  252.     */
    4 S6 l* K7 C/ F8 ]
  253.     {. Q! k0 H, S: W# O9 G
  254.         logical is_equal;
    6 p- F. P& |6 k6 ~3 }
  255.         UF_EVAL_p_t line_evaluator_copy;. C% m$ J+ j; v1 ?6 ]
  256.         UF_CALL ( UF_EVAL_copy ( line_evaluator,9 `; F' j2 o7 C  C& o6 R
  257.                                  &line_evaluator_copy ) );, p& q2 B6 _5 v4 H- k
  258.         UF_CALL ( UF_EVAL_is_equal ( line_evaluator,1 q/ W5 ^5 H7 m. I4 |7 S' h
  259.                                      line_evaluator_copy,
    * v# m! {& }3 G$ p2 t. {3 h6 c1 ~
  260.                                      &is_equal ) );
    8 c0 B. a1 x  H7 x" [6 v# \
  261.         UF_CALL ( UF_EVAL_free ( line_evaluator_copy ) );( `+ c( P" q, S9 z# C3 Z5 }
  262.         UF_CALL ( UF_EVAL_is_equal ( line_evaluator, ! V. V5 ^9 _& i4 b9 R  H" N, u
  263.                                      arc_evaluator,
      r6 r/ C+ {" d+ {) Q& z0 p$ i
  264.                                      &is_equal ) );; m# _  |! g- b$ U: p- t
  265.         UF_CALL ( UF_EVAL_is_equal ( line_evaluator,
    # J& X3 Z6 z  u8 B; U: P- f7 v
  266.                                      edge_evaluator,
    6 ]& K. M, u+ W$ U8 o6 O" L, v
  267.                                      &is_equal ) );
    % v% m+ Q& ]$ j' `* m! i% I6 N
  268.     }
    & q& A% h1 k' v* y: n
  269.     /*  
      E7 K6 Q, x5 ]
  270.         Check line/arc/edge type.
    / a2 i0 V8 f2 y8 ?
  271.     */$ S( N' q( O5 Q$ m
  272.     {- k  Z0 h& B) n5 W2 M
  273.         logical is_line;  Y; C3 q3 y5 I# D5 D/ H* C
  274.         logical is_arc;
    % N! Y4 {* y/ a% w: h
  275.         UF_CALL ( UF_EVAL_is_line ( line_evaluator, &is_line ) );4 I# k2 E; P0 {7 H9 T
  276.         UF_CALL ( UF_EVAL_is_arc  ( line_evaluator, &is_arc ) );, f# x- e9 g" w; H2 {& o+ h
  277.         UF_CALL ( UF_EVAL_is_arc  ( arc_evaluator,  &is_arc ) );& u9 P; x6 d! _: X
  278.         UF_CALL ( UF_EVAL_is_line ( arc_evaluator,  &is_line ) );
    % G4 C) x, S+ l; L
  279.         UF_CALL ( UF_EVAL_is_arc  ( edge_evaluator, &is_arc ) );
    1 f1 w  Y8 c% E4 {$ g
  280.         UF_CALL ( UF_EVAL_is_line ( edge_evaluator, &is_line ) );
    ; ?$ v' s. W6 {  S$ n0 u" \0 @
  281.     }( y2 C. D5 M3 W
  282.     UF_CALL ( UF_EVAL_free ( line_evaluator ) );
    ) }. m. I- G  |/ b2 P) N
  283.     UF_CALL ( UF_EVAL_free ( arc_evaluator ) );6 H; L# Q6 G" H) o/ L+ w$ ~; X1 d7 ^7 \
  284.     UF_CALL ( UF_EVAL_free ( edge_evaluator ) );
    $ c) m; s* C5 |1 }8 H8 d
  285.     UF_CALL ( UF_terminate ( ) );
    - S3 A7 Q1 h  R! Z3 j
  286. }8 Q- ]' v' ], T: P7 A0 P

  287. * V0 H3 N, ^: U* V* _8 l1 w- f! V* Y: ]
  288. /* This function will disply n_pts equally spaced along the
    8 @& B# F! \% s/ e- ?
  289.    input curve.
    4 t  X# v, |) L$ o0 V: R( Z: \* w
  290. */
    9 d, k& D5 I2 ~3 p
  291. static void show_edge_points(UF_EVAL_p_t eval, int n_pts)
    7 O" S/ d. R9 y  R
  292. {
    0 Y) `" x/ z4 }$ o5 u3 N% u* U
  293.     int ii;
    8 [0 N: t# C0 i/ G" }* q
  294.     double limits[2], p, point[3], end_parameter, start_parameter;+ W& \% {4 I( M4 c2 U8 O. C9 n
  295.     UF_OBJ_disp_props_t8 o: a9 `4 W( Q" L1 o
  296.         attrib = { 1, UF_OBJ_WHITE, UF_OBJ_NOT_BLANKED, UF_OBJ_WIDTH_NORMAL,
    0 F* }* ]. @+ x' H% K
  297.             UF_OBJ_FONT_SOLID, FALSE};+ D2 C7 I- V( m6 [! F0 U2 K" B- h

  298. 0 v+ S+ ]# H0 @2 [) |; _
  299.     UF_CALL(UF_EVAL_ask_limits(eval, limits));
    ( ~; I8 b3 O& n
  300.     printf ( "limit0 = %f\n", limits[0] );% o5 R  A' `$ M: b: r$ v2 h6 ]
  301.     printf ( "limit1 = %f\n", limits[1] );
    2 a! a0 `/ b8 Z: b
  302.     start_parameter = limits[0];
    + z5 `; R9 y3 v7 D3 v. I. p
  303.     end_parameter = limits[1];
    1 ]3 ]( ^$ c  J, M) q
  304. ' u1 s- ]2 }# O7 K" Z
  305.     for (ii = 0; ii < n_pts; ii++)1 H. u* q6 n* ?! q) i2 p) y
  306.     {9 l; U# ]# J/ N4 _% E
  307.         p =start_parameter + ii*((end_parameter - start_parameter)/(n_pts - 1));
    / Y5 B* ?+ T% ~0 i% i
  308.         printf ( "evaluate = %f\n", p );; r, a0 `7 f- Q$ Y  i
  309.         UF_CALL(UF_EVAL_evaluate(eval, 0, p, point, NULL));# d# j' t/ t) r/ s; [
  310.         UF_CALL(UF_DISP_display_temporary_point(NULL_TAG,* Z- x5 N* m2 B# @. y
  311.             UF_DISP_USE_ACTIVE_PLUS, point, &attrib, UF_DISP_POINT));
    2 v2 D4 K7 q0 i
  312.     }
    ! _+ h; |2 I3 i$ \
  313. 0 I3 g/ D, L8 L9 ^* @
  314. }! V, H3 o/ j2 r$ ~
复制代码
8 o  ^; m8 B: |" B

7 Z1 P! B$ V" O: S# ~3 ^+ L0 S9 J) X$ x( A5 ]# l
上海点团信息科技有限公司,承接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二次开发专题模块培训报名开始啦

    我知道了