Skip to content

Check a drawing against its standard with lint - #46

Merged
sc-frederick merged 1 commit into
mainfrom
export
Nov 13, 2026
Merged

sc-frederick merged 1 commit into
mainfrom
export

Conversation

@tsdraft-export

Copy link
Copy Markdown
Contributor

This pull request was opened by the export from tsdraft's development repository. Each commit
here is one change made there.

Merge it with squash, or with rebase to keep one commit per change. Don't push to this branch:
the next export replaces anything that did not come from it.

`lint(drawing, { standard })` holds a drawing to the standard it is drawn to, as the builder
does at each call, so a drawing made by other code or read from JSON is held to it too. Without
`standard`, `lint` reports what it did before.

- `lint` takes the standard as plain data, from this copy of tsdraft or another: it checks it
  and works out its hash again. A standard that does not check, or whose hash is not its
  content's, is one `standard` error, and `lint` holds the drawing to nothing else of it.
  `discipline` names the drawing's discipline, which resolves the entries with fields by
  discipline.
- A drawing that breaks what the builder refuses gets an error under the same rule: a layer, a
  linetype, a text style or a dimension style the standard does not have, an entity of model
  space or of a layout on layer `0`, an entity's lineweight that is no pen's, a text in no
  role's text style, a viewport at no scale of the standard, a layout on a paper that no sheet
  format is on, and a second layout under `sheet-per-file`.
- And what only the whole drawing shows: a layer, a linetype, a role's text style or a dimension
  style whose values are not the standard's, a layout whose plot style table is not its sheet
  format's, a viewport past its drawing area or into the title block, a title block whose block,
  text styles, linetypes or xref are not the standard's, a text that plots at another height
  than its role's, or below the standard's least height, in a viewport that shows it or on its
  layout, and a dimension shown at another ratio than its style's.
- Warnings say when a layout's sheet format cannot be told, when a layout has no title block, a
  field is unset or its value runs past its box, when entries with fields by discipline went
  unchecked, and where the checks of heights stopped at their limit.
- A layout's sheet format is the one on its paper. Among several on its paper, it is one whose
  title block the layout inserts, and of those, one whose plot style table the layout has, so
  two sheet formats that differ only in their plot style table are told apart. Sheet formats
  that share a title block are checked alike.
- `lint` stays bounded on any data. It reads a list up to its first empty slot, as its other
  rules do. The checks of heights enter only a block that can draw a text, and count each insert
  they walk, each item of the block it enters, each name the first time they read it, by its
  length, the length of each text, of what each dimension's label reads, its style's name, its
  own text and its style's prefix, suffix and text style, and of each error's message. They stop
  at their limit, or at blocks nested deeper than they can follow, with `standard-check-capped`.
  A title block's definition with a field its kind does not have is not the standard's, and its
  JSON is compared no further than the length of the standard's. Its work on the standard grows
  with the standard's size, not with its dimension styles times its scales.
- `defineStandard` checks that no two names of its dimension styles, on a layout and at each
  scale, are one to AutoCAD in time that grows with its styles and scales, not with their product,
  and reports the same problems.
- `LintRule` gains `discipline-unknown`, `linetype-differs-from-standard`,
  `text-style-differs-from-standard`, `dimension-style-differs-from-standard`,
  `sheet-format-ambiguous`, `height-below-standard`, `height-off-role`, `dimension-off-scale`,
  `viewport-outside-drawing-area`, `title-block-missing`, `title-block-differs-from-standard`,
  `title-block-field-unset`, `title-block-field-overflow` and `standard-check-capped`. Code that
  switches over every rule needs them. `LintOptions` is a type: `version` alone, or `standard`
  with `version` and `discipline`. [docs/rules.md](docs/rules.md) lists each rule.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@sc-frederick
sc-frederick merged commit 5fa3c10 into main Nov 13, 2026
3 checks passed
@sc-frederick
sc-frederick deleted the export branch November 13, 2026 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant