这是UFUN帮助的官方例子

 /******************************************************************************
Copyright (c) 1999 Unigraphics Solutions, Inc.
Unpublished - All Rights Reserved *******************************************************************************/
/* The following example demonstrates how to invoke
UF_UI_open_part. */
/* ***** Include Files ***** */
#include <stdio.h>
#include <string.h>
#include <uf.h>
#include <uf_part.h>
#include <uf_ui.h>
/* ***** Local Prototype ***** */
static logical my_error_handler
(
UF_UI_err_data_p_t error_fn_data,
char *file_name,
int error,
UF_PART_load_status_t *error_status,
logical *skip_error_disp
);
/* ***** Entry Point ***** */
/*ARGSUSED*/
extern void ufusr(char *param, int *ret_code, int len)
{
/*
*********************
variable declarations
*********************
*/
int response;
tag_t part_tag = NULL_TAG;
char file_name[MAX_FSPEC_SIZE + ] = "flange.prt";
const char *message = "part open error";
logical use_display_file = FALSE;
UF_PART_load_status_t part_status;
UF_UI_err_t error_handler; /*
************************************************
initialize the 'struct' as an open part 'struct'
and assign the local function prototyped above
as the callback
************************************************
*/
error_handler.type = UF_UI_open_part_fun;
error_handler.fun.open = my_error_handler;
/*
************************************************
assign the client data and its size
Note: this is an arbitrary usage of the client
data. A better use might be to pass the name of
a UIStyler dialog which would then be invoked in
the callback
************************************************
*/
error_handler.fun_data.size = strlen(message) + ;
error_handler.fun_data.data = message;
/*
*************************************************
call the function, free any allocated memory
*************************************************
*/
UF_initialize();
UF_UI_open_part(&error_handler, file_name,
&use_display_file,
&part_tag, &response, &part_status);
if (part_status.statuses != NULL)
{
UF_free(part_status.statuses);
}
if (part_status.file_names != NULL)
{
UF_free_string_array(part_status.n_parts,
part_status.file_names);
}
UF_terminate();
}
/* ***** local function to be invoked as a callback ***** */
static logical my_error_handler
(
UF_UI_err_data_p_t error_fn_data,
char *file_name,
int error,
UF_PART_load_status_t *error_status,
logical *skip_error_disp
)
{
/*
***************************************************
this function trivially just prints the client data
that it receives as well as the file name and the
error
As mentioned above, a better usage of the client
data would be to pass through the name of a
UIStyler dialog to display. Such a use might
resemble the following:
UF_STYLER_create_dialog (
( char * ) error_fn_data->data ,
callbacks ,
n_callbacks ,
NULL ,
&response );
***************************************************
*/
fprintf(stderr, "my_error_handler called with:\n"
" error_fn_data->size = %d\n"
" error_fn_data->data = %s\n"
" file_name = %s\n"
" error = %d\n",
error_fn_data->size,
(const char *)error_fn_data->data,
file_name,
error
);
/* **************************************************
instruct NX to display its error dialog and to
continue looping within the dialog until a part
is opened
**************************************************
*/
*skip_error_disp = TRUE;
return TRUE;
}

