Drawings SDK Developer Guide > Working with .dwg Files > Working with Other File Formats > Working with Commands > Import and Export Commands
Import and Export Commands

You can use commands to import data of different formats to a drawing and to export a drawing to various formats.

Exporting to a .bmp file

To export a drawing or some part of it to a .bmp file, use the BMPOUT command (located at /Kernel/Exports/RasterExport). This module renders the drawing with a special graphic device, which is derived from the OdGsDevice class and provides a set of rendering properties listed in the following table.

Property name Default value Description
Export borders Active Layout This property specifies what to export. You can either export data from the active layout or the extents of the active layout or block.
Bits per pixel 24 Number of bits to define one pixel.
Bitmap width 2000 Output width.
Bitmap height 2000 Output height.
Plot generation On Enables or disables plot generation.
Image name Name of the output file.

Exporting to a .bmp file with a user-defined background color

To export a drawing with a specified background color to a .bmp file, use the BMPOUTBG command (located at /Kernel/Exports/RasterExport). This module renders the drawing with a special graphic device, which is derived from the OdGsDevice class and provides a set of rendering properties listed in the following table.

Property name Default value Description
Export borders Active Layout This property specifies what to export. You can either export data from the active layout or the extents of the active layout or block.
Bits per pixel 24 Number of bits to define one pixel.
Bitmap width 2000 Output width.
Bitmap height 2000 Output height.
Plot generation On Enables or disables plot generation.
Background R component 255 Specifies the R component of the RGB color model.
Background G component 255 Specifies the G component of the RGB color model.
Background B component 255 Specifies the B component of the RGB color model.
Image name Name of the output file.

Exporting to an .svg file

Drawings SDK supports exporting .dwg and .dxf files to SVG format (an .svg file). Use the SVGOUT command (located at /Kernel/Exports/SvgExport), which can export either a single viewport or a whole drawing to an .svg file and has the following properties.

Property name Default value Description
Line weight scale 1.0 Scale ratio that depends on the scale of the original .dwg file
Floating point precision 6 Number of digits in float values.
Image base Current location Path of the output file.
Image URL ./ Prefix to be added to the image name.
Default image extension .png Default image format.
Generic font family sans-serif Generic font family for the text that displays in the output file.
Output height 768 Height of the output file (in points).
Output width 1024 Width of the output file (in points).
Using the HLR Yes Specifies whether or not to use the hidden line removing algorithm.
Using the blended gradients Yes Specifies whether or not to use blended gradients for a complex gradient fill.

Importing a .dae (Collada) file

Drawings SDK supports importing a Collada file (.dae file) into a .dwg or .dxf file (more information about Collada is at http://opencollada.org/). Use the COLLADAIN command (located at /Drawing/Imports/ColladaImport), which has the following properties.

Property name Default value Description
Name Name of the file to be imported.
Using primitives No Property defines whether or not to use primitives for mapping of materials.
Console info Yes Property defines output information at the console.

Importing a .dwf file

Drawings SDK supports importing a .dwf file into a database, which can be saved as a .dwg or .dxf file. Use the DWFIN command (located at /Drawing/Imports/DwfImport), which has the following properties.

Property name Default value Description
Name Name of the file to be imported.
Password Password of the file
Paper width 297 Width of the paper.
Paper height 210 Height of the paper.
Preserving color indices Yes Specifies whether or not to preserve color indices.
Layout All Specifies which layout should be imported.
Importing 3D DWF (HSF) model No Specifies whether or not to import a 3D DWF (HSF) model.

See Also

Working with Commands

Overview of Commands

Copyright © 2002 – 2021. Open Design Alliance. All rights reserved.