Home Kantibat

Documentation — automate

The Kantibat CLI

Lire en français

The CLI is the kantibat command. It counts the symbols on your PDF, DWG and DXF drawings from a terminal, without opening the Kantibat window.

What you need

  • An up-to-date Kantibat, installed on this Windows computer.
  • A licence, or a free trial in progress.
  • The CLI turned on, once: in Kantibat → Settings → CLI, turn it on and accept the terms of use.
Nothing leaves the computer

The command reads your drawings on your disk. It never goes on the network and never calls any AI.

Your first call, in 3 steps

  1. Turn on the CLI in Kantibat → Settings → CLI.

  2. Open a new terminal: PowerShell, Windows Terminal or the command prompt. A terminal opened before you turned the CLI on does not find the command.

  3. Ask for a drawing's legend, replacing the path with yours:

    kantibat legende "C:\Chantiers\Lot-elec\E-01.pdf" --format texte

    Kantibat lists the items of the legend, each with its identifier: L1, L2… That identifier is what you give next to count.

The commands

In a terminal, every command answers in readable text. Read by a program, or written to a file with --sortie resultat.json, it answers in JSON, a format a program or an AI reads without error. --format json or --format texte forces one or the other.

legende: read the legend

The items of the drawing's symbol legend, each with its identifier (L1, L2…) and its label.

kantibat legende E-01.pdf

compter: count an item

The count of one item on a page, with the position of each counted symbol. If the engine cannot count it reliably, the answer is “to be measured” (à métrer), with its reason.

kantibat compter E-01.pdf --article L1

calques: read a DWG or DXF drawing

The drawing unit, the layers and the blocks of a CAD drawing, each block with its number of occurrences. This command returns no quantity: run it before compter.

kantibat calques E-01.dwg

compter --bloc: count the blocks of a DWG or DXF drawing

The number of insertions of each requested block, exact, with the position of each marker. A block missing from the drawing is “to be measured” (à métrer), never zero.

kantibat compter E-01.dwg --bloc LUM-60 --bloc DET-FUMEE

The page written on your computer renders the drawing and its markers. If you hand it to an online assistant, it sends the drawing image to its provider.

kantibat apercu E-01.dwg --bloc LUM-60 --html E-01-LUM.html

metrer: measure the lengths and areas of a DWG or DXF drawing

The drawn length of a layer (in metres) with --calque, the hatch area of a layer (in m²) with --surface, each quantity with its unit and its source. A layer that is missing, has no drawn line or no hatch is “to be measured” (à métrer), never zero; if the drawing unit is not declared, no metre is returned.

kantibat metrer E-01.dwg --calque E-CHEMIN-CABLE --surface SOL-MOQUETTE --html E-01-metre.html

metrer --tout: the full survey, by trade profile

The full survey of a CAD drawing: every block counted, the length of each drawn layer, the area of each hatched layer. With --profil (elec, cvc or plomberie), what the profile table recognises exactly becomes a bill of quantities (DPGF) line; everything else is “not attached” (non rattaché), with its quantity, never filed under the nearest line. The total is “incomplete, not to be carried over as is into the DPGF” as soon as a line is “to be measured” (à métrer), a surface is incomplete or an element is not attached; --tout cannot be combined with --calque or --surface.

kantibat metrer E-01.dwg --tout --profil elec --html E-01-releve.html

dossier: a whole package

The PDF drawings of a folder (not its subfolders) and their legends. With --article, the count of that item drawing by drawing, and the total. If a drawing stays “to be measured”, the total is marked incomplete: it is a minimum.

kantibat dossier "C:\Chantiers\Lot-elec" --article L1

apercu: see what was counted

Writes an image of the drawing with a numbered box on each counted symbol. It is the fastest way to check a count.

kantibat apercu E-01.pdf --article L1 --png E-01-L1.png

justificatif: the PDF to hand to the client

The command writes the PDF record of a drawing: the annotated drawing, with a numbered marker on each counted symbol, then the quantity breakdown, one line per item with its quantity, unit and number of markers. An item the engine cannot count reliably is “to be measured”, never zero.

kantibat justificatif E-01.pdf --article L1 --article L2 --pdf E-01-justificatif.pdf

For a DWG or DXF drawing, give --bloc (once per block) or --tout (with --profil set to elec, cvc or plomberie, to match the takeoff to the DPGF lines of a trade profile), never both; --article and --page are not used. The PDF carries the drawing, then the takeoff: lengths in metres, areas in m², blocks in units. A quantity the drawing cannot establish reliably stays “to be measured”, never zero.

kantibat justificatif E-01.dwg --bloc LUM-60 --bloc DET-FUMEE --pdf E-01-justificatif.pdf
kantibat justificatif E-01.dwg --tout --profil elec --pdf E-01-releve.pdf

The markers and quantities taken off by the command have not been validated: the PDF marks them “awaiting validation”, adds none of them up and carries no “Totals” block. Validation and totals stay in Kantibat, with “Export PDF record”.

If the file already exists, the command stops: add --remplacer to replace it. The file name must end in .pdf. --sortie keeps its meaning: it redirects the JSON answer, not the PDF.

The PDF contains the image of the drawing. It is written on your disk and stays there. If you hand it to an online assistant, or it reads it to show it to you, it passes the image of the drawing to that assistant's provider.

schema: the answer format

The JSON schema of every answer, for anyone writing a program around Kantibat.

kantibat schema

The full list of options: kantibat --help.

Exit codes

Every call ends with a code. A script reads it to know whether everything went well.

CodeWhat it meansWhat to do
0Run completed, even if some items are “to be measured”.Read the answer.
1Internal error.Run it again. If it comes back, write to support with the answer.
2Command written wrong (unknown option, subcommand, item or page), or preview or justification file already there.Check the spelling, or run kantibat --help. To replace a preview or a PDF record, add --remplacer.
3Access refused: CLI not turned on, terms not accepted, blocked by the administrator, or no licence and no trial in progress.Read the message: it says what is missing. Fix it in Kantibat, Settings → CLI or the licence.
4File or folder not found or unreadable.Check the path. If it contains spaces, put it in quotes.

With an AI agent

An AI agent that can run a command in a terminal can do this work for you: Claude Code, Codex, Gemini CLI, Antigravity, or another one. Three steps, whatever the agent.

  1. Give it the instructions. In the project folder, run:

    kantibat aide-ia --sortie KANTIBAT.md

    Then tell the agent to read KANTIBAT.md before any takeoff. This text carries the rules: a number always comes from Kantibat, and “to be measured” is never zero.

  2. Give it the command by its full path. That way, a file with the same name dropped in a folder received from a third party is never run in its place:

    "C:\Users\<vous>\AppData\Local\Kantibat\bin\kantibat.exe"

    The simplest way: copy this line from Kantibat → Settings → CLI, your Windows user name is already in it. Otherwise, replace <vous> with it.

  3. Ask it for the takeoff, for example: “With Kantibat, count the sockets on every drawing in the Lot-elec folder.”

An AI is involved

The agent reads Kantibat's answers: file names, labels, counts. With a remote AI, this information goes to that AI's provider. With an AI installed on your computer, your own, it stays on the computer. No AI sets a number: every quantity comes from the counting engine, or stays “to be measured”.

Your AI does not run commands, but it accepts MCP? See connecting Kantibat over MCP.

The rules the AI must follow, and the path from drawing to bill of quantities: driving Kantibat with an AI (in French).