斑竹你好:我在UIStyler对话框中能显示uc1601中的内容,却总是不能调用UF_UI_select_with_single_dialog,请指点
/* -------------------------------------------------------------------------
* Callback Name: TUTAI_action_position_tool_cb
* This is a callback function associated with an action taken from a
* UIStyler object.
*
* Input: dialog_id - The dialog id indicate which dialog this callback
* is associated with. The dialog id is a dynamic,
* unique id and should not be stored. It is
* strictly for the use in the UG/Open API:
* UF_STYLER_ask_value(s)
* UF_STYLER_set_value
* client_data - Client data is user defined data associated
* with your dialog. Client data may be bound
* to your dialog with UF_MB_add_styler_actions
* or UF_STYLER_create_dialog.
* callback_data - This structure pointer contains information
* specific to the UIStyler Object type that
* invoked this callback and the callback type.
* -----------------------------------------------------------------------*/
int TUTAI_action_position_tool_cb ( int dialog_id,
void * client_data,
UF_STYLER_item_value_type_p_t callback_data)
{
/* Make sure User Function is available. */
if ( UF_initialize() != 0)
return ( UF_UI_CB_CONTINUE_DIALOG );
/* ---- Enter your callback code here ----- */
/////////////////////////////////////////////////////////
uc1601("请选择一个面!",1);
///////////////////////////////////////////
char cue[] = "cue message";
char title[] = "dialog title";
int response;
tag_t object, view;
double cursor[3];
if(!UF_CALL(UF_UI_select_with_single_dialog(cue,title,
UF_UI_SEL_SCOPE_NO_CHANGE, init_proc, NULL,
&response, &object, cursor, &view)))
{
if (response == UF_UI_OBJECT_SELECTED ||
response == UF_UI_OBJECT_SELECTED_BY_NAME)
{
printf("object tag = %d\n", object);
if (response == UF_UI_OBJECT_SELECTED)
{
////////////////////////////////////////////
double center[3];
double dir[3];
double box[6];
double radius;
double rad_data;
int type;
int norm_dir;
char zp[100];
UF_CALL(UF_MODL_ask_face_data(object, &type, center, dir, box, &radius,
[$rad_data, &norm_dir))]
//The center
UF_UI_open_listing_window();
UF_UI_write_listing_window("\n");
UF_UI_write_listing_window("The selected Face's Center Point:\n");
sprintf(zp,"The center_x=%f\n",center[0]);
UF_UI_write_listing_window(zp);
////////////////////
sprintf(zp,"The center_y=%f\n",center[1]);
UF_UI_write_listing_window(zp);
sprintf(zp,"The center_z=%f\n",center[2]);
UF_UI_write_listing_window(zp);
UF_UI_write_listing_window("\n");
////////////////////////////////
printf("view = %d\n", view);
printf("cursor position = %f %f %f\n",
cursor[0], cursor[1], cursor[2]);
}
}
/* unhighlight selected object */
UF_DISP_set_highlight(object,0);
}
UF_terminate ();
/* Callback acknowledged, do not terminate dialog */
return (UF_UI_CB_CONTINUE_DIALOG);
/* or Callback acknowledged, terminate dialog. */
/* return ( UF_UI_CB_EXIT_DIALOG ); */
/* selection initialization procedure */
} |