|
帮助文档里的实例, ?- t1 P3 v7 H( H" [
void ufusr(char *param, int *retcod, int param_len)& K" |0 ]7 L' Y F$ n
{
" n6 ?: ^- R- @+ J }' X' [ char error_message[133] = "";5 [5 u" u3 _9 m7 b2 Z$ g
int ifail = 0;
5 D6 e& i8 @' L) y1 `" v v int type, subtype;
) C( V2 M3 N. n tag_t label_tag = NULL_TAG;
- H+ z2 |( }) d6 ^7 S double label_origin[ 3 ];$ C" h; P1 a/ U M
UF_DRF_label_info_t *label_info; s/ k2 f$ c+ @/ J
/* Initialize User Function. */ a- V* e6 V+ d& [6 _
ifail = UF_initialize();
g- ~+ w) N c; x" ]1 k /* Find the tag to a dimension entity. *// K! d1 [, F& s& ]# n. p o
ifail = UF_OBJ_cycle_objs_in_part( UF_ASSEM_ask_work_part(),
6 y4 _$ P0 O" T( X' Q% x% C4 ~ UF_drafting_entity_type,
) t* F3 \# x, e5 ~5 u &label_tag );
# M5 P' e: Z7 ^* t% k7 z. o M /* Find the tag of an ordinate dimension. */# R! j6 y" u% N2 g6 `! \& o
while( !ifail && label_tag )) D! Z! Z; [, W r
{
c0 o% a! F/ x' b3 O ifail = UF_OBJ_ask_type_and_subtype( label_tag, &type,1 H' {' X9 h. ]* }3 w
&subtype );1 C% L# i/ S( o2 U/ N- ? V1 P
/* Test type for the label. */" R2 }) o, c2 a- T! ]
if( !ifail && subtype == UF_draft_label_subtype )2 T& O' D' t/ [3 Y
{
5 Z/ G m5 |( E, J4 {' |* O/ w /* Retrieve the label information. */% y) w* I. P+ S
ifail = UF_DRF_ask_label_info ( label_tag,
' M3 j' @ E* i2 k9 n! F; ]$ E; l &label_origin[ 0 ],
$ g, |/ A' A1 Q z* I. e8 m7 L4 d &label_info );" B5 Y7 t" [; N V; x Z
/* Free label information memory. */6 \0 W" P- \- S6 B% M
if( !ifail )
6 p. ^3 t7 y- L4 j3 f UF_DRF_free_label( &label_info );
3 a; h+ i8 J. O6 c C }& G/ _' X% r6 Z+ Y; Z' y7 I
/* Find the tag of next drafting entity. */
- o; G$ `+ k8 j' A if ( !ifail )
5 n( ~ K3 a5 [: m; b# v ifail = UF_OBJ_cycle_objs_in_part(! y4 H3 _* D4 t" u8 P
UF_ASSEM_ask_work_part(),! b* \1 s$ Z# U
UF_drafting_entity_type,
6 o. A: _6 y5 f3 d# u/ e2 U1 ]1 E &label_tag );
; l8 |6 _# [& y3 F0 N }" E5 d& R, J. u) T
printf( "UF_DRF_ask_label_info sample " );$ G" f9 x+ X& L: I" r: u3 p
if( ifail )
, S3 }4 l& q4 C6 I o {. L$ k' G, ~. Z3 Z- L
ifail = UF_get_fail_message( ifail, error_message );
' a$ k7 t+ s3 ]7 g1 U' ~ printf( "fails.\nError is: %s\n", error_message );9 }# L, i% j" A1 G9 ]+ t" i5 x
}: `! s+ G2 S& G6 P Q
else
6 I+ K+ H% C2 r7 F: F1 s printf( "is successful.\n" );
: a+ j2 ^& G) S, G" K& a0 n. x UF_terminate();
9 b1 Q) I+ e! ^3 _% g+ j2 k* k}( H% l, F, x: `' m
/ q; r. h! |/ T; }5 [: h |
|