|
帮助文档里的实例
, g# }1 `7 W! J6 pvoid ufusr(char *param, int *retcod, int param_len)
7 a& a8 B& G/ X) `3 [$ f& t8 g{
; d- t( J! _+ f; ` b3 T, B/ V/ I char error_message[133] = "";
: ^6 a/ x7 V8 Q. F* u int ifail = 0;
2 e" W; L* p4 S. ?# |. b7 h int type, subtype;% t: Y' i! g6 g. f
tag_t label_tag = NULL_TAG;2 G; F- H# o/ J L
double label_origin[ 3 ];
5 T# }; e2 }( R& R9 L UF_DRF_label_info_t *label_info;6 ^% Q d4 B! G) F0 F; u
/* Initialize User Function. */
% y/ @+ x6 M1 E6 r; Q" T% j ifail = UF_initialize();# v: b( v, w5 W! K( X; C
/* Find the tag to a dimension entity. */
8 W; Q. p6 b5 ?% g) w ifail = UF_OBJ_cycle_objs_in_part( UF_ASSEM_ask_work_part(),9 q& s/ ~& Z0 O4 x
UF_drafting_entity_type,3 {& y; g1 i1 O$ b" m6 [0 H
&label_tag );
7 Z; v% r/ K5 O7 [4 n /* Find the tag of an ordinate dimension. */+ v7 T+ l" F( \' D& l
while( !ifail && label_tag )( q# g+ J, q" v/ Y& ?
{4 U' U; s4 n) F, Q
ifail = UF_OBJ_ask_type_and_subtype( label_tag, &type,
: ~2 m+ U, `5 S &subtype );
! r* v4 `/ y9 g& g; b /* Test type for the label. */
0 V& w6 _0 S4 H* ^: W0 W) V if( !ifail && subtype == UF_draft_label_subtype ); i7 E! g) m9 B3 h0 H/ Z( A5 Q
{
2 C9 G- C$ \+ n! h8 R /* Retrieve the label information. */- ^; @+ y" R4 v" s& o6 `
ifail = UF_DRF_ask_label_info ( label_tag,
7 Q* W' X8 Y6 E' ~( Z/ j- E' n2 x/ l &label_origin[ 0 ],2 O- o7 b. }8 ~# c- ~/ q) m
&label_info );
. I! ?9 B* G1 V6 |! d /* Free label information memory. */, |# W% P, \) l( ]: `5 G& g; g
if( !ifail )
T/ ^2 x9 B- m8 [ UF_DRF_free_label( &label_info );$ [3 K( f! w2 W5 F$ E0 ?: S- c
}
, U8 G7 Y6 X ?" ` /* Find the tag of next drafting entity. */
7 E! E! w9 ~+ A+ n3 Z if ( !ifail )
$ H$ }: Y- x) k! t, l ifail = UF_OBJ_cycle_objs_in_part(
; {: Q1 x/ p4 r0 B$ U UF_ASSEM_ask_work_part(),% r1 s. \6 ?8 C' ~
UF_drafting_entity_type,' l! {1 b& H% X7 t6 |
&label_tag );$ n; q& `3 {# z+ N5 `
}* f( R Y( t0 v, p1 N- y
printf( "UF_DRF_ask_label_info sample " );
7 J: C5 ~9 w0 m5 _2 D if( ifail ). k; X* w) S" \( B# x3 H8 v
{' w" v, `, T0 p( Z. |( v4 Z# O
ifail = UF_get_fail_message( ifail, error_message );" B% t z- V6 y. B' ], Y3 t
printf( "fails.\nError is: %s\n", error_message );
8 W: s- o% f p2 ]( `0 R }
, s* Q! H# o2 {/ q R0 L. N else- a4 @6 g, ]2 l
printf( "is successful.\n" );
, k0 Z1 x* X: K4 j" K5 ]: o2 [ UF_terminate();- B, N! A9 s2 P. H9 `$ V
}
: E, c3 V3 V; l! N3 n
8 \% s- X3 y% t3 X2 k+ V |
|