⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fam_test_dialog.c

📁 UG程序源代码
💻 C
📖 第 1 页 / 共 2 页
字号:

/*-------------------------------------------------------------------------*/
/*---------------------- UIStyler Callback Functions ----------------------*/
/*-------------------------------------------------------------------------*/

/* -------------------------------------------------------------------------
 * Callback Name: FAM_TEST_construct_fun
 * 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 NX 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 FAM_TEST_construct_fun ( int dialog_id,
             void * client_data,
             UF_STYLER_item_value_type_p_t callback_data)
{
     /* Make sure User Function is available. */
	 tag_t                         part_tag;
	 UF_STYLER_item_value_type_t   data;

     if ( UF_initialize() != 0) 
          return ( UF_UI_CB_CONTINUE_DIALOG );

	 part_tag=UF_PART_ask_display_part();
	 if(part_tag==NULL_TAG)//没有显示部件,只能在零件环境将标准件打开
	 {
		 //设置装配环境单选钮不可选,零件环境为选定环境
		 data.item_attr=UF_STYLER_SENSITIVITY;
		 data.item_id=FAM_TEST_RADIO_ENTI;
		 data.value.integer=FALSE;
		 data.subitem_index=0;
		 UF_STYLER_set_value(dialog_id,&data);
		 data.item_attr=UF_STYLER_VALUE;
		 data.subitem_index=1;
		 UF_STYLER_set_value(dialog_id,&data);		 
	 }
	 else//设置默认的选定环境为装配环境
	 {
		 data.item_attr=UF_STYLER_VALUE;
		 data.item_id=FAM_TEST_RADIO_ENTI;
		 data.subitem_index=0;
		 UF_STYLER_set_value(dialog_id,&data);
	 }
     //设置规格和长度单选列表的初始选项
	 data.item_attr=UF_STYLER_VALUE;
	 data.item_id=FAM_TEST_LIST_SPEC;
	 data.subitem_index=0;
	 UF_STYLER_set_value(dialog_id,&data);
	 
	 data.item_id=FAM_TEST_LIST_LEN;
	 UF_STYLER_set_value(dialog_id,&data);
	 
     UF_terminate ();

    /* Callback acknowledged, do not terminate dialog */
    return (UF_UI_CB_CONTINUE_DIALOG); 
    /* A return value of UF_UI_CB_EXIT_DIALOG will not be accepted    */
    /* for this callback type.  You must continue dialog construction.*/

}


/* -------------------------------------------------------------------------
 * Callback Name: FAM_TEST_ok_fun
 * 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 NX 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 FAM_TEST_ok_fun ( int dialog_id,
             void * client_data,
             UF_STYLER_item_value_type_p_t callback_data)
{
     /* Make sure User Function is available. */ 
	 UF_STYLER_item_value_type_t   data;
	 FAM_TEST_data_struct         *p_target_data;

     if ( UF_initialize() != 0) 
          return ( UF_UI_CB_CONTINUE_DIALOG );

	 p_target_data=(FAM_TEST_data_struct *)client_data;
	 data.item_attr=UF_STYLER_VALUE;
	 data.item_id=FAM_TEST_RADIO_ENTI;
	 UF_STYLER_ask_value(dialog_id,&data);
	 p_target_data->m_environment=data.value.integer;

	 data.item_id=FAM_TEST_LIST_SPEC;
	 data.indicator=UF_STYLER_STRING_VALUE;
	 UF_STYLER_ask_value(dialog_id,&data);
	 strcpy(p_target_data->part_spec,data.value.string);

	 data.item_id=FAM_TEST_LIST_LEN;
	 UF_STYLER_ask_value(dialog_id,&data);
	 strcpy(p_target_data->part_lengthen,data.value.string);

	 /*本实例打开的螺栓部件*/
	 strcpy(p_target_data->part_name,"\\bolt.prt");
     UF_terminate ();

    /* Callback acknowledged, terminate dialog             */
    /* It is STRONGLY recommended that you exit your       */
    /* callback with UF_UI_CB_EXIT_DIALOG in a ok callback.*/
    /* return ( UF_UI_CB_EXIT_DIALOG );                    */
    return (UF_UI_CB_EXIT_DIALOG);                           

}


/* -------------------------------------------------------------------------
 * Callback Name: FAM_TEST_cancel_fun
 * 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 NX 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 FAM_TEST_cancel_fun ( 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 ----- */

     UF_terminate ();

    /* Callback acknowledged, terminate dialog             */
    /* It is STRONGLY recommended that you exit your       */
    /* callback with UF_UI_CB_EXIT_DIALOG in a cancel call */
    /* back rather than UF_UI_CB_CONTINUE_DIALOG.          */
    return ( UF_UI_CB_EXIT_DIALOG );                       

}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -