码迷,mamicode.com
首页 > 其他好文 > 详细

NX二次开发-NXOPEN将工程图转成PDF文件

时间:2019-05-31 21:34:45      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:des   ima   amp   mamicode   spl   tor   nsca   on()   sdi   

 1 NX9+VS2012
 2 
 3 #include <uf.h>
 4 #include <uf_draw.h>
 5 #include <NXOpen/PrintPDFBuilder.hxx>
 6 #include <NXOpen/Drawings_DrawingSheet.hxx>
 7 #include <NXOpen/NXObjectManager.hxx>
 8 #include <NXOpen/PlotManager.hxx>
 9 #include <NXOpen/Part.hxx>
10 #include <NXOpen/PartCollection.hxx>
11 #include <NXOpen/Session.hxx>
12 
13 
14 Session *theSession = Session::GetSession();
15 Part *workPart(theSession->Parts()->Work());
16 Part *displayPart(theSession->Parts()->Display());
17 
18 UF_initialize();
19 
20 tag_t drawing_tag = NULL_TAG;
21 UF_DRAW_ask_current_drawing(&drawing_tag);
22 
23 if (drawing_tag != NULL_TAG)
24 {
25     PrintPDFBuilder *printPDFBuilder1;
26     printPDFBuilder1 = workPart->PlotManager()->CreatePrintPdfbuilder();
27 
28     printPDFBuilder1->SetColors(PrintPDFBuilder::ColorAsDisplayed);
29     printPDFBuilder1->SetWidths(PrintPDFBuilder::WidthStandardWidths);
30     printPDFBuilder1->SetSize(PrintPDFBuilder::SizeOptionScaleFactor);
31     printPDFBuilder1->SetScale(1.0);
32     printPDFBuilder1->SetOutputText(PrintPDFBuilder::OutputTextOptionPolylines);
33     printPDFBuilder1->SetUnits(PrintPDFBuilder::UnitsOptionMetric);
34 
35     std::vector<NXObject *> sheets1(1);
36     Drawings::DrawingSheet *drawingSheet1(dynamic_cast<Drawings::DrawingSheet *>(NXOpen::NXObjectManager::Get(drawing_tag)));
37     sheets1[0] = drawingSheet1;
38     printPDFBuilder1->SourceBuilder()->SetSheets(sheets1);
39     printPDFBuilder1->SetFilename("D:\\11111.pdf");
40 
41     NXObject *nXObject1;
42     nXObject1 = printPDFBuilder1->Commit();
43     printPDFBuilder1->Destroy();
44 }
45 
46 UF_terminate();

技术图片

NX二次开发-NXOPEN将工程图转成PDF文件

标签:des   ima   amp   mamicode   spl   tor   nsca   on()   sdi   

原文地址:https://www.cnblogs.com/nxopen2018/p/10957494.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!