Sanguinev2.0

Patent Drawing Labeler: Reference Numerals, Leader Lines and a Parts List

Why Sanguine? The red chalk that Leonardo and Michelangelo drew with.

Runs on: Any web browser: nothing to install, and the drawing never leaves your computer.

✨ Install with Claude's help

Not sure how to install this? Let an AI assistant walk you through it, step by step, on your own system.

  1. Copy the instructions below.
  2. Open Claude (a free account works) and paste them in.
  3. Answer its questions and follow along, doing the typing yourself.

Claude in a web browser cannot reach your computer: it reads the instructions, asks about your system, and tells you what to type and what each command does, one step at a time. You stay in control of everything that actually runs.

Using Claude Code? That is the version that runs in a terminal on your own machine, so it can do the downloading and installing itself, asking before each step. Paste this into it instead:

Open in Claude Code ↗needs the Claude Desktop app

Patent Drawing Labeler (Sanguine)

Use it now: veered.org/patent-drawing-labeler/app/ (also at patentlawny.com/patent-tools/label/).

Open a patent drawing, list the parts, and click each part once on the drawing. The labeler puts the reference numeral in clear paper beside the figure and draws the leader line. It picks a spot where the line is short, crosses as little of the drawing as possible, and doesn't run into another numeral or leader. Then you fix anything you like right on the page: drag numerals, curve leaders, switch a leader to an arrow or an underlined numeral, add text, lines and arrows, and white out old marks. You get a labeled PDF, an editable PowerPoint and the reference numeral list.

You don't have to do the clicking yourself. Claude can look at the drawing, name and number the parts, and say where each one is: press Ask Claude (with an Anthropic API key), or paste its answer from claude.ai. The labels are placed the same way.

The labeler with a sample drawing: the parts list and the edit panel on the left, numerals and leader lines placed on FIG. 1

The sample drawing. Claude chose these numerals and points; the labeler placed them. The small orange dots mark leaders that had to cross one line of the drawing.

A drafting aid, not a draftsman. Check every leader against the part it names before you file (<kbd>[</kbd> and <kbd>]</kbd> step through them). Also check the drawings against 37 CFR 1.84 as it stands when you file. Nothing is sent to the Patent Office.

What it does

How you use it

  1. Open the drawing: a PDF, or a PNG or JPEG scan.
  2. Check the figures in the Figures view. Choose whether to keep the sheets as drawn or give each figure its own sheet.
  3. Find the parts: press Ask Claude, or list the parts, one per line, press Add parts, pick a part in the list and click it on the drawing: once in each figure where it shows, on a line of the part. <kbd>Tab</kbd> moves to the next part.
  4. Press Place all numerals to re-place everything together, then edit anything you don't like on the page.
  5. Check: step through every label with <kbd>]</kbd>, and look at the Check list.
  6. Download the PDF, the PowerPoint and the parts list.

Letting Claude do the clicking

With an API key (from console.anthropic.com): press Ask Claude, paste the key, and send. The page sends the sheet images and your parts list straight to Anthropic's API (nothing passes through this site), and the run is billed to your Anthropic account. The key is kept in your browser only if you tick Remember.

Without one, use claude.ai (free accounts work):

  1. Press Download the sheet images. It saves each sheet as a picture with a percent grid, so Claude can read positions off it.
  2. Press Copy the prompt. The prompt already lists the figures found and any parts you have typed.
  3. In Claude, attach the images, paste the prompt and send it.
  4. Copy Claude's whole reply, press Paste Claude's answer, and import it.

Either way, each point is snapped to the nearest line and the labels are placed. Claude also says what each figure shows (it goes into the Brief Description of the Drawings in the Word file) and which numerals name a whole assembly; those leaders get an arrowhead (37 CFR 1.84(r)). Check every leader. Claude reads positions off a picture and will sometimes pick the wrong line. Drag the tip to fix it.

The sample drawing (Try it on a sample drawing) shows the whole round trip: examples/flashlight-claude.json is the answer Claude gave for examples/flashlight.pdf.

Information for nerds

It is one static page (index.html, app.js, engine.js, fonts/) with no build step and no server. Serve the folder with any web server, for example python3 -m http.server, and open it. It loads pdf.js, pdf-lib, fontkit and JSZip from cdnjs/jsDelivr, PptxGenJS only when you ask for a PowerPoint, and the Anthropic SDK only when you press Ask Claude. Work in progress is kept in IndexedDB; a saved project is JSON with the drawing in base64, and an editable PDF carries the same JSON as an embedded file named sanguine-project.json.

Leaders are straight or quadratic curves (one control point). Labels, text and lines are anchored to their figure in source-page points, so they follow it when the layout changes; white-outs belong to a source page and are painted onto the sheet before the ink mask is taken, so placement treats the space as clear.

The placement engine (engine.js, no dependencies, runs in the browser and in Node) works on the sheet rendered at 144 dpi:

  • the ink, found against the local paper brightness (so a grey scan or a photo of a sketch works), and a dilated mask of the drawn lines, so it can tell whether a leader touches a line (the dots of stippled shading don't count as lines);
  • summed-area tables, for a constant-time "is this box clear?" test;
  • the figure's filled silhouette, so numerals prefer the outside.

For each tip it scores numeral positions at 5° steps and a range of distances: 600 × lines crossed + 4 × ink under the leader + 0.25 × length (steeper past about 55 pt) + an outward-direction term + 600 inside the outline (1000 in a snug spot inside it). A leader that would cross a line also tries four gentle bends (quadratic curves) and keeps any that cross fewer lines. It then places the labels greedily, hardest first (the ones with the fewest cheap spots). The unplaced labels move to the front and it tries again; five repair passes re-pick each label against all the others, then pairs of labels that want the same spot swap when that helps, and numerals near each other on the same side are lined up. Every spot on one ray from a tip shares its leader's first stretch, so each ray is walked only once. Candidates are rejected when numerals come within 16 px of each other, when leaders cross or pass within 20 px, or when a leader clips a numeral. The constants were tuned at 200 dpi and scale with the render.

Coordinates in Claude's answer are percent of the sheet as shown (fractions are accepted too). Label points are snapped to the nearest ink within about 12 pt (24 pt if there is none closer), and each figure box is shrunk to the ink inside it.

"FIG. 3" captions already on a sheet are found as short lines of letter-sized marks on one baseline with clear paper round them, and read by matching each mark against the letters and digits of a few common typefaces drawn on a canvas. Ask Claude uses structured output (a JSON schema), so the answer always parses.

Tests: node tests/engine.test.js builds a synthetic drawing and checks that the numerals land on clear paper inside the margins, that no two collide, that the leaders don't cross, and that the figure finder separates the drawings.

examples/make_flashlight.py redraws the sample drawing (needs reportlab).

The label font is Liberation Sans (SIL Open Font License 1.1, see fonts/LICENSE-LiberationSans.txt). It has Helvetica's metrics and can be embedded.

License

MIT. See LICENSE. The bundled Liberation Sans font is under the SIL Open Font License 1.1. Written with AI assistance (Claude).

Information for nerds: the source code

Everything this project is made of, as committed: the code, its README files and its license. No build step or account needed to read it.

⬇ Download source (.zip)

sanguine-patent-drawing-labeler.zip · 688 KB · released under the license stated on this page.

Please test before relying on these tools. They are shared as-is, with no warranty. They work on my own computers, but your system, settings and software versions may differ, so please try them in a safe setting first. If something doesn't work, you can ask Claude (or another AI coding assistant) to look into it, and I'd appreciate hearing what you found and how you fixed it. You are also welcome to just let me know at support@veered.org, and I'll look into it.