NX二次开发-打开part对话框UF_UI_open_part的更多相关文章

  1. NX二次开发-打开文件夹,并同时选中指定文件

    NX9+VS2012 #include <uf.h> #include <uf_ui.h> #include <uf_part.h> #include <at ...

  2. NX二次开发-UFUN特征选择对话框UF_UI_select_feature

    #include <uf.h> #include <uf_ui.h> UF_initialize(); //特征选择对话框 char sMessage[] = "特征 ...

  3. NX二次开发-打开弹出当前part所在的文件夹

    #include <uf.h> #include <uf_part.h> #include <atlstr.h> #include <iostream> ...

  4. NX二次开发-使用MFC对话框不能用UF_UI_select等函数解决方法

    VC/MFC调用UG Dialog要进入加锁状态 加锁 UF_UI_lock_ug_access ( UF_UI_FROM_CUSTOM ); 此处为UF_UI_select的函数 解锁 UF_UI_ ...

  5. NX二次开发-uc1600字符串对话框

    NX9+VS2012 #include <uf.h> #include <uf_ui.h> UF_initialize(); char* cue = "输入框&quo ...

  6. NX二次开发-基于MFC界面对话框与NX交互的开发

    打开VS2013 点击新建,选择MFC DLL 点击确定 点下一步 什么都不改,直接点完成 进来之后先编译一下,看是否编译成功 打开项目属性,更改这几处 $(UGII_BASE_DIR)\ugopen ...

  7. NX二次开发-BlockUI对话框嵌套MFC对话框制作进度条

    半年前在一些QQ群看到有大神NX二次开发做出了进度条,那个时候我还不会弄,也不知道怎么弄得,后来断断续续得研究了一下,直到今天我把它做出来了.内心还是很喜悦的!回想自己这两年当初从没公司肯给我做NX二 ...

  8. NX二次开发-基于MFC界面的NX对Excel读写操作(OLE方式(COM组件))

    NX二次开发API里没有对EXCAL读写操作的相关函数,市面上有很多种方法去实现,比如UFUN调KF,ODBC,OLE(COM组件)等等.这里我是用的OLE(COM组件)方式去做的,这种在VC上创建的 ...

  9. NX二次开发-UDO用户自定义对象(UFUN)【持续完善】

    每当提起UDO总是会让我想起大专毕业那会失业找工作,后来有个宝贵机会去了软件公司上班,拿到了我人生中的第一个NX二次开发项目,一个关于测量汽车前后左右摄像头的项目.当时那个项目就用到了UDO,对于只看 ...

随机推荐

  1. 【Movist Pro】macOS上的绝佳媒体播放器

    Movist Pro是适用于Mac的高性能电影播放器,如果比较流程和界面,则Movist与QuickTime非常相似.因此,采用播放器几乎不会有任何问题.使用Quicktime或FFmpeg解码电影并 ...

  2. apue第4章习题

    4.1 用 stat 函数替换图 4-3 程序中的 lstat函数,如若命令行残数之一是符号链接,会发生什么变化? stat不支持链接,如果有参数是链接符号,会显示链接后的文件属性. 4.2 如果文件 ...

  3. 网关协议:CGI和WSGI

    通常服务器程序分为web服务器和应用程序服务器.web服务器是用于处理HTML文件,让客户可以通过浏览器进行访问,主流的web服务器有Apache.IIS.Nginx.lighthttpd等.应用服务 ...

  4. vue2 开发总结

    vue-cli学习资料: http://m.php.cn/article/394750.html  或 https://www.cnblogs.com/zhanglin123/p/9270051.ht ...

  5. [bzoj2839]集合计数 题解 (组合数+容斥)

    Description 一个有N个元素的集合有2^N个不同子集(包含空集),现在要在这2^N个集合中取出若干集合(至少一个),使得 它们的交集的元素个数为K,求取法的方案数,答案模1000000007 ...

  6. 剑指offer---1、顺时针打印矩阵

    剑指offer---1.顺时针打印矩阵 一.总结 一句话总结: 谋而后动+多做:还是要谋而后动,但是怎么谋而后动,很有学问,做好的方式就是多做 问题就这些问题:解决了就好了,比如php多维数组 面试的 ...

  7. java 轻量级 RestClient

    package org.rx.socks.http; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; ...

  8. Java-Class-C:org.springframework.util.Assert

    ylbtech-Java-Class-C:org.springframework.util.Assert 1.返回顶部   2.返回顶部   3.返回顶部   4.返回顶部 1. /* * Copyr ...

  9. 9.3.1 The assign and deassign procedural statements

    IEEE Std 1364™-2001, IEEE Standard Verilog® Hardware Description Language The assign procedural cont ...

  10. 使用Netfilter进行数据包分析

    #include <linux/init.h>#include <linux/module.h>#include <linux/skbuff.h>#include ...