SDK

The TonCut Plugin SDK is the package plugin developers build against. It contains the Pascal interface units, the C++ contract header, ready-to-open example projects, and Markdown manuals. This site documents that package.

Overview

The SDK is published on GitHub at codeton-software/toncut-plugin-sdk. Clone or download it, then start with:

  • README.md
  • include/pascal/ (the interface units; uITcPlugin.pas and uITonCut.pas first)
  • include/cpp/TonCutPluginSdk.hpp
  • examples/
  • manuals/

Every example follows the same host contract:

  1. Build a 32-bit (Win32) DLL with the extension .plg.
  2. Export TcpInitializeV2, create the plugin there, and call its Initialize; TonCut never does.
  3. Return the SDK's cEngineVersion from EngineVersion. TonCut loads every plugin but activates only an exact match; any other value is listed as Not compatible.
  4. Advertise only implemented features, and return a valid ITcPlotterInfo whenever a save flag such as is set.

The Quickstart walks through a complete plugin, and ABI & Marshalling lists the binary rules.

Units and headers

A Delphi plugin that implements ITcPlugin needs every unit its method signatures name, plus the units of the element interfaces it reads or writes:

SDK entry points

uses
  // Contract and common types
  uICommon,
  uITcPluginCommon,
  uITcPlugin,
  uITcPlotterInfo,
  uITcEnumExtensionsCallback,
  uITonCut,
  // Collections passed to LoadFile and SaveFile
  uIDevices,
  uIMaterials,
  uIBands,
  uIProjects,
  uIFormats,
  uISheets,
  // Elements of those collections
  uIDevice,
  uIMaterial,
  uIBand,
  uIProject,
  uIFormat,
  uISheet,
  // Results
  uISolution,
  uISolutionSheet,
  uISolutionFormats,
  uISolutionFormat,
  uISolutionWastes,
  uISolutionWaste,
  uISolutionCuts,
  uISolutionCut;

Add other units from include/pascal as you use their interfaces, for example uIShape for piece shapes or uITcAlgorithmData for algorithm data. Each reference entry links its unit.

TonCutPluginSdk.hpp declares the C++ view of the same contract in the toncut namespace. Its interfaces follow the Pascal vtable order exactly; interfaces it does not need stay opaque (IUnknown only). The C++ declarations in the reference follow the SDK's generated language-support manifest (tests/generated/language-support.json), and the site build fails when that manifest no longer matches the header.

SDK layout

DirectoryPurpose
include/pascal/The Pascal interface units: the source of truth for the contract
include/cpp/The C++ contract header, translated from the Pascal units
examples/shared/C++ starter code shared by the native examples, and the sample CSV file
examples/<language>/Buildable example projects
manuals/Developer documentation in Markdown

manuals/sdk-layout.md describes the layout in detail.

Manuals

  • manuals/getting-started.md
  • manuals/plugin-contract-and-abi.md
  • manuals/csv-schema.md
  • manuals/building-examples.md
  • manuals/support-by-language.md
  • manuals/public-contract-units.md

Example projects

Every example is the same CSV starter: CSV import and export of pieces and stock, and single-sheet result export either as PLT cutting paths or as a CSV sheet layout (the sheet, its placed pieces, and its waste).

  • Delphi: examples/delphi/CsvImportExport/CsvImportExport.dproj
  • VS C++: examples/msvc/CsvImportExport/CsvImportExport.sln
  • C++Builder (untested, provided as-is): examples/cppbuilder/CsvImportExport/CsvImportExport.cbproj
  • C# (native shim plus managed CSV code): examples/csharp/CsvImportExport/CsvImportExport.sln

The C++ starter logic shared by VS C++, C++Builder, and the C# native shim is in examples/shared/cpp/. The round-trip sample input is examples/shared/csv/example.csv.

Support levels

EnvironmentWhat the SDK provides
DelphiEvery interface, directly from the Pascal units. Full native starter.
VS C++The interfaces declared by TonCutPluginSdk.hpp, in Pascal vtable order; the reference marks every member with a C++ declaration. Native starter.
C++BuilderThe same C++ subset and starter. Never compiled or tested by the maintainers; provided as-is.
C#No managed projection of any TonCut interface. A C# plugin is a C++ native shim that owns TcpInitializeV2 and every interface; managed code can only do work that needs no TonCut interface. The example's managed part parses, validates, and writes CSV.

manuals/support-by-language.md describes the boundary of each language, and tests/generated/language-support.json records it member by member; the C++ declarations on this site follow that file.

Was this page helpful?