/* * This example uses a part with a named object, "CURVE". A smart * point is defined at the starting point of the curve, and the smart point * is used to define the anchor point. */ #include #include #include #include #include #include #include #include #include void ufusr(char *param, int *retcod, int param_len) { int ifail = 0; tag_t point_tag = NULL_TAG; tag_t curve_tag = NULL_TAG; tag_t scalar_tag = NULL_TAG; tag_t view_tag = NULL_TAG; tag_t part_tag = NULL_TAG; char * view_name = "TOP@1"; char * object_name = "CURVE"; char error_message[133]; UF_SO_update_option_t update_option = UF_SO_update_within_modeling; ifail = UF_initialize(); if( !ifail ) part_tag = UF_PART_ask_display_part(); if( !ifail && part_tag != NULL_TAG ) ifail = uc6476(1); /* set dwg state to modeling view */ if( !ifail && part_tag != NULL_TAG ) ifail = UF_VIEW_ask_tag_of_view_name(view_name, &view_tag ); if( !ifail && part_tag != NULL_TAG && view_tag != NULL_TAG ) /* retrieve tag of named object to define the */ /* view anchor point */ ifail = UF_OBJ_cycle_by_name( object_name, &curve_tag ); if(!ifail && part_tag != NULL_TAG && view_tag != NULL_TAG && curve_tag != NULL_TAG) ifail = UF_SO_create_scalar_double ( part_tag, update_option, 0.0, &scalar_tag ); if( !ifail && scalar_tag != NULL_TAG ) ifail = UF_SO_create_point_on_curve( part_tag, update_option, curve_tag, scalar_tag, &point_tag ); if( !ifail && point_tag != NULL_TAG ) ifail = uc6476(2); /* drawing display */ if( !ifail && point_tag != NULL_TAG ) ifail = UF_DRAW_set_view_anchor( view_tag, point_tag ); printf( "UF_DRAW_set_view_anchor " ); if( ifail ) { ifail = UF_get_fail_message( ifail, error_message ); printf( "fails.\nError is: %s\n", error_message ); } else if ( part_tag == NULL_TAG ) printf( "fails.\nError is: no active part.\n" ); else if ( point_tag == NULL_TAG ) printf( "fails.\nError is: no reference point.\n" ); else if ( view_tag == NULL_TAG ) printf( "fails.\nError is: view not found.\n" ); else printf( "is successful.\n" ); ifail = UF_terminate(); }