Skip to main content

Module frame

Module frame 

Source
Expand description

The paper’s own furniture: the drawing BORDER and the TITLE BLOCK.

Both are the sheet’s (crate::sheets::Sheet::border, border_inset_mm, title_block, notes), both are on by default, and both come out of here as the same thing a placed view does — polylines and centred text runs in paper millimetres, measured from the paper’s TOP-LEFT corner with y running down. That is what lets the SVG writer, the PDF writer and the sheet viewport draw the frame with the code they already have for the drawing: lines and text only, nothing filled.

§The title block

A fixed stamp in the bottom-right corner, inside the border: five cells, each a small LABEL over its VALUE.

+----------------------------------+
| SHEET                            |
| Page 1                           |
+----------------------------------+
| DOCUMENT                         |
| bracket                          |
+----------------+-----------------+
| SCALE          | DATE            |
| 4:1            | 2026-09-13      |
+----------------+-----------------+
| NOTES                            |
| first article                    |
+----------------------------------+

Fixed, because a title block that scaled with the paper would be unreadable on an A0 and off the page on a small custom sheet; what DOES scale is the whole stamp on a sheet too small to carry it (SCALE_FLOOR), so a 60 × 40 mm sheet gets a proportionally smaller one rather than a block hanging over its own border.

SCALE is the FIRST placed view’s — a sheet whose views are at different scales says so per view, and the stamp names the one the drawing is read at. DATE is the day the sheet was drawn or exported, UTC (see today_iso); it is part of the projection cache’s key, so a session open across midnight re-projects once rather than printing yesterday.

§The revision table

The sheet’s crate::sheets::Revision rows, as a table of three columns beside the title block — immediately to its LEFT, at the stamp’s own scale, its bottom on the same margin — with a header row on top and the revisions under it in the order the list keeps them:

+-----+----------+----------------------------+----------------------------------+
| REV |   DATE   |        DESCRIPTION         | SHEET                            |
+-----+----------+----------------------------+ Page 1                           |
|  A  |2026-09-01|       first release        +----------------------------------+
+-----+----------+----------------------------+ …                                |
|  B  |2026-09-14|       bore opened out      |                                  |
+-----+----------+----------------------------+----------------------------------+

Its width is the stamp’s, 110 mm, so every preset carries the two side by side at full size. A sheet whose drawing area is too narrow for both puts the table ON TOP of the stamp instead, right-aligned with it; a sheet with the title block switched off puts it in the corner the stamp would have taken. One too short for the table in any of those places draws none, and an empty list never draws one. The text is the title block’s: flat runs of the same cap heights, centred in their cells.

Structs§

FrameContext
What the frame knows that the sheet does not: the document it belongs to and the day it is drawn on.
FrameDrawing
The border, title block and revision table, drawn — polylines and centred text runs in paper millimetres. Absent from a sheet that draws none of them.
RevisionTableDrawing
The revision table: its rules, its header and row text, and where it sits.

Constants§

SCALE_FLOOR
Below this scale factor the stamp is not drawn at all: a sheet that cannot carry a legible title block is better off with none.

Functions§

civil_from_days
Days since 1970-01-01 as a civil date — Howard Hinnant’s civil_from_days, exact for every day in a proleptic Gregorian calendar and the reason this file needs no date crate.
frame
Build the frame of sheet. None when the sheet draws none of its pieces.
iso_date
A unix timestamp as YYYY-MM-DD (UTC).
ratio_text
A scale in paper millimetres per model unit as a drawing ratio — 4:1, 1:2, 2.5:1 — or an em dash for one that is not a scale. The title block’s SCALE cell and a detail view’s caption both read it.
scale_text
The FIRST placed view’s scale as a ratio — 4:1, 1:2, 2.5:1 — or an em dash on a sheet with nothing placed on it yet.
today_iso
Today, YYYY-MM-DD, in UTC.