Close

Relief for ODA Team in Ukraine

Learn more
ODA Drawings SDK
Creating a Drawing File

Summary

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

Description

OdWriteEx creates a new drawing, populates it with various entities, and saves to a file.

It illustrates:

  • Creating various entities and objects.
  • Freezing local time to create drawings with the same creation/modification time (useful for comparing created drawings while testing).
  • Providing a bitmap device for drawing preview creation.
  • Using a custom AuditInfo object to save audit messages to a file.
  • Using support files (fonts, etc.) from a third party, if available.
  • Saving a password-protected file.
  • Assert function customization.

Run Sample Application

To run the OdWriteEx 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:
    OdWriteEx <filename> [<OutVer>] [<OutType>] [-DO] [-NoWait] [UseUnloadPaging|UseFilePaging]
filename A a newly created drawing file's full path. Must be a name of the saved drawing file with an extension that is equal to OutType or .dwg if OutType is not specified.
OutVer Version of the created drawing file. Can be one of the following:
  • ACAD12
  • ACAD13
  • ACAD14
  • ACAD2000
  • ACAD2004
  • ACAD2007
  • ACAD2010
  • ACAD2013
  • ACAD2018
By default, the latest supported version is used.
OutType A newly created drawing file's type. Can be one of the following:
  • DWG
  • DXF
  • DXB (binary DXF)
By default, the DWG type is used.
-DO Disables progress meter output.
-NoWait Disables pressing ENTER key prompt after the execution.
UseUnloadPaging|UseFilePaging Set paging type. To use the [UseUnloadPaging | UseFilePaging] parameter, OutVer and OutType must be specified.

If the application executed properly, you will see the database populating progress and the saving to the output file process. In case you get the "usage" message, check the parameters. An error message indicates problems with the source file.

See also:

Using the Sample Code

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