Getting Started with Teigha Civil using a Simple Test Application

Artem Chilin

June 06, 2017

It’s easy to start exploring Teigha Civil using a simple console application named TCTest. Using it, you can see how Teigha Civil opens, saves, and renders files, and more.

Running TCTest

TCTest is located in the Civil\Tests\TCTest folder.
To run it:
TCTest script - BATCH "command[,...]" INPUT_FILE <inputFile> OUTPUT_FILE <outputFile>
For example:
TCTest script - BATCH "load,render" INPUT_FILE 1.dwg OUTPUT_FILE 1.bmp
The result is displayed in the console.

Most useful TCTest commands

  • load — Loads a file.
  • MTLoad — Loads a file in multithreaded mode (same as «MT Open» in OdaMfcApp).
  • partialLoad — Loads a file in partial loading mode (same as «Partial Open» in OdaMfcApp).
  • saveCurrentVer — Saves a file to the latest version supported by Teigha Civil. Useful for testing successful saves (no corruption) or updating your dataset to the latest file version.
  • render – Renders a drawing and creates a bitmap file as OUTPUT_FILE. Useful for testing rendering without OdaMFCApp or Teigha Viewer. The resulting bitmaps can be compared with an external tool.
  • enableZoomExtens /disableZoomExtens — Sets zoomExtents mode for rendering.
  • explodeToPrimitives / explodeTree — Tests correctness of explode
  • transformObjects — Tests correctness of the transformation of civil entities.
  • dump — Prints to the console information about a file and its structure (header, layers, linetypes, regApps, etc.).

To see the list of all TCTest commands, run TCTest without parameters.