You can export 3D entities to the 3D PDF format (PRC format) using the
PRCMode()
and setPRCMode()
methods of the PDFExportParams
class.
The value returned by PRCMode()
or passed to setPRCMode()
is a value of the PRCSupport
enumeration:
kDisabled (0)
— Export to PRC is disabled.
kAsBrep (1)
— Export to PRC is supported as a B-Rep.
kAsMesh (2)
— Export to PRC is supported as a mesh.
Note that you cannot turn on PRC support mode and use hidden lines removal algorithm (HLR) at the same time.
PRC data can be exported using a compression algorithm. To set the compression level, use the
setPRCCompression()
method. This method accepts three parameters:
compressionLevel
—
Determines what kind of compression algorithm is applied during the export process.
bCompressBrep
— A flag that controls compression of B-Rep data.
If the value is equal to true, the data is compressed.
bCompressTessellation
— A flag that controls compression of tessellation data.
If the value is equal to true, the data is compressed.
The compression level parameter can be one of the following values:
kA3DLooseCompression (0)
— Compression with 0.001 mm tolerance.
kA3DMeddiumCompression (1)
— Compression with 0.01 mm tolerance.
kA3DHighCompression (2)
— Compression with 0.1 mm tolerance.
To get the current state of the compression option for PRC data, use the
PRCCompression()
method.
Note that this method doesn't return compression flags for B-Rep and tessellation data. It returns only the current compression level value. Therefore, be sure to set the B-Rep and (or) tessellation flags to the appropriate values before executing the export process.
To check whether the compression algorithm is used for B-Rep and tessellation data,
use the hasPrcBrepCompression()
and hasPrcTessellationCompression()
methods
of the PDFExportParams
class respectively.
A PRC export context is represented by the OdPrcContextForPdfExport
class,
derived from OdRxObject
. This class contains:
shouldExportAsPRC()
, which determines whether a specified graphical object should be rendered
as .prc data in the output PDF file. Default implementation returns false.
The OdPrcContextForPdfExport
class is declared and defined in
/Kernel/Exports/PdfExport/Include/PrcContextForPdfExport.h
.
ODA Platform provides several types of PRC contexts, as described in the following table.
PRC Context Name | Function for Creating Context | Description |
---|---|---|
OdPrcContextForPdfExport_AllInSingleView
|
odCreatePrcAllInSingleViewContextForTD()
|
Single view: exports all entities located in one view of a drawing database into a .prc stream of the output PDF file. |
OdPrcContextForPdfExport_OnlySolidsMultiView
|
odCreatePrcOnlySolidsMultiViewContextForTD()
|
One view per solid entity: exports each solid entity located in an individual view into a .prc stream of the output PDF file; 2D geometry is exported into PDF content. |
OdPrcContextForPdfExport_OnlySolidsSingleView
|
odCreatePrcOnlySolidsSingleViewContextForTD()
|
Single view for solids: exports all solid entities located in one view into a .prc stream of the output PDF file. 2D geometry is exported into PDF content. |
OdPrcContextForPdfExport_Default
|
odCreatePrcDefaultContextForTD()
|
One view per entity: exports each entity located in an individual view into a .prc stream of the output PDF file. |
OdPrcContextForPdfExport_AllInSingleView_DGN
|
odCreatePrcAllInSingleViewContextForDGN()
|
One view per entity (for .dgn files): exports all entities located in one view of a drawing database into a .prc stream of the output PDF file. |
Functions for .dwg drawings are defined in the
/Prc/Export/PrcExport/Include/PrcContextForPdfExportImpl.h
header file.
Functions for .dgn drawings are defined in the
/Prc/Export/Dgn2PrcExport/Include/PrcContextForPdfExportImpl.h
header file.
Each type of PRC context is implemented as a successor of the OdPrcContextForPdfExport
class. Each PRC context sub-class has its own implementation of the shouldExportAsPRC()
method to define whether an entity should be exported into a .prc stream and
to determine the viewport's index for it. PRC context sub-classes are registered
in the ODA environment while creating an instance of PrcExportModule
(for
.dwg files) or OdDgn2PrcExportModule
(for .dgn files).
To get the current PRC context containing user PRC data that should be used
for the export process, call the getPRCContext()
method. To set a new PRC context, use the setPRCContext()
method.
PDF export functionality allows you to set a background color for PRC data created within the export process.
By default, PRC data has a white background color. To set a new background color, use the setPrcBackground()
method of the PDFExportParams
class.
The PDFExportParams
class also provides methods that allow managing the background color:
hasPrcBackground()
— Determines whether the PRC data has a background color that differs from the default value (white).
getPrcBackground()
— Retrieves the currently applied PRC background color.
clearPrcBackground()
— Changes the current PRC background color to the default value (white).
Note: According to ISO standards, the PDF/A format is not compatible with the PRC format. Therefore, if both modes (PRC and PDF/A support) are switched on, an exInternalError occurs. See Export to PDF/A Format section for details about exporting with PDF/A support.
Export to PDF Parameters and Flags
Copyright © 2002 – 2021. Open Design Alliance. All rights reserved.
|