- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
1、创建 NXhello 界面
代码:
#includeuf_ui.h//包含 UF_initialize()和 UF_terminate()函数原型的头文件#includeuf.h//包含 uc1601()函数原型的头文件externvoidufusr(char*param,int*retcode,intparam_len)
{
if(UF_initialize()!=0)//获取 NXopenapi 的执行权限
{
return;
uc1601(HelloNX,1);//弹出消息窗口,显示“HelloNX” UF_terminate();//释放 NXOPENAPI 的执行权限
}
}
运行结果截图:
2、创建一个模型,并在信息窗口显示模型的 tag 值。
代码:
#includestdio.h #includeuf.h #includeuf_modl.h #includeuf_ui_ugopen.h #includeuf_part.h #includeuf_ui.h staticvoiddo_ugopen_api(void)
{typedefunsignedinttag_t; UF_FEATURE_SIGNsign=UF_NULLSIGN;//无布尔运算doublecyl_orig[3]={0,0,0};//圆柱的圆心坐标char*cyl_height=100;
char*cyl_diam=40; doubledirection[3]={0,0,1};//延 Z 轴正方向tag_tobj=NULL_TAG;
UF_MODL_create_cyl1(sign,cyl_orig,cyl_height,cyl_diam,direction,obj); UF_UI_open_listing_window();//显示信息框:tag
/*Returnsthetagofthecurrentdisplaypart.Inanon-assemblypart,thisisthe sameastheworkpart.Iftherecurrentlyisntadisplayedpart,aNULL_TAGisreturned.*/
obj=UF_PART_ask_display_part(); if(obj==NULL_TAG)//没有部件的时候显示的信息提示框
{
uc1601(当前没有任何文件可供操作!,1);
}
else
{
}
}
chars[10];
sprintf(s,%d,obj);//sprinf()功能:把格式化的数据写入某个字符串UF_UI_write_listing_window(s);
return;
externvoidufusr(char*param,int*retcode,intrlen)//提供入口点
{
if((UF_initialize())!=0) return;
do_ugopen_api(); UF_terminate(); return;
}
externintufusr_ask_unload(void)
{
return(UF_UNLOAD_IMMEDIATELY);
}
运行结果截图:
无部件时的输出
有部件时的输出结果
3、openpart 用户入口实例创建 openpartuserexit
在用户点击“open”时创建新部件,在其中创建详细说明 userexit 设置文件过程
代码如下:
#includeuf_assem.h #includeuf_part.h #includeuf_ui_ugopen.h #includestdio.h #includeuf.h #includeuf_modl.h #includeuf_ui.h
#defineUF_CALL(X)(report( FILE , LINE ,#X,(X))) staticintreport(char*file,intline,char*call,intirc)
sphere
{
if(irc)
{
charmessg[133]; printf(%s,line%d:%s\n,file,line,call); (UF_get_fail_message(irc,messg))? printf(returneda%d\n,irc): printf(returnederror%d:%s\n,irc,messg);
}
return(irc);
}
staticvoiddo_ugopen_api(void)
{
UF_FEATURE_SIGNsign=UF_NULLSIGN;
tag_tpart=null_tag;//如果没有赋值的话,直接就是tag_tpart,当你执行.dll文件时,就直接跑到建模环境了,没有信息提示框
您可能关注的文档
- Microsoft SQL Server 还原数据库操作步骤的详细解析.docx
- Microsoft Virtual WiFi Miniport Adapter(微软虚拟无线微型适配器).docx
- MII (Media Independent Interface 介质无关接口).docx
- MIL-STD-883分析和总结最新分析和总结.docx
- MIM工艺流程分析和总结.docx
- mini2440触摸屏驱动分析.docx
- Mini2440写pwm控制直流电机.docx
- MiniLyrics(迷你歌词) V7.4.10 激活方法.docx
- min空气压缩机技术要求..docx
- mips和mipsel的区别分析和总结.docx
文档评论(0)