/****************************************************************************** Copyright (c) 1999 Unigraphics Solutions, Inc. Unpublished - All Rights Reserved *******************************************************************************/ /* The code in the following example sets the text above leader attribute and creates a label which will have the leader stub displayed below the bottom line of text, the other lines of text will be underlined, and the leader stub and underlines will all be extended to the maximum text length of the label. A part must be active. */ #include #include #include #include #include #include void ufusr(char *param, int *retcod, int param_len) { double origin[3] = {10.0, 0.0, 0.0}; double base_pt[3] = {5.0, 5.0; 0.0}; char text[10][132+1]; char stat_msg[133]; int status; int lines_of_text = 7 tag_t base_pt_tag, text_aid_tag; UF_DRF_object_t object; UF_DRF_text_above_leader_t text_above_leader; UF_DRF_text_above_leader_t save_text_above_leader; status = UF_initialize(); if (!status) { /* initialize the object structure */ UF_DRF_init_object_structure(&object); /* create a base point */ status = UF_CURVE_create_point(base_pt, &base_pt_tag); } if (!status) { /* save the current global preference */; status = UF_DRF_ask_text_above_leader(&save_text_above_leader); /* set the global preference to display the leader stub below the bottom line of the text, underline the other text lines, and extend the stub and underlines to the maximum text length */ status = UF_DRF_set_text_above_leader( UF_DRF_LEADER_BOTTOM_TEXT_MAX_UNDERLINE); } /* create a label */ if (!status) { strcpy(text[0], "This is a LABEL"); strcpy(text[1], "It points to the point at (5,5)"); strcpy(text[2], "The next line is blank"); strcpy(text[3], ""); strcpy(text[4], "The next line is very long"); strcpy(text[5], "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789"); strcpy(text[6], "This is the LAST line"); object.object_tag = base_pt_tag; object.object_view_tag = NULL_TAG; object.object_assoc_type = UF_DRF_end_point; object.object_assoc_modifier = UF_DRF_first_end_point; status = UF_DRF_create_label(lines_of_text, text, origin, UF_DRF_leader_attach_object, &object, base_pt, &text_aid_tag); } /* inquire the text above leader attribute for the label */ if (!status) { status = UF_DRF_ask_obj_text_above_ldr(text_aid_tag, &text_above_leader); } /* restore the saved value for text above leader */ if (!status) status = UF_DRF_set_text_above_leader(save_text_above_leader); printf("UF_DRF_create_label, UF_DRF_set_text_above_leader "); if (status) { UF_get_fail_message(status, stat_msg); printf("has ERROR %d: %s \n", status, stat_msg); } else printf("is successful. \n"); UF_terminate(); }