/******************************************************************************
             Copyright (c) 1999 Unigraphics Solutions, Inc.
                       Unpublished - All Rights Reserved

*******************************************************************************/
/* The code in the following example sets the value of each cylindrical
dimension to be the distance between its two associated objects. */
#include <stdio.h>
#include <uf.h>
#include <uf_attr.h>
#include <uf_obj.h>
#include <uf_object_types.h>
#include <uf_part.h>
#include <uf_drf.h>
void ufusr(char *param, int *retcod, int param_len)
{
    tag_t       obj_id = NULL_TAG;
    int         ifail;
    int         type, subtype;
    int         double_flag = 0;
    int         status;
    char       error_message[133] = "";
    /* Initialize User Function. */
    ifail = UF_initialize();
    /* Cycle all cylindrical dimension */
    ifail = UF_OBJ_cycle_objs_in_part(UF_PART_ask_display_part(),
                                      UF_dimension_type, &obj_id);
    while (!ifail && obj_id != NULL_TAG)
    {
        ifail = UF_OBJ_ask_type_and_subtype(obj_id,  &type,
                                              &subtype);

        if (!ifail && subtype == UF_dim_cylindrical_subtype)
        {
            /* turn off the double flag */
            ifail = UF_DRF_set_cyl_dim(obj_id, double_flag,
                                                       &status);

            printf("cylindrical dim processed tag=%d,status=%d\n",
                           obj_id, status);
        }
        if (!ifail)
            ifail = UF_OBJ_cycle_objs_in_part(
                                   UF_PART_ask_display_part(),

UF_dimension_type, &obj_id);
    }
    printf("UF_DRF_sel_cyl_dim sample ");
    if (ifail)
    {
        ifail = UF_get_fail_message(ifail, error_message);
        printf("fails.\nError is: %s\n", error_message);
    }
    else
        printf("is successful.\n");
    UF_terminate();
}

