Skip to content

Gridfinity: text raised on the label shelves (Discussion #1308) - #1357

Merged
henmedia merged 1 commit into
henmedia:mainfrom
mlugo-apx:shelf-labels
Nov 5, 2026
Merged

henmedia merged 1 commit into
henmedia:mainfrom
mlugo-apx:shelf-labels

Conversation

@mlugo-apx

@mlugo-apx mlugo-apx commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

For Discussion #1308, where you asked what a label generator would add for Gridfinity: the label shelves can now carry their label themselves, as raised letters that are part of the bin, so they print with it and a filament change at the shelf's top colours them.

Summary

  • Each label shelf, along a wall or in a compartment, takes a text of up to 24 characters under Text below the shelf's rows. The letters stand 0.4 mm on the shelf's top, as part of the bin, in one of the built-in fonts (Font, one for every shelf of the bin), kerned, and fitted as large as the room on the shelf lets them.
  • The room keeps clear of what the shelf meets: 1.5 mm from a 0.95 mm wall with the stacking lip, whose support leans over the shelf there, 0.3 mm without the lip or against a divider, 0.4 mm from the front, the rounding's size at a rounded free end (2 mm until set), and clear of the inner corners and of a shelf met in a corner.
  • The letters' top is 0.1 mm under the feet of a bin stacked on the lip, so bins still stack. A text whose capitals would come out under 3 mm is left out, and a note under its row says so. Trays have no text: their shelves run up to the top.
  • The back and front shelves read from the bin's front, the side shelves along their wall from inside the bin; a mirrored bin keeps its letters the right way round.
  • The letters are in the exact body, from the font's curves, so the STEP export and the edge tool have them.

A 2 x 1 bin with "M3 Screws" on its back shelf, and a 3 x 2 bin with a label in each compartment:

shelf-labels

How it is built

  • lib/gridfinityLabelText.ts (new; it makes letters only on the page, where the fonts are): lays a shelf's text out with kerning (straightTextShapes), fits its ink box into the shelf's room, and gives the rings for the display mesh and the placed glyphs, which cadModifierGridfinityForShape turns into loops with the font's curves (glyphLoop) for the exact body. Below a capital of 3 mm the text is left out.
  • lib/gridfinityGeometry.ts: labelPiecesIn also returns each shelf's room (the margins above); gridfinityLabelTextPlaces places every shelf's text in the bin, per wall and compartment, with the reading direction and the mirroring; gridfinityLabelTextGiven (from the settings only) and gridfinityHasLabelText (a built shelf carries letters). In the display mesh each glyph is its own even-odd section, joined after the shelves, sunk 0.05 mm into the shelf so it is one body with it.
  • lib/gridfinitySolid.ts: the exact letters are each glyph extruded from its curves (profileExtrusionSolid) and fused after the shelves; a fuse that loses more than a tenth of the letters throws.
  • lib/cadProfileExtrusion.ts: the letters travel in the gridfinity part; cadGridfinitySegmentCount counts them for the edge tool's prepare time, and withinExactProfileLimit counts them in the 700-piece request budget, past which some bins go as their meshes. STEP export builds them always.
  • lib/geometryWorker.ts: a bin with letters stays on the page for grouping, Split, Check clearance, STEP and the other worker tasks, as a text does ([Bug]: Loading Fonts message when attempting to export as STEP file #1337), since the worker has no fonts.
  • viewportShapeObjects.ts and editorMeshCore.ts: the texts, font and mirroring are in the signature and topology key; the unplaced-mesh cache keeps lettered bins with the font revision.
  • mcpShapeSettings.ts: mcpGridfinityPatch gives layerling_create_shape and layerling_update_object the list and text settings together.
  • Inspector rows (a text row per shelf and per compartment label, the font row once a shelf carries text, the note), one new string in all 19 catalogues, guide chapter 9 in the 15 languages that have it, the MCP texts and all three SKILL.md, the changelog and a card. Saved defaults keep the font only, not the texts.

Testing

On 0f2e797 (on main at 550d7fb, 1.144.0):

  • npm run typecheck
  • npm test (4686 tests; one, meshSurfaceSegments.test.ts "puts a knot down as free-form...", timed out at 5 s while the machine was busy and passes on its own, 7 of 7; the file is not touched here) and npm run test:e2e (1078)
  • npm run build and npm run export
  • Tried in the editor (a dev build, through the MCP): on this commit, the bins in the picture; on a build of this change before the review rounds' fixes, a 6 x 5 bin with 40 labelled compartments, and a bin stacked on a labelled one, which touches it only where its feet seat on the lip (Check clearance).
  • gridfinityLabelText.test.ts, gridfinityGeometry.test.ts, geometryWorker.test.ts: the room on every wall, and without the lip, at rounded and chamfered ends, thick walls, neighbouring shelves and dividers; the letters' height against the stacked feet; the fit and the 3 mm boundary; reading direction on each wall, mirrored X, Y and Z; one body; kerning; Script letters that run into one another; Stencil's straight segments; Japanese once its face arrives; fonts not loaded; trays, switched-off shelves and blank texts; the signature, topology key and mesh cache; the edge tool's shared budget and segment count; the MCP patch and its two calls in the editor; saved files, defaults and validation.
  • cadGridfinityLabelText.e2e.ts and gridfinityLabelTextStep.e2e.ts (the real kernel): the exact letters against the display mesh, in volume and in where they stand, on walls, in compartments and mirrored; a fuse that loses the letters throws; the STEP file has them. gridfinityLabelTextPanel.e2e.ts: the rows, the font, one undo step for typing, the note.
  • Three review rounds; in the last, two mutation runs on c9cb2216e (before the last review fixes) had 72 of 88 and 53 of 57 changes caught. Most of the rest behave the same or cannot be reached by a test; the gaps they showed (mirrorY in the signature and the topology key, the editor's two MCP calls and its budget sites) got tests in the last fixes, and those 6 changes are all caught.

Notes

  • Changes in your code: labelPiecesIn returns each shelf's room; withinExactProfileLimit counts a bin's letters in its budget and drops gridfinity from a part it sends as its mesh; layerling_create_shape and layerling_update_object call mcpGridfinityPatch instead of gridfinityListPatch, which gives the same list patch plus the texts (update_object now calls it for every bin; it writes nothing when none of a bin's own settings is given); createGridfinityGeometry and gridfinityLabelledTriangles take the letters as an optional argument; TextProperty takes a hint; the unplaced-mesh cache stores a font revision for lettered bins; containsText counts a bin with letters.
  • Storage, import, export, grouping or undo/redo: a design and its saved file can hold the texts and the font (validated: up to 24 characters, built-in fonts); saved defaults keep the font only. Grouping and STEP of a lettered bin run on the page. Typing is one undo step.
  • Cost: the exact body of a 6 x 5 bin with 40 labelled compartments of 6 letters took 21 to 26 s in Node on a busy machine, against 4 to 5 s without, and its STEP export runs on the page, so the page waits that long. Each keystroke rebuilds the bin's display mesh: on that bin about 1.1 s against 0.4 s without letters, on a 2 x 1 bin 25 against 9 ms. Drawing the letters as a mesh of their own would make typing cheap, but the bin would then not be one body in the view, so I left it.
  • Inside a mirrored group the letters read the wrong way round, as a text's do, until the group is ungrouped.
  • Only the built-in fonts are offered, as a font of one's own is not saved with a bin.
  • The translations other than English and German are first drafts.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@henmedia
henmedia merged commit 9efc492 into henmedia:main Nov 5, 2026
1 check passed
@henmedia

henmedia commented Nov 5, 2026

Copy link
Copy Markdown
Owner

@mlugo-apx thank you, this is great work! Merged. The letters on the shelves look really clean, and having them in the exact body, so they come along in the STEP export, is a big plus.

@mlugo-apx
mlugo-apx deleted the shelf-labels branch November 5, 2026 22:32
@henmedia

henmedia commented Nov 5, 2026

Copy link
Copy Markdown
Owner

@mlugo-apx your label text is out in layerling 1.145.0. Thanks again!

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.

2 participants