Close

Relief for ODA Team in Ukraine

Learn more
ODA Drawings SDK
Extracting Text from a Drawing File

Summary

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

Description

OdExtractTextEx extracts text content from a drawing file to the command prompt window (or redirects to a file).

It illustrates:

  • Drawings SDK initialization.
  • File loading into a database.
  • Parsing of a loaded database.
  • Switching on entity types using protocol extensions.
  • Assert function customization.

Run Sample Application

To run the OdExtractTextEx 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:
    OdExtractTextEx <filename>
filename A full path to a drawing file to extract text content from. The extension of the drawing file should be .dwg, .dxf or .dxb.

If the application executed properly, you will see the list of objects that contain text, and extracted text content for each of them. If no such objects are found in the source drawing file, you will see general information about the application and a message informing you that the parsing process has been finished successfully. 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.