Close

Relief for ODA Team in Ukraine

Learn more
ODA Drawings SDK
Converting a Drawing File to a New Type and Version

Summary

ODA Product: Drawings SDK
Sample Name: OdCopyEx
Categories: C++ / Beginner Developer / Working with .dwg files / Android, iOS, macOS, Linux, Windows, WinCE, WinRT
Location: <INSTALL_DIR>/Drawing/Examples/OdCopyEx

Description

OdCopyEx reads a drawing file and saves it as a new .dwg, .dxf, or .dxb file. It illustrates:
  • Drawings SDK initialization.
  • File loading into a database.
  • Auditing of a loaded database.
  • Saving a database to a specified file version and type.
  • Assert function customization.

Run Sample Application

To run the OdCopyEx sample application, please do the following:

  1. Open the terminal and go to the directory where the sample binary file is built:
    • For Windows: <INSTALL_DIR>\exe\<PLATFORM_NAME>\
    • For Non-Windows OS: <INSTALL_DIR>/bin/<PLATFORM_NAME>/
    <INSTALL_DIR> is a directory where you unpacked the Drawings SDK archive.
    To determine your <PLATFORM_NAME> parameter, please see the ODA Platform Naming Conventions section in the Downloading Drawings SDK topic.
  2. Run the sample with appropriate arguments:
    OdCopyEx <source file> <target file> [OutVer] [OutType]
source file Full path to the source file.
target file Full path to the destination file.
OutVer A destination file version. Can be any of:
  • ACAD9
  • ACAD10 (DXF and DXB only)
  • ACAD12
  • ACAD13
  • ACAD14
  • ACAD2000
  • ACAD2004
  • ACAD2007
  • ACAD2010
  • ACAD2013
  • ACAD2018

The default value corresponds to the latest supported version.

OutType A destination file type. Can be any of:
  • DWG
  • DXF
  • DXB (binary DXF)

The default value is DWG.

If the application executed properly, you will see the progress of database conversion and saving the result to the output file. In case you get the "usage" message, check the parameters. An error message indicates problems with the source file or target file type and version incompatibility.

See also:

Using the Sample Code
Copyright © 2002 – 2022. Open Design Alliance. All rights reserved.