文章转载自唐康林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的更多相关文章

  1. NX二次开发-UFUN修改当前导出CGM文件选项设置UF_CGM_set_session_export_options

    文章转载自唐康林NX二次开发论坛,原文出处: http://www.nxopen.cn/thread-126-1-1.html 刚才有同学问到这个问题,如果是用NXOpen来做,直接录制一下就可以了: ...

  2. NX二次开发-UFUN获取NX系统默认导出CGM的选项设置UF_CGM_ask_default_export_options

    文章转载自唐康林NX二次开发论坛,原文出处: http://www.nxopen.cn/thread-126-1-1.html 刚才有同学问到这个问题,如果是用NXOpen来做,直接录制一下就可以了: ...

  3. NX二次开发-UFUN获取环境变量路径,将环境变量转换为字符串,字符串拼接UF_translate_variable

    NX9+VS2012 #include <uf.h> UF_initialize(); //UFUN获取环境变量路径 //将环境变量转换为字符串 char* GetName = NULL; ...

  4. NX二次开发-UFUN获取系统相关信息UF_ask_system_info

    NX9+VS2012 #include <uf.h> UF_initialize(); UF_system_info_t Info; UF_ask_system_info(&Inf ...

  5. NX二次开发-UFUN获取当前所在的模块UF_ask_application_module

    NX9+VS2012 #include <uf.h> #include <NXOpen/UI.hxx> #include <NXOpen/MenuBar_MenuBarM ...

  6. NX二次开发-UFUN获取显示在NX交互界面的对象UF_OBJ_is_displayable

    NX9+VS2012 #include <uf.h> #include <uf_disp.h> #include <uf_obj.h> #include <u ...

  7. NX二次开发-UFUN获取边的端点UF_MODL_ask_edge_verts

    NX9+VS2012 #include <uf.h> #include <uf_modl.h> #include <uf_ui.h> #include <uf ...

  8. NX二次开发-UFUN获取直线的两个端点UF_CURVE_ask_line_data

    NX9+VS2012 #include <uf.h> #include <uf_obj.h> #include <uf_ui.h> UF_initialize(); ...

  9. NX二次开发-UFUN获取工程图的数量和tag UF_DRAW_ask_drawings

    NX9+VS2012 #include <uf.h> #include <uf_draw.h> #include <uf_part.h> #include < ...

随机推荐

  1. Python模块和模块引用(一)

    """ import my_module as mm courses = ['History','Math','Physics','CompSci'] index = m ...

  2. Table边框合并

    <style> table, table tr th, table tr td { border: 1px solid #0094ff; } table { width: 200px; m ...

  3. leetcode-162周赛-1253-重构二进制矩阵

    题目描述: 自己的提交: class Solution: def reconstructMatrix(self, upper: int, lower: int, colsum: List[int]) ...

  4. Java 基础 - System.arraycopy() 浅拷贝 深拷贝

    ref: https://blog.csdn.net/balsamspear/article/details/85069207 https://blog.csdn.net/balsamspear/ar ...

  5. clickhouse高可用-节点宕机数据一致性方案-热扩容

    1. 集群节点及服务分配 说明: 1.1. 在每个节点上启动两个clickhouse服务(后面会详细介绍如何操作这一步),一个数据分片,一个数据备份,为了确保宕机数据一致性,数据分片和数据备份不能同一 ...

  6. 遍历实例化swiper

    var list = $('.p04-s2 li'); list.each(function (index) { new Swiper ($(this).find('.swiper-container ...

  7. 使用raise语句抛出异常

    #_author:来童星#date:2019/12/18def division(): num1=int(input('请输入被除数:')) num2=int(input('请输入除数:')) if ...

  8. Delphi Close、Halt、terminate、ExitProcess的区别

    Close:1.只关闭本窗体2.当Close是一个主窗体时,程序会退出.3.Close会发生FormClose事件,FormCloseQuery事件4.主窗体close以后程序就Application ...

  9. bzoj1066题解

    [解题思路] 考虑拆点,把每根石柱拆成两个点,具体可以理解为石柱底部和石柱顶部,能爬到石柱顶部的蜥蜴只有有限只,而且蜥蜴只有爬到了石柱顶部才能跳到其他石柱的底部. 这样,考虑如下建图: 将每个有蜥蜴的 ...

  10. (转)OpenFire源码学习之二:Mina基础知识

    转:http://blog.csdn.net/huwenfeng_2011/article/details/43413009 Mina概述 Apache MINA(Multipurpose Infra ...