/****************************************************************************** Copyright (c) 1999 Unigraphics Solutions, Inc. Unpublished - All Rights Reserved *******************************************************************************/ /* Test program for the function UF_DRF_ask_assoc_exp */ /* This program loops through all of the parts in the current session and prints the tags of dimensions and their associated expressions, if it finds any dimensions with associated expressions. */ #include #include #include #include #include #include #include #include void ufusr(char *param, int *retcod, int param_len) { int ifail = UF_DRF_NO_ERRORS; char error_message[MAX_LINE_SIZE+1]; char part_fspec[MAX_FSPEC_SIZE+1]; int dim_rm_type = UF_dimension_type; tag_t dim_tag, exp_tag; tag_t part; int num_parts, current; char *exp_string; ifail = UF_initialize(); if( !ifail ) { num_parts = UF_PART_ask_num_parts(); for ( current = 0 ; current < num_parts; current++) { /* Get the next part */ part = UF_PART_ask_nth_part( current ); UF_PART_ask_part_name( part, part_fspec ); printf( "Searching part %s for dimensions associated to expressions\n", part_fspec ); dim_tag = NULL_TAG; /* Get a dimension */ ifail = UF_OBJ_cycle_objs_in_part( part , dim_rm_type, &dim_tag ); while ( !ifail && dim_tag ) { /* See if dimension has an expression */ ifail = UF_DRF_ask_assoc_exp( dim_tag, &exp_tag ); if ( !ifail && exp_tag ) { /* Dimension has expression, get the string */ ifail = UF_MODL_ask_exp_tag_string( exp_tag, &exp_string ); if ( !ifail ) { printf( "Dimension %u is associated to expression %u, string = %s\n",d im_tag, exp_tag, exp_string ); UF_free( exp_string ); } } if ( !ifail ) { /* Get another dimension */ ifail = UF_OBJ_cycle_objs_in_part( part, dim_rm_type, &dim_tag ); } } /* End while */ /* If there was an error, don't continue looping through parts */ if ( ifail ) break; } /* End loop of parts */ } if( ifail ) { ifail = UF_get_fail_message( ifail, error_message ); printf( "Printing all expressions fails.\nError is: %s\n", error_message ); } ifail = UF_terminate(); }