/*
The code in the following example gets the scale of a drawing
member view.
*/

#include <stdio.h>
#include <uf.h>
#include <uf_defs.h>
#include <uf_draw.h>
#include <uf_draw_types.h>
#include <uf_obj.h>
#include <uf_view.h>
void ufusr(char *param, int *retcod, int param_len)
{
    char                drawing_name [MAX_ENTITY_NAME_SIZE] = "";
    char                view_name [MAX_ENTITY_NAME_SIZE] = "";
    char                error_message[MAX_LINE_SIZE + 1] = "";
    tag_t               view_tag = NULL_TAG;
    tag_t               drawing_tag = NULL_TAG;
    tag_t               exp_tag = NULL_TAG;
    double              scale;
    int                 ifail = 0;
    ifail = UF_initialize();
    if (!ifail)
    {
        /* Get the tag of drawing. */
ifail = UF_DRAW_ask_current_drawing(&drawing_tag);
    }
    if (!ifail)
    {
        /* Get the name of first drawing. */
        ifail = UF_OBJ_ask_name(drawing_tag, drawing_name);
    }
    if (!ifail)
    {
        /* Get the name of the drawing's first view. */
        ifail = uc6499 (drawing_name, view_name);
    }
    if (!ifail)
    {
        /* Get the view's tag. */
        ifail = UF_VIEW_ask_tag_of_view_name (view_name,
&view_tag);
    }
    if (!ifail)
    {
        /* Get the parametric view scale. */
        ifail = UF_DRAW_ask_view_scale (view_tag, &exp_tag,
&scale);
    }
    printf ("UF_DRAW_ask_view_scale sample ");
    if (ifail)
    {
        ifail = UF_get_fail_message( ifail, error_message );
        printf( "fails.\nError is: %s\n", error_message );
    }
    else
    {
        printf( "is successful.\n" );
        printf( "The scale value is %g \n", scale );
    }
    UF_terminate();
}