Close

Relief for ODA Team in Ukraine

Learn more
ODA Drawings SDK
Saving a Database

You can save a created database to the file system as a .dwg file using the OdDbDatabase::writeFile() method:


void OdDbDatabase::writeFile(OdStreamBuf* pStreamBuf, OdDb::SaveType fileType, OdDb::DwgVersion fileVersion, bool saveThumbnailImage = false, int dxfPrecision = 16); 

void OdDbDatabase::writeFile(const OdString& filename, OdDb::SaveType fileType, OdDb::DwgVersion fileVersion, bool saveThumbnailImage = false, int dxfPrecision = 16);

The first signature writes the contents of this database object to the file with a given filename. The second signature writes the content to the specified stream buffer.

Using the fileType parameter you can set the type of the file to be written:

  • OdDb::kDwg — .dwg file
  • OdDb::kDxf — .dxf file
  • OdDb::kDxb — binary .dxf file

If you are saving a database to a .dwg file, you can set the specific file version using the fileVersion parameter of the method. The list of possible formats is defined by the OdDb::DwgVersion enumeration.

For example, to save the database in a .dwg file of the 2010 version, with the "drawing.dwg" name:


pDb->writeFile("drawing.dwg", OdDb::kDwg, OdDb::vAC24);

 

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