Skip to content

Sheet formats and the title block from a standard - #44

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.

A drawing drawn to a standard takes its sheets from the standard: their paper, plot style
table, title block and the zones they are laid out by.

- `d.layout(name, { sheetFormat }, draw)` puts a layout on a sheet format of the standard, which
  gives its paper and its plot style table, and `d.layout(name, draw)` puts it on the standard's
  `defaultSheetFormat`. The sheet that `draw` gets has `drawingArea`, the part of the paper inside
  the border, and `zone(name)`, a zone of the sheet format, each a `Zone`:
  `{ left, bottom, right, top, width, height }` in paper units. Without a standard,
  `zone()` and `titleBlock()` are compile errors, and are refused when the code runs.
- `sheet.titleBlock(fields)` places the layout's title block on its layer: a block tsdraft draws,
  inserted at `[0, 0]`, or the firm's own drawing as an xref at its point, with the block of the
  sheet's fields over it. The block's insert has the id `<layout name>.title-block` and the
  xref's `<layout name>.border`, when that is a valid id, and each takes the handles of its
  attributes from its id, as an insert with an id does. The title block's blocks and text styles
  enter the drawing once, under their own names. A definition the drawing has under one of those
  names with another is refused, and so is a later `block()` of the name, since a block's handles
  come from its name. A refused `titleBlock()` places nothing, and none of the title block's
  blocks or text styles enters when one of them is refused.
- A field is filled from the `fields` given to `titleBlock()`, then from
  `createDrawing({ fields })`, the values the drawing's sheets share, then by the builder: the
  number is the layout's name under `sheetFiles` `"one-drawing"`, and the scale the label of the
  one scale the layout's viewports show, or `AS NOTED` when they show more. `TitleBlockFields` is
  their type.
- Under `"one-drawing"`, `createDrawing`'s `fields` give no number, and a number given to
  `titleBlock()` is the layout's name. Under `"sheet-per-file"` a drawing has one layout, and a
  sheet has a number, which names its file: 1 to 64 characters that Windows takes in a file's
  name, with no space or dot at the end and no device's name. Save the sheet as `<number>.dwg`:
  AutoCAD fills a field that reads the file's name from the name the file has. A value other than
  the layout's name for a field that reads it is refused, and so is a value for a field of the
  date AutoCAD fills.
- Under a standard every text and attribute names a role: a text without one, a `height` or a
  `style`, and `textStyle()` are refused, under the new rule `text-style-outside-standard`. A
  layout's `paper` or `plotStyle`, and a sheet format the standard lacks, are refused under
  `sheet-format-outside-standard`, a second layout under `sheet-per-file` under the rule of that
  name, and a layout whose name AutoCAD's `AUDIT` takes for another's, such as `STRAßE` beside
  `STRASSE`, under `duplicate-layout`. A literal mistake is a compile error with the message the
  builder throws.
- `LintRule` gains `text-style-outside-standard`, `sheet-format-outside-standard` and
  `sheet-per-file`. A `switch` over it that is checked to be exhaustive stops compiling.
  `layout()` takes its `draw` last, as its second argument or as its third after the options: a
  layout without a `draw`, or with an argument after it, is a compile error and is refused under
  `layout`. Options of `undefined` are none. `LayoutOptions` gains `sheetFormat`, whose type is
  the message for a drawing without a standard. The new types are `Zone` and
  `TitleBlockFields`.
- A drawing without a standard is built, linted and written as before.
- The example sheet's layout is on the built-in standard's sheet format `arch-d`, laid out by its
  zones, with the standard's title block. `docs/title-blocks.md` describes the title block of a
  standard, on one drawing and on a file per sheet.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@sc-frederick
sc-frederick merged commit 6ee00b6 into main Nov 13, 2026
3 checks passed
@sc-frederick
sc-frederick deleted the export branch November 13, 2026 14:30
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