下载此文档

nx二次开发习题及源码.docx


文档分类:IT计算机 | 页数:约13页 举报非法文档有奖
1/13
下载提示
  • 1.该资料是网友上传的,本站提供全文预览,预览什么样,下载就什么样。
  • 2.下载该文档所得收入归上传者、原创者。
  • 3.下载的文档,不会出现我们的网址水印。
1/13 下载此文档
文档列表 文档介绍
1、创建NXhello界面
代码:
#include <>//包含UF_initialize()和UF_terminate()函数原型的头文件
#include <>//包含uc1601()函数原型的头文件
extern void ufusr(char *param, int *retcode, int param_len)
{
if (UF_initialize()!=0)//获取NX openapi的执行权限
{
return;
uc1601("Hello NX",1);//弹出消息窗口,显示“Hello NX”
UF_terminate();//释放NX OPEN API的执行权限
}
}
运行结果截图:
2、创建一个模型,并在信息窗口显示模型的tag值。
代码:
#include <>
#include <>
#include <>
#include < >
#include <>
#include <>
static void do_ugopen_api(void)
{ typedef unsigned int tag_t;
UF_FEATURE_SIGN sign = UF_NULLSIGN;//无布尔运算
double cyl_orig[3] = {0,0,0};//圆柱的圆心坐标
char *cyl_height="100";
char *cyl_diam="40";
double direction[3]={0,0,1};//延Z轴正方向
tag_t obj=NULL_TAG;
UF_MODL_create_cyl1(sign, cyl_orig,cyl_height,cyl_diam,direction, &obj);
UF_UI_open_listing_window(); //显示信息框:tag
/*Returns the tag of the current display part. In a non-assembly part, this is the
same as the work part. If there currently isn't a displayed part, a NULL_TAG is returned. */
obj=UF_PART_ask_display_part();
if(obj == NULL_TAG) //没有部件的时候显示的信息提示框
{
uc1601 ( "当前没有任何文件可供操作!",1);
}
else
{
char s[10];
sprintf(s, "%d",obj); //sprinf()功能:把格式化的数据写入某个字符串
UF_UI_write_listing_window(s);
return;
}
}
extern void ufusr( char *param, int *retcode, int rlen )//提供入口点
{
if((UF_initialize())!=0)
return;
do_ugopen_api ();
UF_terminate();
return;
}
extern int ufusr_ask_unload(void)
{
return(UF_UNLOAD_IMMEDIATELY);
}
运行结果截图:
(1)无部件时的输出
(2)有部件时的输出结果
3、open part 用户入口实例
创建open part user exit
在用户点击“open”时创建新部件,在其中创建sphere
详细说明user exit设置文件过程
代码如下:
#include < >
#include <>
#include <>
#include <>
#include <>
#include <>
#include <>
#define UF_CALL(X) (report( __FILE__, __LINE__, #X, (X)))
static int report( char *file, int line, char *call, int irc)
{
if (irc)

nx二次开发习题及源码 来自淘豆网www.taodocs.com转载请标明出处.

非法内容举报中心
文档信息
  • 页数13
  • 收藏数0 收藏
  • 顶次数0
  • 上传人977562398
  • 文件大小2.45 MB
  • 时间2021-01-22
最近更新