Skip to content

Working with HDevEngineπŸ”—

As the name suggests, HDevEngine is the β€œengine” behind HDevelop. It allows you to execute complete HDevelop programs or individual procedures from a C++ or .NET application, and also from Python.

HDevEngine loads HDevelop code dynamically, which makes it possible to update the machine-vision part of an application without recompiling and relinking the application as long as the procedure signature is unchanged. This keeps the algorithm in HDevelop files while the surrounding application logic stays in C++, .NET, or Python.

What HDevEngine can doπŸ”—

HDevEngine can:

  • Execute complete HDevelop programs
  • Execute local or external HDevelop procedures
  • Use the same HDevelop logic for prototyping and production
  • Keep the HDevelop implementation separate from the surrounding application code
  • Provide an application-specific implementation of internal dev_* operators

What HDevEngine does not doπŸ”—

HDevEngine does not implement the full HDevelop user interface or all internal display operators. In particular, it does not provide the complete visualization environment of HDevelop; operators such as dev_display must be redirected to your own implementation in the application. This gives you precise control over where and how results are displayed.

Main conceptsπŸ”—

The HDevEngine concepts are the same regardless of the host language:

  • A program is loaded as an HDevProgram and executed via an HDevProgramCall.
  • A procedure is loaded as an HDevProcedure and executed via an HDevProcedureCall.
  • The procedure path controls which HDevelop files are found.
  • Engine settings and operator implementations are managed globally.
  • Errors are reported via clHDevEngineExceptionName (C++/C#) or the equivalent Python exception.

Main classesπŸ”—

The core classes are:

  • clHDevEngineName
  • clHDevProgramName
  • clHDevProgramCallName
  • clHDevProcedureName
  • clHDevProcedureCallName
  • clHDevOperatorImplName
  • clHDevEngineExceptionName

For a detailed overview, see About the main classes and methods of HDevEngine.

Typical application flowπŸ”—

The typical workflow is:

  1. Configure the engine and the procedure path.
  2. Load the HDevelop program or procedure.
  3. Create the matching call object.
  4. Set input parameters.
  5. Execute the program or procedure.
  6. Read output parameters and handle exceptions.

This is described in Creating an application with HDevEngine and in the example program.

Parallel programming and debuggingπŸ”—

HDevEngine is designed to be reentrant and thread-safe in the sense that multiple call instances can exist concurrently. However, global configuration such as the procedure path and the registered operator implementation is shared. For this reason, configure and load programs or procedures before parallel application threads are started, and synchronize access when shared state is modified.

For remote debugging, the engine can expose a debug server that can be attached from HDevelop. This is useful when debugging embedded HDevelop logic in a larger application.

.NET interfaceπŸ”—

The .NET interface follows the same concepts as the C++ and Python APIs. It is described in HDevEngine in .NET applications.

Python interfaceπŸ”—

The Python interface follows the same concepts as the C++ and .NET APIs. It is described in HDevEngine in Python applications.