|
帮助文档里的实例; Z! W, y# p1 b* ^8 V
void ufusr(char *param, int *retcod, int param_len)$ e6 u+ c! `. ?. [( U) j# V
{) X2 E) ~) u% C
char error_message[133] = "";
. Y0 g1 i% m9 [) d& a int ifail = 0;9 w: F! }6 B0 ]1 _; Z- Y: t
int type, subtype;" f. n# ~2 t$ C* {, L
tag_t label_tag = NULL_TAG;) o7 K+ |8 d7 M+ q' t6 z6 b' \
double label_origin[ 3 ];; q+ x: F& J" R! `* c7 H
UF_DRF_label_info_t *label_info;1 Y; ^8 X4 S* y" e$ r
/* Initialize User Function. */* {3 c# z/ \& J/ f* x
ifail = UF_initialize();" E% P) _" G* f( ^9 G
/* Find the tag to a dimension entity. */
D- _5 o( m6 S/ I! U9 [% G ifail = UF_OBJ_cycle_objs_in_part( UF_ASSEM_ask_work_part(),8 o+ n. e1 `0 v# g( `% S
UF_drafting_entity_type,: R/ Q M$ x# L1 e; q; E
&label_tag );* o. |$ j% C- P
/* Find the tag of an ordinate dimension. *// ]2 Q7 ]6 W1 d9 i; v# ]9 F
while( !ifail && label_tag )
* N+ {# o' i( X: @4 r) M% K3 z* y {" d" n7 R3 b; C9 }$ `2 M2 W
ifail = UF_OBJ_ask_type_and_subtype( label_tag, &type,
+ a0 J9 V* r7 I5 Q1 c7 t, t &subtype );
" h9 J v$ y3 I6 m- Y. ]" C /* Test type for the label. */3 D& @& `" f( S9 @
if( !ifail && subtype == UF_draft_label_subtype )6 Y9 ]& c, P8 L. q u
{) b3 z. |+ {+ b
/* Retrieve the label information. */
+ Q4 F; v7 H K# N J/ I- \, C ifail = UF_DRF_ask_label_info ( label_tag,
! h6 \5 i0 X! Q4 N, J &label_origin[ 0 ],% t, J( e$ o$ {& {
&label_info );9 h# S P6 F6 v0 w% Q
/* Free label information memory. */
9 W' A5 n6 o! b7 C4 s; f( I if( !ifail )3 J" H3 j5 v3 |6 x8 N8 v! L
UF_DRF_free_label( &label_info );! p: A) r2 C9 g/ E' j& j
}
* `) X$ l3 B/ _, G) c /* Find the tag of next drafting entity. */
, U4 Q2 L' ]2 r* H1 u# w if ( !ifail )/ V1 M; J c+ X
ifail = UF_OBJ_cycle_objs_in_part(
. S) u! h$ d% D& i& d UF_ASSEM_ask_work_part(),
6 ~9 T* }: M4 h6 B UF_drafting_entity_type,9 R' [+ {/ ]" Z7 m) M
&label_tag );
, H: C- G% j3 A }
# Y3 T$ E/ O3 R& d! L2 M! @; t, w printf( "UF_DRF_ask_label_info sample " );- T2 I, U# V m, E
if( ifail )& A# S- n+ O2 H! t) d8 Q) ?4 P
{1 E' \" y3 m/ k3 ?* {; V
ifail = UF_get_fail_message( ifail, error_message );7 @1 }0 `3 h. B; e, L
printf( "fails.\nError is: %s\n", error_message );
" V& u+ a' z- Q4 \9 R( n) @0 d& @ }/ f& Y& i6 P3 P9 _+ A; u2 E
else; \& n' s- M1 p) Z9 \$ G
printf( "is successful.\n" );
- O; R: B+ B0 }# w1 M' s UF_terminate();* C4 o% B2 a) R7 @! m
}3 k. f. R6 P7 \4 l# E# G
% T- ^$ J8 j3 j# E, L
|
|