|
帮助文档里的实例
2 B+ u. s" Y' Y& g1 H& E) qvoid ufusr(char *param, int *retcod, int param_len)* L+ n% O: t) \4 j/ V/ }! v: y
{
{4 X6 `/ N% j* i% C) u9 b char error_message[133] = "";
$ k, ?, m. n, ]' y int ifail = 0;
# @$ c, I i @6 f! l; m: { int type, subtype;9 E0 {" q/ D9 O; }' Q* E9 }
tag_t label_tag = NULL_TAG;9 H8 m5 m$ z7 `, l5 Y2 @2 D
double label_origin[ 3 ];0 m8 {) C0 h+ D: h3 q2 U+ ~( V
UF_DRF_label_info_t *label_info;
$ n' o5 g6 ~% T$ P* C- ` @7 J0 W /* Initialize User Function. */) i: Z8 k, B8 M* C1 K
ifail = UF_initialize();
* h+ A; h) _( }, u! G /* Find the tag to a dimension entity. */# @' R8 x5 O) M# O1 o
ifail = UF_OBJ_cycle_objs_in_part( UF_ASSEM_ask_work_part(),/ f, q/ D: `8 c% S0 y z
UF_drafting_entity_type,' W/ n1 I% w; u5 F) c+ H1 s4 f( h$ V
&label_tag );& T7 t; N2 N+ F/ i# Y
/* Find the tag of an ordinate dimension. */# Q9 M {4 ^; B- e; P
while( !ifail && label_tag )
5 V4 n( k/ Y# K {6 o% `: n: `: l) C: e
ifail = UF_OBJ_ask_type_and_subtype( label_tag, &type,) d% Q6 h ]: {" [# ?
&subtype );
, e2 O# i: V1 o* v# w2 e2 s /* Test type for the label. */, j" b9 r* k9 K% i5 ^
if( !ifail && subtype == UF_draft_label_subtype )
3 v6 g% Q4 c4 {4 n {2 o2 W( D% Y, f$ o& I- w C9 I
/* Retrieve the label information. */
4 x/ v( ?! [4 K" P, r. L4 ]7 h ifail = UF_DRF_ask_label_info ( label_tag,
4 p; @; }# J# o2 H &label_origin[ 0 ],
7 i+ I4 E0 h/ T$ w &label_info );
" r, H4 T( f- K- d F, ~ /* Free label information memory. */
/ |4 l6 C7 v# c+ V$ R5 C ~: w if( !ifail ), d$ l0 V! U# M. p
UF_DRF_free_label( &label_info );
$ E/ K* n, B% V! _( O; |( m }
9 U6 Y; @4 }) Z) d" A9 W" U /* Find the tag of next drafting entity. */
# k7 q$ d. m& K: N* p4 Y$ [8 y if ( !ifail )
2 n! U9 {3 Q% k# R" F R! k ifail = UF_OBJ_cycle_objs_in_part(
0 x) d$ P7 H3 O, O* ] UF_ASSEM_ask_work_part(),. k- g( `0 Q0 m- M* f
UF_drafting_entity_type,
# B. [4 R" w8 m2 ^ &label_tag );- \; w& C2 O) E1 n( q1 a" j
} H1 v2 g1 q* q( \( p# E. I0 d* r
printf( "UF_DRF_ask_label_info sample " );3 A. o6 H2 n, {6 d
if( ifail ). L; D9 m' T& y, c
{5 z/ F: z* n: B! H+ S; }5 T m! _; W
ifail = UF_get_fail_message( ifail, error_message );
+ ~3 [: `% M F; F, Y/ Z g printf( "fails.\nError is: %s\n", error_message );" ^: {1 j' }& B. n# l
}" A+ Y$ O4 k6 T- z, b1 t9 X
else
/ I; u& D+ h( E# R5 ?3 t3 y printf( "is successful.\n" );0 T T3 r4 |5 ?# | Y/ i
UF_terminate();
# p1 I' \0 m, W}; A! j$ \4 M. _) \0 D8 z; v
5 M7 O% n. ^7 [- M3 \7 n |
|