NX二次开发-UFUN获取当前导出CGM选项设置UF_CGM_ask_session_export_options
文章转载自唐康林NX二次开发论坛,原文出处: http://www.nxopen.cn/thread-126-1-1.html 刚才有同学问到这个问题,如果是用NXOpen来做,直接录制一下就可以了;
在UFUN里面没有直接的函数;
思路就是:
、先将工程图转换为cgm
、调用系统的cgm2pdf.exe工具,将上一步转换的cgm再转成PDF格式;
以下是我写的一个例子。大家可以拿一个工程图测试以下代码,最后会在C盘生成tkl.cgm与tkl.pdf两个文件。 #include <uf.h>
#include <uf_draw.h>
#include <uf_cgm.h>
#include <windows.h> UF_initialize(); tag_t drawing_tag = NULL_TAG;
UF_DRAW_ask_current_drawing(&drawing_tag); if (drawing_tag != NULL_TAG)
{
UF_CGM_export_options_t export_options;
UF_CGM_ask_default_export_options(&export_options);
//UF_CGM_ask_session_export_options(&export_options);//用这个函数也可以初始化
export_options.reason = UF_CGM_pdf_reason;
UF_CGM_set_session_export_options(&export_options); char outFilePath[UF_CFI_MAX_FILE_NAME_BUFSIZE] = "c:\\tkl.cgm";
UF_CGM_export_cgm(drawing_tag, &export_options, outFilePath); //导出成CGM文件 //将CGM转换成PDF
char outPdfFilePath[UF_CFI_MAX_FILE_NAME_BUFSIZE] = "c:\\tkl.pdf";
NXOpen::NXString nxbasedir = theSession->GetEnvironmentVariableValue("UGII_BASE_DIR");//获取NX主目录
std::ostringstream tempstring;
tempstring << nxbasedir.GetLocaleText() << "\\NXPLOT\\bin\\pdf\\cgm2pdf.exe " << outFilePath << " " << outPdfFilePath;
std::string covertvalule = tempstring.str();
WinExec(covertvalule.c_str(), SW_HIDE); //打开PDF转换器,并转换
tempstring.str("");
tempstring.clear();
} UF_terminate();

NX二次开发-UFUN获取当前导出CGM选项设置UF_CGM_ask_session_export_options的更多相关文章
- NX二次开发-UFUN修改当前导出CGM文件选项设置UF_CGM_set_session_export_options
文章转载自唐康林NX二次开发论坛,原文出处: http://www.nxopen.cn/thread-126-1-1.html 刚才有同学问到这个问题,如果是用NXOpen来做,直接录制一下就可以了: ...
- NX二次开发-UFUN获取NX系统默认导出CGM的选项设置UF_CGM_ask_default_export_options
文章转载自唐康林NX二次开发论坛,原文出处: http://www.nxopen.cn/thread-126-1-1.html 刚才有同学问到这个问题,如果是用NXOpen来做,直接录制一下就可以了: ...
- NX二次开发-UFUN获取环境变量路径,将环境变量转换为字符串,字符串拼接UF_translate_variable
NX9+VS2012 #include <uf.h> UF_initialize(); //UFUN获取环境变量路径 //将环境变量转换为字符串 char* GetName = NULL; ...
- NX二次开发-UFUN获取系统相关信息UF_ask_system_info
NX9+VS2012 #include <uf.h> UF_initialize(); UF_system_info_t Info; UF_ask_system_info(&Inf ...
- NX二次开发-UFUN获取当前所在的模块UF_ask_application_module
NX9+VS2012 #include <uf.h> #include <NXOpen/UI.hxx> #include <NXOpen/MenuBar_MenuBarM ...
- NX二次开发-UFUN获取显示在NX交互界面的对象UF_OBJ_is_displayable
NX9+VS2012 #include <uf.h> #include <uf_disp.h> #include <uf_obj.h> #include <u ...
- NX二次开发-UFUN获取边的端点UF_MODL_ask_edge_verts
NX9+VS2012 #include <uf.h> #include <uf_modl.h> #include <uf_ui.h> #include <uf ...
- NX二次开发-UFUN获取直线的两个端点UF_CURVE_ask_line_data
NX9+VS2012 #include <uf.h> #include <uf_obj.h> #include <uf_ui.h> UF_initialize(); ...
- NX二次开发-UFUN获取工程图的数量和tag UF_DRAW_ask_drawings
NX9+VS2012 #include <uf.h> #include <uf_draw.h> #include <uf_part.h> #include < ...
随机推荐
- Python常用三方库安装
//首先更新pip python -m pip install --upgrade pip //一个类似Matlab的Plot绘制数据图的库. python -m pip install matplo ...
- macOS免费的NTFS读写软件
Mounty for Mac brew cask install mounty
- 【leetcode】133. Clone Graph
题目如下: Given the head of a graph, return a deep copy (clone) of the graph. Each node in the graph con ...
- Java 基础 - System.arraycopy() 浅拷贝 深拷贝
ref: https://blog.csdn.net/balsamspear/article/details/85069207 https://blog.csdn.net/balsamspear/ar ...
- vue项目base64转img
最近一个vue项目中,有个需求是, 发送消息是base64时,转换成图片预览发送出去. 输入框: <el-input class="input-box" ref=" ...
- RzGroupBar
何分多层 procedure TForm1.FormCreate(Sender: TObject); begin RzGroup1.Items.Clear; RzGroup1.Items.Add.Ca ...
- LINIX上Nginx的从零安装
源码编译方式: #一般系统中已经装了了make和g++,无须再装 安装make: yum -y install autoconf automake make 安装g++: yum -y install ...
- libvert开启TCP监听
1.设置libvirtd 编辑/etc/libvirt/libvirtd.conf listen_tls = 0 listen_tcp = 1 auth_tcp="none" tc ...
- 1.5 React 与 DOM
在这一节中,主要的讨论范围为 React 与 DOM 相关的处理,包括: 如何获取 DOM 元素 如何做事件响应处理 表单处理 style 属性 这节讲述过后,我们将会为 TODO 应用添加完整的事件 ...
- C++变长参数
如果C++的变长参数经过了多轮的调用,就可能失去作用 间接引址,但是只能引用到第一个变长参数. va_list marker; va_start(marker, format); s_logger ...