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.mdinclude/pascal/(the interface units;uITcPlugin.pasanduITonCut.pasfirst)include/cpp/TonCutPluginSdk.hppexamples/manuals/
Every example follows the same host contract:
- Build a 32-bit (Win32) DLL with the extension
.plg. - Export
TcpInitializeV2, create the plugin there, and call itsInitialize; TonCut never does. - Return the SDK's
cEngineVersionfromEngineVersion. TonCut loads every plugin but activates only an exact match; any other value is listed as Not compatible. - 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
| Directory | Purpose |
|---|---|
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.mdmanuals/plugin-contract-and-abi.mdmanuals/csv-schema.mdmanuals/building-examples.mdmanuals/support-by-language.mdmanuals/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
| Environment | What the SDK provides |
|---|---|
| Delphi | Every 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++Builder | The 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.
C++Builder is untested. The Delphi, VS C++, and C# examples are built by
the maintainers. The C++Builder example (examples/cppbuilder/) and the
C++Builder build path in the example and test drivers have never been compiled
or tested by the maintainers, so they are provided as-is and may need
adjustments. If you find a problem, please open an
issue or send a
pull request.
C# is native-shim-only. The C# example's native shim, written in C++,
exports TcpInitializeV2, implements every TonCut interface and callback,
and writes the PLT result. The managed library contains only CSV parsing,
validation, row data, and serialization, and the bridge between the two
halves is specific to your project. Build any managed code for x86: it runs
inside the 32-bit TonCut process.