ODA Product: | Drawings SDK |
Sample Name: | OdSvgExportEx |
Categories: | C++ / Working with .dwg files / Android, iOS, macOS, Linux, Windows |
Location: | <INSTALL_DIR>/Drawings/Examples/OdSvgExportEx |
OdSvgExportEx is a simple console application used for reading a .dwg or .dxf file and saving it to an .svg file. It illustrates the usage of Kernel/Exports/SvgExport functionality.
To run the OdSvgExportEx sample application, please do the following:
<INSTALL_DIR>\exe\<PLATFORM_NAME>\
<INSTALL_DIR>/bin/<PLATFORM_NAME>/
<INSTALL_DIR>
is a directory where you unpacked the
Drawings SDK archive.<PLATFORM_NAME>
parameter, please see
the ODA Platform Naming Conventions section in the
Downloading Drawings SDK topic.
OdSvgExportEx <source file> <target file>
source file
|
A full path to a .dwg or .dxf file to read data from. |
target file
|
A full path to an .svg file to write data to. |
If the application executed properly, you will see the source file loading progress and a message, informing that the database conversion is finished. In case you get the "usage" message, check the parameters. An error message indicates problems with the source file.
The application reads the specified input .dwg or .dxf file, creates a drawing database, sets export parameters and then exports the database to the specified output (.svg) file.
Export functionality is implemented through an instance of the OdGsDevice class, which renders the content of the drawing database into SVG XML structure.
A full list of .svg export parameters can be found in the Exporting to an SVG File topic of the Developer's Guide.
The source code of the example can be reviewed in the <INSTALL_DIR>/Drawing/Examples/OdSvgExportEx/OdSvgExportEx.cpp file. This file contains:
main()
function. The main()
function checks input arguments, creates a custom services instance
(a MyServices object), initializes the Drawings SDK libraries and then runs the export
procedure:
If an error occurs, the application generates an error message and prints it to the console.
Using the Sample Code
Exporting to an SVG File
Copyright © 2002 – 2020. Open Design Alliance. All rights reserved.
|