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

 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文件

上一篇:NX二次开发-UFUN拾取平面对话框UF_UI_specify_plane


下一篇:NX二次开发-UFUN遍历函数UF_OBJ_cycle_all