UG二次开发用到的UgOpen_v18.awx和UgOpen_v18.hlp两个文件,跪求黄yy,坐等

君,已阅读到文档的结尾了呢~~
基于UG的刮板输送机链轮三维参数化建模机械设计教材,机械设计国家标准,机械设计大学课件。
扫扫二维码,随身浏览文档
手机或平板扫扫即可继续访问
基于UG的刮板输送机链轮三维参数化建模
举报该文档为侵权文档。
举报该文档含有违规或不良信息。
反馈该文档无法正常浏览。
举报该文档为重复文档。
推荐理由:
将文档分享至:
分享完整地址
文档地址:
粘贴到BBS或博客
flash地址:
支持嵌入FLASH地址的网站使用
html代码:
&embed src='/DocinViewer-4.swf' width='100%' height='600' type=application/x-shockwave-flash ALLOWFULLSCREEN='true' ALLOWSCRIPTACCESS='always'&&/embed&
450px*300px480px*400px650px*490px
支持嵌入HTML代码的网站使用
您的内容已经提交成功
您所提交的内容需要审核后才能发布,请您等待!
3秒自动关闭窗口NX二次开发(非常有用)_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
NX二次开发(非常有用)
上传于||暂无简介
阅读已结束,如果下载本文需要使用2下载券
想免费下载本文?
下载文档到电脑,查找使用更方便
还剩63页未读,继续阅读
你可能喜欢运用开发汽车冲模标准件库_图文_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
运用开发汽车冲模标准件库
上传于||暂无简介
阅读已结束,如果下载本文需要使用5下载券
想免费下载本文?
你可能喜欢查看: 3111|回复: 13
小白学UG二次开发_UG菜单栏和UG Block编程
三级士官, 积分 640, 距离下一级还需 60 积分
三级士官, 积分 640, 距离下一级还需 60 积分
阅读权限50
在线时间69 小时
三级士官, 积分 640, 距离下一级还需 60 积分
三级士官, 积分 640, 距离下一级还需 60 积分
阅读权限50
在线时间69 小时
本例参考UG自动生成的代码文件还有《基于UG NX系统的二次开发》周临震等. 另外感谢Murry对我的帮助。以下代码由前面小白学UG二次开发_UGOpen UIStyler 对话框设计文中所举例子生成的C代码,如上例所说,该代码提供了分别由菜单栏、block和user exit三种不同的方式调用UI block的方式。本例主要采用从菜单栏进入的方式来实现对对话框的调用。现在对环境变量的设置十分疑惑,书中每举一个例子,都会设置一次环境变量,而且都是不同的。不知道这个会不会冲突,比如我同时要使用这几个功能时,这个环境变量该怎么设置。有朋友建议我去看看帮助文件。另外,加载菜单文件时,需要现在UGII下的custom_dirs.dat中添加目录地址,如D:UGOPEN。另外,在该目录下面设置application文件和startup文件。
捕获1.PNG (7.46 KB, 下载次数: 1)
11:00 上传
捕获2.PNG (66.46 KB, 下载次数: 1)
11:00 上传
/* These includefiles are needed for the following template code.& && && && &*/#include &stdio.h& #include &uf.h&#include &uf_defs.h&#include &uf_exit.h&#include &uf_ui.h&#include &uf_styler.h&#include &uf_mb.h& #include &access_dialog.h& /* The followingdefinition defines the number of callback entries *//* in the callbackstructure:& && && && && && && && && && && && & *//*UF_STYLER_callback_info_t DIALOG_ACCESS_cbs */#define DIALOG_ACCESS_CB_COUNT ( 3 + 1) /* Add 1 for the terminator */ /*--------------------------------------------------------------------------The followingstructure defines the callback entries used by the& && & styler file.&&This structure MUST be passed into the userfunction,& & UF_STYLER_create_dialogalong with DIALOG_ACCESS_CB_COUNT.& && && && && && && &&&--------------------------------------------------------------------------*/static UF_STYLER_callback_info_tDIALOG_ACCESS_cbs[DIALOG_ACCESS_CB_COUNT] = { {UF_STYLER_DIALOG_INDEX, UF_STYLER_APPLY_CB& && &&&, 0,DIALOG_ACCESS_apply_cb}, {UF_STYLER_DIALOG_INDEX, UF_STYLER_BACK_CB& && && &, 0,DIALOG_ACCESS_back_cb}, {DIALOG_ACCESS_BUTTON&&, UF_STYLER_ACTIVATE_CB& &&&, 0,DIALOG_ACCESS_action_3_act_cb}, {UF_STYLER_NULL_OBJECT, UF_STYLER_NO_CB, 0, 0 }};
/*--------------------------------------------------------------------------UF_MB_styler_actions_tcontains 4 fields.&&These are defined asfollows: Field 1 : the nameof your dialog that you wish to display.Field 2 : any clientdata you wish to pass to your callbacks.Field 3 : yourcallback structure.Field 4 : flag toinform menubar of your dialog location. This flag MUST match the resource set in your dialog!&&Do NOT ASSUME that changing this field willupdate the location of your dialog. Please use the UIStyler to indicate the position of your dialog.--------------------------------------------------------------------------*/static UF_MB_styler_actions_tactions[] = {& & { &access_dialog.dlg&,&&NULL,& &DIALOG_ACCESS_cbs,&&UF_MB_STYLER_IS_NOT_TOP },& & { NULL,&&NULL,&&NULL,&&0 } /* Thisis a NULL terminated list */};
/*----------------MENUBAR HOOKUP HELP Example -------------------To launch thisdialog from a Unigraphics menubar, you must follow the steps below.1)&&Add the following lines to your MenuScriptfile in order to associate a menu bar button with your dialog.&&In this example, a cascade menu will becreated and will be located just before the Help button on the main menubar. Thebutton, ACCESS_DIALOG_BTN is set up to launch your dialog and will bepositioned as the first button on your pulldown menu.If you wish to add thebutton to an existing cascade, simply add the 3 lines between MENULAUNCH_CASCADE and END_OF_MENU&&to yourmenuscript file.&&& & 增加以下几行到你的MenuScript文件中用以链接菜单栏按钮和对话框。在这个例子中,一个层叠菜单将会在主菜单栏的HELP选项前创建。该按钮,ACCESS_DIALOG_BTN 是设置起来用以触发你的对话框并且将会出现在第一个下拉菜单按钮中。如果你希望增加该按钮到你现有的层叠菜单里,仅需要增加 MENU LAUNCH_CASCADE 和 END_OF_MENU之间的三行到你的Menuscript文件中。& & The MenuScript file requires an extension of&.men&.& & Make sure that you add the extension to thefile and place the file in your startup directory:& && &$UGII_USER_DIR/startup or & && &$UGII_SITE_DIR/startup or & && &$UGII_VENDOR_DIR/startup directory& &MenuScript 文件需要以.men作为扩展名,确保你将该文件的扩展名改成.men,并将该文件下放到以下的目录中去。(注意:三选一)& & Move the contents between the dashed linesto your Menuscript file.!&&----------------------------------------------------------------VERSION120 菜单脚本的版本号,在系统菜单文件、用户文件中,无论是编辑模式还是创建模式,第一行通常就是版本号说明。但是版本号,为啥是120?EDITUG_GATEWAY_MAIN_MENUBAR EDIT 编辑模式菜单文件的标志,编辑的对象应该是已经创建好的菜单,在关键字EDIT之后指出所编辑菜单的标示符,用户的菜单尽量采用编辑模式。BEFOREUG_HELPBEFORE 在已有的菜单文件中定义的某个菜单项之前加上一个新项。 这里是UG_HELP,相对应的,也有AFTER,之后都要用END_OF_BEFORE or END_OF_AFTER来结束。& && &CASCADE_BUTTON UISTYLER_DLG_CASCADE_BTN CASCADE_BUTTON&&层叠菜单项。当它激活时打开一个子菜单,每一个级联按钮的定义,必须用MENU定义相同的菜单名。这个从下面的可以看出来。子菜单既可以在级联按钮前定义,也可以在级联按钮菜单后定义。& && &LABEL Dialog LauncherLabel 菜单项名称,也就是我们看到的名称。& & END_OF_BEFORE
& & MENU UISTYLER_DLG_CASCADE_BTN& &前面提到过了,名字要对应& && &BUTTON ACCESS_DIALOG_BTN& && &&&BUTTON 是在菜单栏中添加一个项,如果有两个项,就在ACTIONS 后面再加一个BUTTON。& && &LABEL Display access_dialog dialog& && &ACTIONS access_dialog.dlg& &ACTIONS表面你要执行的动作,可以有:NX系统定义的标准命令、用户定义的回调函数、一个对话框文件名称,一个GRIP程序、一个工具栏文件、操作系统的命令以及OPEN C and C++ Program的程序名称。& & END_OF_MENU& &非顶层菜单定义结束!&&---------------------------------------------------------------上面这些就是下拉菜单的代码。因为我的UG是中文版的,所以加载后Dialog Launcher直接就被转换成了启动对话框,下拉菜单中的Display access_dialogdialog还是保持英文的状态。 2) Issue a call tothe function, UF_MB_add_styler_actions from the ufsta& &user exit as shown below.&&To use this call, remove the conditional & &definitions: #ifdef MENUBAR_COMMENTED_OUT & && && && && &&&#endif MENUBAR_COMMENTED_OUT & &如下所示,从ufstauser exit 发出调用 UF_MB_add_styler_actions请求。(这个翻译我不是很确定。)& &要调用这一段函数,需要去除条件定义。& &The static structure, actions, will allowyou to associate ALL of your dialogs and callback functions to the&&menubar at once.&&For example, if you wish to have 10 dialogsassociated to 10 different buttons on the menubar,you may enter each dialog andcallback list into the actions structure. Make sure that you have created a corresponding button in your MenuScript file.& &Static structure,actions将会允许你在下拉菜单中链接所有你的对话框和回调函数。比如,如果你想让& &十个对话框和十个不同的下拉菜单中的按钮一一对应的话,你需要将每一个对话框和回调列表(list)到你的actions & &structure 中去。确保你已经在MenuScript文件中创建一个响应按钮。& &You may also have separate shared libraries,each with a ufsta user exit& &for each individual dialog.
3) Place yourcompiled and linked ufsta user function in & &$UGII_USER_DIR/startup or& && &$UGII_SITE_DIR/startup or & &$UGII_VENDOR_DIR/startup directory.& &&& & &NOTE: The user function must contain the proper extension .so, .sl or .dll & &to make ensure that it is recognized by theMenuScript.&&If it does not& &have the proper extension, it will NOT berecognized by MenuScript.& & & &这个比较关键,就是将生成的DLL文件放到上面的几个文件夹目录下。如果扩展名不对的话,MenuScript不能识别 & &The action name you have provided in your MenuScriptmust correspond to to the dialog name provided in the action structure.&&This MUST match inorder to bind your dlg file to your MenuScriptbutton.& && && && && && && && && & & &你在MenuScript中提供的action name必须与你在action structure 提供的对话框一致。& &4) Copy yourUIStyler dialog file to the proper directory.& &All dialog files (.dlg) must be located in & && &$UGII_USER_DIR/application or & && &$UGII_SITE_DIR/application or & && &$UGII_VENDOR_DIR/application directory& &将你的UIStyler的dig文件拷贝到下面几个文件夹中。(三选一)
------------------------------------------------------------*/#define MENUBAR_COMMENTED_OUT #ifdef MENUBAR_COMMENTED_OUTextern void ufsta (char *param, int *retcode, int rlen){& & int&&error_ & & if ( (UF_initialize()) != 0) & && && & return;& && && && && && && && && && && && && && && && && & if ( (error_code = UF_MB_add_styler_actions ( actions ) ) != 0 )& & {& && && & char fail_message[133];& && && & & && && & UF_get_fail_message(error_code,fail_message);& && && & printf ( &%s\n&, fail_message ); & & }& && && && && && && && && && && && && && && && && & UF_terminate();& && && && && && && && && &&&& & return;}#endif /*MENUBAR_COMMENTED_OUT*/
/*-------------------------------------------------------------------------*//*----------------------UIStyler Callback Functions ----------------------*//*-------------------------------------------------------------------------*/ /*------------------------------------------------------------------------- * Callback Name: DIALOG_ACCESS_apply_cb * This is a callback function associated withan action taken from a * UIStyler object.
* * Input: dialog_id& &-&&The dialog id indicate which dialog this callback *& && && && && && && && &is associatedwith.&&The dialog id is a dynamic, *& && && && && && && && &unique id and shouldnot be stored.&&It is *& && && && && && && && &strictly for the use inthe NX Open API: *& && && && && && && && && && & UF_STYLER_ask_value(s) *& && && && && && && && && && &UF_STYLER_set_value& & *& && & client_data -& &Client data isuser defined data associated *& && && && && && && && &with your dialog.&&Client data may be bound *& && && && && && && && &to your dialog withUF_MB_add_styler_actions *& && && && && && && && &orUF_STYLER_create_dialog.& && && && && &&& *& && & callback_data - This structure pointer contains information *& && && && && && && && &specific to the UIStylerObject type that&& *& && && && && && && && &invoked this callbackand the callback type. *-----------------------------------------------------------------------*/intDIALOG_ACCESS_apply_cb ( int dialog_id,& && && && & void * client_data,& && && && & UF_STYLER_item_value_type_p_t callback_data){& &&&/* Makesure User Function is available. */&&& &&&if ( UF_initialize() != 0) & && && & return ( UF_UI_CB_CONTINUE_DIALOG ); & &&&/* ----Enter your callback code here ----- */ & &&&UF_terminate (); & & /*Callback acknowledged, do not terminate dialog& && && && && &&&*/& & /* Areturn value of UF_UI_CB_EXIT_DIALOG will not be accepted& & */& & /* forthis callback type.&&You must respond toyour apply button.*/& & return (UF_UI_CB_CONTINUE_DIALOG);
/*------------------------------------------------------------------------- * Callback Name: DIALOG_ACCESS_back_cb * This is a callback function associated withan action taken from a * UIStyler object.
* * Input: dialog_id& &-&&The dialog id indicate which dialog this callback *& && && && && && && && &is associatedwith.&&The dialog id is a dynamic, *& && && && && && && && &unique id and shouldnot be stored.&&It is *& && && && && && && && &strictly for the use inthe NX Open API: *& && && && && && && && && && &UF_STYLER_ask_value(s)
*& && && && && && && && && && &UF_STYLER_set_value& & *& && & client_data -& &Client data isuser defined data associated *& && && && && && && && &with your dialog.&&Client data may be bound *& && && && && && && && &to your dialog withUF_MB_add_styler_actions *& && && && && && && && &orUF_STYLER_create_dialog.& && && && && &&& *& && & callback_data - This structure pointer contains information *& && && && && && && &&&specific to the UIStylerObject type that&& *& && && && && && && && &invoked this callbackand the callback type. *-----------------------------------------------------------------------*/intDIALOG_ACCESS_back_cb ( int dialog_id,& && && && & void * client_data,& && && && & UF_STYLER_item_value_type_p_t callback_data){& &&&/* Makesure User Function is available. */&&& &&&if ( UF_initialize() != 0) & && && & return ( UF_UI_CB_CONTINUE_DIALOG ); & &&&/* ----Enter your callback code here ----- */& &&&uc1601(&Hello,boy,youwill exit this dialog!&,1);& &&&UF_terminate (); & & /*Callback acknowledged, terminate dialog.& && && && &*/& & /* It isSTRONGLY recommended that you exit your& && &*/& & /*callback with UF_UI_CB_EXIT_DIALOG in a back call& &*/& & /* backrather than UF_UI_CB_CONTINUE_DIALOG.& && && &*/& & return (UF_UI_CB_EXIT_DIALOG);
/*------------------------------------------------------------------------- * Callback Name: DIALOG_ACCESS_action_3_act_cb * This is a callback function associated withan action taken from a * UIStyler object.
* * Input: dialog_id& &-&&The dialog id indicate which dialog this callback *& && && && && && && && &is associatedwith.&&The dialog id is a dynamic, *& && && && && && && && &unique id and should not be stored.&&It is *& && && && && && && && &strictly for the use inthe NX Open API: *& && && && && && && && && && &UF_STYLER_ask_value(s)
*& && && && && && && && && && &UF_STYLER_set_value& & *& && & client_data -& &Client data isuser defined data associated *& && && && && && && && &with your dialog.&&Client data may be bound *& && && && && && && && &to your dialog withUF_MB_add_styler_actions *& && && && && && && && &or UF_STYLER_create_dialog.& && && && && &&& *& && & callback_data - This structure pointer contains information *& && && && && && && && &specific to theUIStyler Object type that&& *& && && && && && && && &invoked this callbackand the callback type. * -----------------------------------------------------------------------*/intDIALOG_ACCESS_action_3_act_cb ( int dialog_id,& && && && & void * client_data,& && && && & UF_STYLER_item_value_type_p_t callback_data){& &&&/* Makesure User Function is available. */&&& &&&if ( UF_initialize() != 0) & && && & return ( UF_UI_CB_CONTINUE_DIALOG ); & &&&/* ----Enter your callback code here ----- */& & UF_STYLER_item_value_type_t data[3];& & char info[100];& & data[0].item_attr=UF_STYLER_VALUE;& & data[0].item_id=DIALOG_ACCESS_INTEGER;& & UF_STYLER_ask_value(dialog_id,&data[0]); & & data[1].item_attr=UF_STYLER_VALUE;& & data[1].item_id=DIALOG_ACCESS_REAL;& & UF_STYLER_ask_value(dialog_id,&data[1]); & & data[2].item_attr=UF_STYLER_VALUE;& & data[2].item_id=DIALOG_ACCESS_STRING;& & UF_STYLER_ask_value(dialog_id,&data[2]);& & //将格式化的数据写入字符缓冲区& & sprintf(info,&整数为:%d\n实数为:%f\n字符串为:%s\n&,data[0].value.integer,data[1].value.real,data[2].value.string); & & uc1601(info,1);& &&&UF_terminate (); & & /*Callback acknowledged, do not terminate dialog */& & return (UF_UI_CB_CONTINUE_DIALOG); & & & & /* orCallback acknowledged, terminate dialog.& &*/& & /*return ( UF_UI_CB_EXIT_DIALOG );& && && && &&&*/ }效果图
一键复制代码:/* These includefiles are needed for the following template code.& && && && &*/
#include &stdio.h&
#include &uf.h&
#include &uf_defs.h&
#include &uf_exit.h&
#include &uf_ui.h&
#include &uf_styler.h&
#include &uf_mb.h&
#include &access_dialog.h&
/* The followingdefinition defines the number of callback entries */
/* in the callbackstructure:& && && && && && && && && && && && & */
/*UF_STYLER_callback_info_t DIALOG_ACCESS_cbs */
#define DIALOG_ACCESS_CB_COUNT ( 3 + 1) /* Add 1 for the terminator */
/*--------------------------------------------------------------------------
The followingstructure defines the callback entries used by the& && &
styler file.&&This structure MUST be passed into the userfunction,& &
UF_STYLER_create_dialogalong with DIALOG_ACCESS_CB_COUNT.& && && && && && && &&&
--------------------------------------------------------------------------*/
static UF_STYLER_callback_info_tDIALOG_ACCESS_cbs[DIALOG_ACCESS_CB_COUNT] =
{
{UF_STYLER_DIALOG_INDEX, UF_STYLER_APPLY_CB& && &&&, 0,DIALOG_ACCESS_apply_cb},
{UF_STYLER_DIALOG_INDEX, UF_STYLER_BACK_CB& && && &, 0,DIALOG_ACCESS_back_cb},
{DIALOG_ACCESS_BUTTON&&, UF_STYLER_ACTIVATE_CB& &&&, 0,DIALOG_ACCESS_action_3_act_cb},
{UF_STYLER_NULL_OBJECT, UF_STYLER_NO_CB, 0, 0 }
};
/*--------------------------------------------------------------------------
UF_MB_styler_actions_tcontains 4 fields.&&These are defined asfollows:
Field 1 : the nameof your dialog that you wish to display.
Field 2 : any clientdata you wish to pass to your callbacks.
Field 3 : yourcallback structure.
Field 4 : flag toinform menubar of your dialog location. This flag MUST match the resource set in your dialog!&&Do NOT ASSUME that changing this field willupdate the location of your dialog. Please use the UIStyler to indicate the position of your dialog.
--------------------------------------------------------------------------*/
static UF_MB_styler_actions_tactions[] = {
& & { &access_dialog.dlg&,&&NULL,& &DIALOG_ACCESS_cbs,&&UF_MB_STYLER_IS_NOT_TOP },
& & { NULL,&&NULL,&&NULL,&&0 } /* Thisis a NULL terminated list */
};
/*----------------MENUBAR HOOKUP HELP Example -------------------
To launch thisdialog from a Unigraphics menubar, you must follow
the steps below.
1)&&Add the following lines to your MenuScriptfile in order to associate a menu bar button with your dialog.&&In this example, a cascade menu will becreated and will be located just before the Help button on the main menubar. Thebutton, ACCESS_DIALOG_BTN is set up to launch your dialog and will bepositioned as the first button on your pulldown menu.If you wish to add thebutton to an existing cascade, simply add the 3 lines between MENULAUNCH_CASCADE and END_OF_MENU&&to yourmenuscript file.&&
& & 增加以下几行到你的MenuScript文件中用以链接菜单栏按钮和对话框。在这个例子中,一个层叠菜单将会在主菜单栏的HELP选项前创建。该按钮,ACCESS_DIALOG_BTN 是设置起来用以触发你的对话框并且将会出现在第一个下拉菜单按钮中。如果你希望增加该按钮到你现有的层叠菜单里,仅需要增加 MENU LAUNCH_CASCADE 和 END_OF_MENU之间的三行到你的Menuscript文件中。
& & The MenuScript file requires an extension of&.men&.
& & Make sure that you add the extension to thefile and place the file in your startup directory:
& && &$UGII_USER_DIR/startup or
& && &$UGII_SITE_DIR/startup or
& && &$UGII_VENDOR_DIR/startup directory
& &MenuScript 文件需要以.men作为扩展名,确保你将该文件的扩展名改成.men,并将该文件下放到以下的目录中去。(注意:三选一)
& & Move the contents between the dashed linesto your Menuscript file.
!&&----------------------------------------------------------------
VERSION120
菜单脚本的版本号,在系统菜单文件、用户文件中,无论是编辑模式还是创建模式,第一行通常就是版本号说明。但是版本号,为啥是120?
EDITUG_GATEWAY_MAIN_MENUBAR
EDIT 编辑模式菜单文件的标志,编辑的对象应该是已经创建好的菜单,在关键字EDIT之后指出所编辑菜单的标示符,用户的菜单尽量采用编辑模式。
BEFOREUG_HELP
BEFORE 在已有的菜单文件中定义的某个菜单项之前加上一个新项。 这里是UG_HELP,相对应的,也有AFTER,之后都要用END_OF_BEFORE or END_OF_AFTER来结束。
& && &CASCADE_BUTTON UISTYLER_DLG_CASCADE_BTN
CASCADE_BUTTON&&层叠菜单项。当它激活时打开一个子菜单,每一个级联按钮的定义,必须用MENU定义相同的菜单名。这个从下面的可以看出来。子菜单既可以在级联按钮前定义,也可以在级联按钮菜单后定义。
& && &LABEL Dialog Launcher
Label 菜单项名称,也就是我们看到的名称。
& & END_OF_BEFORE
& & MENU UISTYLER_DLG_CASCADE_BTN& &前面提到过了,名字要对应
& && &BUTTON ACCESS_DIALOG_BTN& && &&&BUTTON 是在菜单栏中添加一个项,如果有两个项,就在ACTIONS 后面再加一个BUTTON。
& && &LABEL Display access_dialog dialog
& && &ACTIONS access_dialog.dlg& &ACTIONS表面你要执行的动作,可以有:NX系统定义的标准命令、用户定义的回调函数、一个对话框文件名称,一个GRIP程序、一个工具栏文件、操作系统的命令以及OPEN C and C++ Program的程序名称。
& & END_OF_MENU& &非顶层菜单定义结束
!&&---------------------------------------------------------------
上面这些就是下拉菜单的代码。因为我的UG是中文版的,所以加载后Dialog Launcher直接就被转换成了启动对话框,下拉菜单中的Display access_dialogdialog还是保持英文的状态。
2) Issue a call tothe function, UF_MB_add_styler_actions from the ufsta
& &user exit as shown below.&&To use this call, remove the conditional
& &definitions: #ifdef MENUBAR_COMMENTED_OUT
& && && && && &&&#endif MENUBAR_COMMENTED_OUT
& &如下所示,从ufstauser exit 发出调用 UF_MB_add_styler_actions请求。(这个翻译我不是很确定。)
& &要调用这一段函数,需要去除条件定义。
& &The static structure, actions, will allowyou to associate ALL of your
dialogs and callback functions to the&&menubar at once.&&For example, if you wish to have 10 dialogsassociated to 10 different buttons on the menubar,you may enter each dialog andcallback list into the actions structure. Make sure that you have created a corresponding button in your MenuScript file.
& &Static structure,actions将会允许你在下拉菜单中链接所有你的对话框和回调函数。比如,如果你想让
& &十个对话框和十个不同的下拉菜单中的按钮一一对应的话,你需要将每一个对话框和回调列表(list)到你的actions
& &structure 中去。确保你已经在MenuScript文件中创建一个响应按钮。
& &You may also have separate shared libraries,each with a ufsta user exit
& &for each individual dialog.
3) Place yourcompiled and linked ufsta user function in
& &$UGII_USER_DIR/startup or& &
& &$UGII_SITE_DIR/startup or
& &$UGII_VENDOR_DIR/startup directory.& &&&
& &NOTE: The user function must contain the proper extension .so, .sl or .dll
& &to make ensure that it is recognized by theMenuScript.&&If it does not
& &have the proper extension, it will NOT berecognized by MenuScript.& &
& &这个比较关键,就是将生成的DLL文件放到上面的几个文件夹目录下。如果扩展名不对的话,MenuScript不能识别
& &The action name you have provided in your MenuScriptmust correspond to to the dialog name provided in the action structure.&&This MUST match inorder to bind your dlg file to your MenuScriptbutton.& && && && && && && && && &
& &你在MenuScript中提供的action name必须与你在action structure 提供的对话框一致。
& &
4) Copy yourUIStyler dialog file to the proper directory.
& &All dialog files (.dlg) must be located in
& && &$UGII_USER_DIR/application or
& && &$UGII_SITE_DIR/application or
& && &$UGII_VENDOR_DIR/application directory
& &将你的UIStyler的dig文件拷贝到下面几个文件夹中。(三选一)
------------------------------------------------------------*/
#define MENUBAR_COMMENTED_OUT
#ifdef MENUBAR_COMMENTED_OUT
extern void ufsta (char *param, int *retcode, int rlen)
{
& & int&&error_
& & if ( (UF_initialize()) != 0)
& && && &
& && && && && && && && && && && && && && && && &
& & if ( (error_code = UF_MB_add_styler_actions ( actions ) ) != 0 )
& & {
& && && & char fail_message[133];
& && && &
& && && & UF_get_fail_message(error_code,fail_message);
& && && & printf ( &%s\n&, fail_message );
& & }
& && && && && && && && && && && && && && && && &
& & UF_terminate();& && && && && && && && && &&&
& &
}
#endif /*MENUBAR_COMMENTED_OUT*/
/*-------------------------------------------------------------------------*/
/*----------------------UIStyler Callback Functions ----------------------*/
/*-------------------------------------------------------------------------*/
/*-------------------------------------------------------------------------
* Callback Name: DIALOG_ACCESS_apply_cb
* This is a callback function associated withan action taken from a
* UIStyler object.
*
* Input: dialog_id& &-&&The dialog id indicate which dialog this callback
*& && && && && && && && &is associatedwith.&&The dialog id is a dynamic,
*& && && && && && && && &unique id and shouldnot be stored.&&It is
*& && && && && && && && &strictly for the use inthe NX Open API:
*& && && && && && && && && && & UF_STYLER_ask_value(s)
*& && && && && && && && && && &UF_STYLER_set_value& &
*& && & client_data -& &Client data isuser defined data associated
*& && && && && && && && &with your dialog.&&Client data may be bound
*& && && && && && && && &to your dialog withUF_MB_add_styler_actions
*& && && && && && && && &orUF_STYLER_create_dialog.& && && && && &&&
*& && & callback_data - This structure pointer contains information
*& && && && && && && && &specific to the UIStylerObject type that&&
*& && && && && && && && &invoked this callbackand the callback type.
*-----------------------------------------------------------------------*/
intDIALOG_ACCESS_apply_cb ( int dialog_id,
& && && && & void * client_data,
& && && && & UF_STYLER_item_value_type_p_t callback_data)
{
& &&&/* Makesure User Function is available. */&&
& &&&if ( UF_initialize() != 0)
& && && & return ( UF_UI_CB_CONTINUE_DIALOG );
& &&&/* ----Enter your callback code here ----- */
& &&&UF_terminate ();
& & /*Callback acknowledged, do not terminate dialog& && && && && &&&*/
& & /* Areturn value of UF_UI_CB_EXIT_DIALOG will not be accepted& & */
& & /* forthis callback type.&&You must respond toyour apply button.*/
& & return (UF_UI_CB_CONTINUE_DIALOG);
}
/*-------------------------------------------------------------------------
* Callback Name: DIALOG_ACCESS_back_cb
* This is a callback function associated withan action taken from a
* UIStyler object.
*
* Input: dialog_id& &-&&The dialog id indicate which dialog this callback
*& && && && && && && && &is associatedwith.&&The dialog id is a dynamic,
*& && && && && && && && &unique id and shouldnot be stored.&&It is
*& && && && && && && && &strictly for the use inthe NX Open API:
*& && && && && && && && && && &UF_STYLER_ask_value(s)
*& && && && && && && && && && &UF_STYLER_set_value& &
*& && & client_data -& &Client data isuser defined data associated
*& && && && && && && && &with your dialog.&&Client data may be bound
*& && && && && && && && &to your dialog withUF_MB_add_styler_actions
*& && && && && && && && &orUF_STYLER_create_dialog.& && && && && &&&
*& && & callback_data - This structure pointer contains information
*& && && && && && && &&&specific to the UIStylerObject type that&&
*& && && && && && && && &invoked this callbackand the callback type.
*-----------------------------------------------------------------------*/
intDIALOG_ACCESS_back_cb ( int dialog_id,
& && && && & void * client_data,
& && && && & UF_STYLER_item_value_type_p_t callback_data)
{
& &&&/* Makesure User Function is available. */&&
& &&&if ( UF_initialize() != 0)
& && && & return ( UF_UI_CB_CONTINUE_DIALOG );
& &&&/* ----Enter your callback code here ----- */
& &&&uc1601(&Hello,boy,youwill exit this dialog!&,1);
& &&&UF_terminate ();
& & /*Callback acknowledged, terminate dialog.& && && && &*/
& & /* It isSTRONGLY recommended that you exit your& && &*/
& & /*callback with UF_UI_CB_EXIT_DIALOG in a back call& &*/
& & /* backrather than UF_UI_CB_CONTINUE_DIALOG.& && && &*/
& & return (UF_UI_CB_EXIT_DIALOG);
}
/*-------------------------------------------------------------------------
* Callback Name: DIALOG_ACCESS_action_3_act_cb
* This is a callback function associated withan action taken from a
* UIStyler object.
*
* Input: dialog_id& &-&&The dialog id indicate which dialog this callback
*& && && && && && && && &is associatedwith.&&The dialog id is a dynamic,
*& && && && && && && && &unique id and should not be stored.&&It is
*& && && && && && && && &strictly for the use inthe NX Open API:
*& && && && && && && && && && &UF_STYLER_ask_value(s)
*& && && && && && && && && && &UF_STYLER_set_value& &
*& && & client_data -& &Client data isuser defined data associated
*& && && && && && && && &with your dialog.&&Client data may be bound
*& && && && && && && && &to your dialog withUF_MB_add_styler_actions
*& && && && && && && && &or UF_STYLER_create_dialog.& && && && && &&&
*& && & callback_data - This structure pointer contains information
*& && && && && && && && &specific to theUIStyler Object type that&&
*& && && && && && && && &invoked this callbackand the callback type.
* -----------------------------------------------------------------------*/
intDIALOG_ACCESS_action_3_act_cb ( int dialog_id,
& && && && & void * client_data,
& && && && & UF_STYLER_item_value_type_p_t callback_data)
{
& &&&/* Makesure User Function is available. */&&
& &&&if ( UF_initialize() != 0)
& && && & return ( UF_UI_CB_CONTINUE_DIALOG );
& &&&/* ----Enter your callback code here ----- */
& & UF_STYLER_item_value_type_t data[3];
& & char info[100];
& & data[0].item_attr=UF_STYLER_VALUE;
& & data[0].item_id=DIALOG_ACCESS_INTEGER;
& & UF_STYLER_ask_value(dialog_id,&data[0]);
& & data[1].item_attr=UF_STYLER_VALUE;
& & data[1].item_id=DIALOG_ACCESS_REAL;
& & UF_STYLER_ask_value(dialog_id,&data[1]);
& & data[2].item_attr=UF_STYLER_VALUE;
& & data[2].item_id=DIALOG_ACCESS_STRING;
& & UF_STYLER_ask_value(dialog_id,&data[2]);
& & //将格式化的数据写入字符缓冲区
& & sprintf(info,&整数为:%d\n实数为:%f\n字符串为:%s\n&,data[0].value.integer,data[1].value.real,data[2].value.string);
& & uc1601(info,1);
& &&&UF_terminate ();
& & /*Callback acknowledged, do not terminate dialog */
& & return (UF_UI_CB_CONTINUE_DIALOG);
& &
& & /* orCallback acknowledged, terminate dialog.& &*/
& & /*return ( UF_UI_CB_EXIT_DIALOG );& && && && &&&*/
}复制代码
不错,支持!
有奖推广贴子:<input type="text" onclick="this.select();setCopy('小白学UG二次开发_UG菜单栏和UG Block编程\n/thread-.html', '帖子地址已经复制到剪贴板您可以用快捷键 Ctrl + V 粘贴到 QQ、MSN 里。');" value="/thread-.html" size="40" class="px" style="vertical-align:" />&<button type="submit" class="pn" onclick="setCopy('小白学UG二次开发_UG菜单栏和UG Block编程\n/thread-.html', '帖子地址已经复制到剪贴板您可以用快捷键 Ctrl + V 粘贴到 QQ、MSN 里。')">点击复制
阅读权限150
在线时间98 小时
阅读权限150
在线时间98 小时
谢谢楼主,辛苦!
五级士官, 积分 998, 距离下一级还需 2 积分
五级士官, 积分 998, 距离下一级还需 2 积分
阅读权限65
在线时间55 小时
五级士官, 积分 998, 距离下一级还需 2 积分
五级士官, 积分 998, 距离下一级还需 2 积分
阅读权限65
在线时间55 小时
想看懂还是很吃力!可能个人层次还没达到
三级士官, 积分 640, 距离下一级还需 60 积分
三级士官, 积分 640, 距离下一级还需 60 积分
阅读权限50
在线时间69 小时
三级士官, 积分 640, 距离下一级还需 60 积分
三级士官, 积分 640, 距离下一级还需 60 积分
阅读权限50
在线时间69 小时
请叫我老师头 发表于
谢谢楼主,辛苦!
分享了自己也能进步
三级士官, 积分 640, 距离下一级还需 60 积分
三级士官, 积分 640, 距离下一级还需 60 积分
阅读权限50
在线时间69 小时
三级士官, 积分 640, 距离下一级还需 60 积分
三级士官, 积分 640, 距离下一级还需 60 积分
阅读权限50
在线时间69 小时
~嘁哩喀喳 发表于
想看懂还是很吃力!可能个人层次还没达到
恩,多多看可能就会好一点,特别是那些英文的说明,第一次根本不想看,但是看了两次,其实大部分还是能看懂的
UG爱好者论坛 创始人
G币3253505
阅读权限255
在线时间10423 小时
居住地浙江省 温州市 乐清市 柳市镇
出生地浙江省 衢州市 江山市
毕业学校华南理工大学
自我介绍QQ:
UG爱好者论坛 创始人
G币3253505
阅读权限255
在线时间10423 小时
居住地浙江省 温州市 乐清市 柳市镇
不是搞这个的表示看不懂, 学习了。
五级士官, 积分 998, 距离下一级还需 2 积分
五级士官, 积分 998, 距离下一级还需 2 积分
阅读权限65
在线时间55 小时
五级士官, 积分 998, 距离下一级还需 2 积分
五级士官, 积分 998, 距离下一级还需 2 积分
阅读权限65
在线时间55 小时
老叶 发表于
不是搞这个的表示看不懂, 学习了。
其实关于二次开发, 这方面的资料还是很头疼
五级士官, 积分 998, 距离下一级还需 2 积分
五级士官, 积分 998, 距离下一级还需 2 积分
阅读权限65
在线时间55 小时
五级士官, 积分 998, 距离下一级还需 2 积分
五级士官, 积分 998, 距离下一级还需 2 积分
阅读权限65
在线时间55 小时
奇塔加个QQ吧 想跟你共同进步
三级士官, 积分 640, 距离下一级还需 60 积分
三级士官, 积分 640, 距离下一级还需 60 积分
阅读权限50
在线时间69 小时
三级士官, 积分 640, 距离下一级还需 60 积分
三级士官, 积分 640, 距离下一级还需 60 积分
阅读权限50
在线时间69 小时
老叶 发表于
不是搞这个的表示看不懂, 学习了。
谢谢老叶一直支持我
三级士官, 积分 640, 距离下一级还需 60 积分
三级士官, 积分 640, 距离下一级还需 60 积分
阅读权限50
在线时间69 小时
三级士官, 积分 640, 距离下一级还需 60 积分
三级士官, 积分 640, 距离下一级还需 60 积分
阅读权限50
在线时间69 小时
~嘁哩喀喳 发表于
奇塔加个QQ吧 想跟你共同进步
好的,不过我是小白,你不要介意
社区QQ达人
使用QQ帐号登录论坛的用户
论坛技术员
论坛技术员
客服电话:
UG论坛官方群:
UG论坛官方群:
工作时间:9:00-17:00

我要回帖

更多关于 跪求黄yy 的文章

 

随机推荐