diff --git a/.agents/skills/formblocks-driving/SKILL.md b/.agents/skills/formblocks-driving/SKILL.md index 906173e..41713d7 100644 --- a/.agents/skills/formblocks-driving/SKILL.md +++ b/.agents/skills/formblocks-driving/SKILL.md @@ -1,10 +1,10 @@ --- name: formblocks-driving -description: "Use when asked to build, stack, change, check, picture or save a brick model in FormBlocks through its MCP tools or ./formblocks cli: a wall, a tower, a house, a table, any LDraw model. Finds parts and colours in the LDraw parts library, places and seats bricks, clips and hinge halves on placements or the ground, builds walls in overlapping courses with plates, tiles and slopes, moves, turns, duplicates and recolours parts, uses the selection and submodels, splits a model into steps and walks them, counts parts and saves the parts list as CSV, saves PNG pictures and reads them back to check a build, checks overlaps, and opens, saves and exports .fblk, .ldr and .mpd files. Covers Claude Code, Codex, Cursor and Antigravity in the agent dock or outside it, and the person's approval, which an agent never gives itself. Includes worked examples, coordinates, error codes and scripts. Not for changing FormBlocks' source code or installing it (formblocks-harness)." +description: "Use when asked to build, stack, change, check, picture or save a brick model in FormBlocks through its MCP tools or ./formblocks cli: a wall, a tower, a house, a table, any LDraw model. Finds parts and colours in the LDraw parts library, places and seats bricks, clips and hinge halves on placements or the ground, builds walls in overlapping courses with plates, tiles and slopes, moves, turns, duplicates, copies, pastes and recolours parts, uses the selection and submodels, splits a model into steps and walks them, counts parts and saves the parts list as CSV, saves PNG pictures and reads them back to check a build, checks overlaps, and opens, saves and exports .fblk, .ldr and .mpd files. Covers Claude Code, Codex, Cursor and Antigravity in the agent dock or outside it, and the person's approval, which an agent never gives itself. Includes worked examples, coordinates, error codes and scripts. Not for changing FormBlocks' source code or installing it (formblocks-harness)." license: Apache-2.0 metadata: product: FormBlocks - pack-version: "0.5.0" + pack-version: "0.6.0" audience: operating agent --- @@ -23,6 +23,8 @@ FormBlocks keeps one open model in its engine: submodels holding placements of L | Clips on bars, hinge halves, hinge plates and bricks, swivel plates, sliding a clip, folding a hinge, part.connectors kinds | `sub-skills/clips-and-hinges/SUB-SKILL.md` | | Planning a build, walls in overlapping courses, corners, openings, plates and tiles, roofs of slopes | `sub-skills/building-in-order/SUB-SKILL.md` | | Moving, turning, duplicating, recolouring, hiding, showing and deleting placements, undo and redo | `sub-skills/changing-parts/SUB-SKILL.md` | +| Beams with holes, pins, friction pins, axles, bushes, a brick with a hole, joining beams, turning a beam on a pin | `sub-skills/pins-and-axles/SUB-SKILL.md` | +| Copying, cutting and pasting parts as LDraw lines, repeating a group at an offset, clipboard.copy, clipboard.cut, clipboard.paste | `sub-skills/clipboard/SUB-SKILL.md` | | Turning parts by any angle, about a point, an axis or a hinge's axis, part.pivot, the angle step, a turn lifted or refused | `sub-skills/turning-parts/SUB-SKILL.md` | | Moving or copying parts along a pointer ray as the window drags them, part.pick, the scene's axes, resting across a gap, what the person's drags and Ctrl+D do | `sub-skills/moving-parts/SUB-SKILL.md` | | Reading and setting the selection, selecting by colour or part, showing the person which parts | `sub-skills/selection/SUB-SKILL.md` | diff --git a/.agents/skills/formblocks-driving/references/command-catalogue.md b/.agents/skills/formblocks-driving/references/command-catalogue.md index 9c9f875..7c1baaf 100644 --- a/.agents/skills/formblocks-driving/references/command-catalogue.md +++ b/.agents/skills/formblocks-driving/references/command-catalogue.md @@ -4,8 +4,8 @@ Written by `./formblocks agents sync` from the engine's command catalogue; never ## Contents -- MCP tools: the 72 tools an agent sees, each with whether it only reads. -- Commands: the 66 catalogue commands with their titles, parameters and summaries, in name order. +- MCP tools: the 85 tools an agent sees, each with whether it only reads. +- Commands: the 79 catalogue commands with their titles, parameters and summaries, in name order. ## MCP tools @@ -17,10 +17,16 @@ Written by `./formblocks agents sync` from the engine's command catalogue; never | `formblocks_redo` | no | Redo changes that formblocks_undo took back, one step each. A new change after an undo empties what can be redone. Returns {revision, labels, label}. | | `formblocks_status` | yes | Read what this FormBlocks is: its version, the model's revision, placement count, file and unsaved mark, how many commands there are, its data folder, whether the window's engine is running, and the person's standing choice for outside agents (ask, allowed or blocked). Call it first. | | `formblocks_undo` | no | Undo the last changes, one step per command. Returns {revision, labels, label}: the new revision and the titles of the commands taken back, newest first. Nothing to undo answers an empty labels list. | +| `cmd_angle_next` | yes | Go to the next angle step after the engine's own: 90, 45, 22.5, 15, 5, 1 degrees, then 90 again. Kept as the person's setting. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_angle_step` | yes | Choose the angle step a turn with the pointer moves in and Alt with R, T or Y turns by: 90, 45, 22.5, 15, 5 or 1 degrees. Kept as the person's setting. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | +| `cmd_clipboard_copy` | yes | Write placements as LDraw part lines (type 1, colour, position, rotation, file name), the text the window puts on the system clipboard; the engine keeps it too, for clipboard.paste without text. Only reads. | +| `cmd_clipboard_cut` | no | Copy placements as LDraw part lines, as clipboard.copy does, and remove them from the model. One undo step. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | +| `cmd_clipboard_paste` | no | Add the parts that LDraw part lines name, keeping their colours and their places relative to one another, into the step shown of the submodel being edited; they become the selection. With a pointer ray in the window's scene axes they go where the ray takes the lowest of them, seated, resting or refused exactly as a drag of copies; without one they go where the lines put them, moved by delta. One undo step. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_colours_current` | yes | Choose the colour the next placed part gets, and put it at the front of the recent colours. Kept as the person's setting; it recolours nothing. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | +| `cmd_colours_favourite` | yes | Star or unstar a colour: a starred colour is listed among the favourite colours, newest first. Left out, on turns the star the other way. Kept as the person's setting; it changes no model. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_colours_list` | yes | List the library's colours with code, name, value, edge and finish, or the swatches of one group, hue family or name words. Only reads. | | `cmd_colours_used` | yes | List the colours used in the open model, most used first: each colour's number, name, value, how many parts of the whole model are in it, and whether the library defines it. Only reads. | +| `cmd_grid_next` | yes | Go to the next grid step after the engine's own: stud, plate, fine, then stud again. Kept as the person's setting. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_grid_step` | yes | Choose the grid step: stud (20 LDU across, 8 up), plate (10 across, 8 up) or fine (1 and 1). Kept as the person's setting. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_library_status` | yes | Read whether a parts library is in use, where it was found, its update, whether its index is ready, the fetch in progress if any, and the consent and attribution the library card shows. Reading never fetches; only the person can consent to a fetch. Only reads. | | `cmd_model_info` | yes | Read the model's name, description (its title line), author, file, format and the library update it was saved with and the one in use; its counts (placements, parts through every use, different parts, colours, part and colour pairs, submodels, steps, missing parts, and overlapping pairs as overlap.check counts them); the parts the library lacks by number; its size in LDU, studs, bricks and millimetres; the licences model.set_info accepts; and its parts list unless table is false. Only reads. | @@ -35,7 +41,9 @@ Written by `./formblocks agents sync` from the engine's command catalogue; never | `cmd_model_tree` | yes | Read one submodel's steps and placements, each with its id, part, colour, position, rotation, step and hidden mark, and the submodels with their uses. Only reads. | | `cmd_overlap_check` | yes | List each pair of overlapping placements, for the given placements or the whole model: two parts whose real shapes cut more than 1 LDU into each other, with the depth in LDU and the shared volume in cubic LDU. Parts joined through seated connectors never count. Nested pairs, one part sitting in another's hollow by design, are counted apart in nested_count and listed under nested when asked. Only reads. | | `cmd_overlap_nested` | yes | Choose what the overlap check reports: false reports only real overlaps (the proposed default), true reports nested pairs too, parts that sit in another's hollow by design, such as a rim in its tyre or a pin in its hole. Nested pairs never block placing or moving either way. Kept as the person's setting. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | +| `cmd_overlap_nested_toggle` | yes | Turn the reporting of nested pairs off when it is on and on when it is off, deciding from the engine's own setting. Kept as the person's setting. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_overlap_set` | yes | Turn the overlap check on or off: with it on, placing and moving never put a part where its real shape would cut more than 1 LDU into another's. Kept as the person's setting. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | +| `cmd_overlap_toggle` | yes | Turn the overlap check off when it is on and on when it is off, deciding from the engine's own setting, so two quick presses always end where they began. Kept as the person's setting. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_part_connectors` | yes | List a library part's connectors as the connection model derives them: kind, position, axis, ref, length, index and where each came from, with the counts, the body box and the footprint; kind keeps only connectors of one kind. Only reads. | | `cmd_part_delete` | no | Remove placements from the model; deleting the last use of a submodel keeps the submodel. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_part_duplicate` | no | Copy placements, keeping colours and relative places, offset by delta; the copies go into the step shown and become the selection. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | @@ -43,7 +51,7 @@ Written by `./formblocks agents sync` from the engine's command catalogue; never | `cmd_part_fit` | yes | Answer where a part would go and which connectors it would join, from a position, a placement to seat on, or a pointer ray, with snapping, the grid step and the overlap check as set; changes nothing. Position and rotation are in LDraw axes (-Y up); a pointer ray is in the window's scene axes (+Y up), as for every command that takes one. Only reads. | | `cmd_part_hide` | no | Hide placements: they stay in the model but are not drawn or picked, and the project file remembers it. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_part_hide_others` | no | Hide every placement of the submodel being edited except the given ones or the selection, to work on one area alone. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | -| `cmd_part_move` | no | Move placements by an offset in LDU, exactly, with no snapping. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | +| `cmd_part_move` | no | Move placements by an offset in LDU, exactly, with no snapping; with the overlap check on, a move into a part that does not move is refused. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_part_move_at_ray` | no | Put down a dragged selection where a pointer ray in the window's scene axes takes the grabbed placement, seated, on the grid or refused exactly as the drag preview answers, resting on what lies under its footprint when the place under the pointer would cut into another part; the others keep their places relative to it. Give held as the drag preview answered it so the part lands as previewed. One undo step. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_part_pick` | yes | Name the placement of the submodel being edited that a pointer ray in the window's scene axes meets first on its real triangles, with the point and the face's normal, or the ground; hidden parts are passed through. Only reads. | | `cmd_part_pivot` | yes | Say what placements turn about when the pivot dial turns them: the centre of the box around their shapes with the X, Y and Z axes, or, for one part joined by a hinge, the hinge's point and axis alone; with a pointer ray, the point where it meets a part of the submodel being edited (or the connector within 8 LDU of it), with X, Y and Z, and as without a ray when it meets none. Each point and axis in LDraw's axes and in the window's scene axes, with how far the box reaches from the point. Only reads. | @@ -51,7 +59,7 @@ Written by `./formblocks agents sync` from the engine's command catalogue; never | `cmd_part_place_at_ray` | no | Place a library part where a pointer ray in the window's scene axes puts it, seated, on the grid or refused exactly as the placement preview answers, resting on what lies under its whole footprint when the place under the pointer would cut into another part; it goes into the step shown of the submodel being edited and becomes the selection. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_part_recolour` | no | Give placements a colour; a use of a submodel in colour 16 passes it to its parts in colour 16. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_part_rotate` | no | Turn placements about an axis through a point: by whole quarter turns, or by an angle in degrees, about X, Y, Z or any direction in LDraw axes, about the centre of their box when no point is given. What turned is lifted straight up when it would end below the ground, and with the overlap check on a turn into a part that does not turn is refused. One undo step. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | -| `cmd_part_set_transform` | no | Put one placement at an exact position, rotation or both, as the details panel does. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | +| `cmd_part_set_transform` | no | Put one placement at an exact position, rotation or both, as the details panel does; with the overlap check on, a place inside another part is refused. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_part_show` | no | Show hidden placements again; every hidden placement in the model when no ids are given (Show all). Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_parts_list` | yes | Read the parts a model needs, one row per part and colour with its description, colour name, count and the placements of the submodel being edited that hold it; a submodel's parts counted once for each use unless submodels is row, a moved part counted under the number it moved to, parts missing from the library first and marked. With text true the answer also holds the list as tab separated text. Only reads. | | `cmd_parts_list_save` | no | Write the parts list to a file as CSV in UTF-8 with a byte order mark and CR LF line ends: a header row, then one row per part and colour with LDraw part number, description, LDraw colour number, colour name and count; comma separated, or tab separated for a .tsv path or separator tab. A cell starting with =, +, - or @ is written after an apostrophe so a spreadsheet reads it as text. Opens, starts or writes a model file; not an undo step. An outside agent waits for the person to allow it in the window. | @@ -61,20 +69,25 @@ Written by `./formblocks agents sync` from the engine's command catalogue; never | `cmd_picture_steps` | no | Draw one PNG for every step of the submodel being edited, each showing the steps up to it, and write them into a folder as name-01.png, name-02.png and so on. Needs the FormBlocks window open. Opens, starts or writes a model file; not an undo step. An outside agent waits for the person to allow it in the window. | | `cmd_select_add` | yes | Add placements to the selection. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_select_all` | yes | Select every visible placement of the submodel being edited. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | +| `cmd_select_attached` | yes | Select the given placements, or the selection, and every visible placement joined to them through seated connectors, however far the chain goes; a use of a submodel joins nothing. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_select_by_colour` | yes | Select every visible placement in a colour, or in the colours of the selection when no colour is given. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_select_by_part` | yes | Select every visible placement of a part, or of the parts of the selection when no part is given; a printed part is a different part. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | +| `cmd_select_by_part_colour` | yes | Select every visible placement that matches one of the given placements, or of the selection, in both its part and its colour; a printed part is a different part. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_select_clear` | yes | Clear the selection. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_select_get` | yes | Read the selection: the placements, how many, in how many colours, and the centre of their origins. Only reads. | | `cmd_select_invert` | yes | Select every visible placement that was not selected and let go of the rest. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_select_remove` | yes | Let go of placements without touching the rest of the selection. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_select_set` | yes | Make the selection exactly these placements; an empty list clears it. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_snap_set` | yes | Turn snapping on or off: with it on, a part being placed or moved seats on free compatible connectors within reach; with it off, it moves in grid steps only. Kept as the person's setting. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | +| `cmd_snap_toggle` | yes | Turn snapping off when it is on and on when it is off, deciding from the engine's own setting, so two quick presses always end where they began. Kept as the person's setting. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_step_break_after` | no | Start a new step after a placement, moving the placements after it in its step into the new step; with no id, add an empty step after the step shown and show it. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_step_delete` | no | Delete a step; its placements move to the start of the next step, or to the end of the step before when it is the last. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_step_goto` | yes | Show a step of the submodel being edited, by number or as first, previous, next or last: every placement of steps 1 to it is drawn, later ones are hidden, and new parts go into it. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_step_list` | yes | Read the steps of a submodel: each step's number, name and placement ids, and which step is shown. Only reads. | | `cmd_step_move_parts` | no | Move placements of one submodel into another of its steps; one past the last step starts a new step at the end. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | +| `cmd_step_move_to_new` | no | Put placements of one submodel into a new step right after the step shown, and show it. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_step_rename` | no | Name a step, or clear its name with an empty name; the name is kept in the file as the step's first line. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | +| `cmd_step_reorder` | no | Move a step with everything in it to another place in its submodel's order; the steps between close up and are numbered again. The step shown stays the same step. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_submodel_create` | no | Pack placements of one submodel into a new submodel and put one use of it in their place. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_submodel_delete` | no | Delete a submodel that is not the main model; one that still has uses is kept unless with_uses is true, which deletes the uses too. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_submodel_dissolve` | no | Put a use's parts back into its parent at the same places, in the use's step; the submodel goes when its last use is unpacked. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | @@ -88,10 +101,16 @@ Written by `./formblocks agents sync` from the engine's command catalogue; never | Command | Title | Reads only | Parameters | What it does | | --- | --- | --- | --- | --- | +| `angle.next` | Next Angle Step | yes | none | Go to the next angle step after the engine's own: 90, 45, 22.5, 15, 5, 1 degrees, then 90 again. Kept as the person's setting. | | `angle.step` | Angle Step | yes | `step` (number) | Choose the angle step a turn with the pointer moves in and Alt with R, T or Y turns by: 90, 45, 22.5, 15, 5 or 1 degrees. Kept as the person's setting. | +| `clipboard.copy` | Copy | yes | `ids` (array, optional) | Write placements as LDraw part lines (type 1, colour, position, rotation, file name), the text the window puts on the system clipboard; the engine keeps it too, for clipboard.paste without text. | +| `clipboard.cut` | Cut | no | `ids` (array, optional) | Copy placements as LDraw part lines, as clipboard.copy does, and remove them from the model. One undo step. | +| `clipboard.paste` | Paste | no | `text` (string, optional), `origin` (array, optional), `direction` (array, optional), `rotation` (array, optional), `held` (integer, optional), `snap` (boolean, optional), `delta` (array, optional) | Add the parts that LDraw part lines name, keeping their colours and their places relative to one another, into the step shown of the submodel being edited; they become the selection. With a pointer ray in the window's scene axes they go where the ray takes the lowest of them, seated, resting or refused exactly as a drag of copies; without one they go where the lines put them, moved by delta. One undo step. | | `colours.current` | Current Colour | yes | `colour` (integer) | Choose the colour the next placed part gets, and put it at the front of the recent colours. Kept as the person's setting; it recolours nothing. | +| `colours.favourite` | Favourite Colour | yes | `colour` (integer), `on` (boolean, optional) | Star or unstar a colour: a starred colour is listed among the favourite colours, newest first. Left out, on turns the star the other way. Kept as the person's setting; it changes no model. | | `colours.list` | Colours | yes | `text` (string, optional), `group` (string, optional), `hue` (string, optional) | List the library's colours with code, name, value, edge and finish, or the swatches of one group, hue family or name words. | | `colours.used` | Colours Used | yes | none | List the colours used in the open model, most used first: each colour's number, name, value, how many parts of the whole model are in it, and whether the library defines it. | +| `grid.next` | Next Grid Step | yes | none | Go to the next grid step after the engine's own: stud, plate, fine, then stud again. Kept as the person's setting. | | `grid.step` | Grid Step | yes | `step` (string) | Choose the grid step: stud (20 LDU across, 8 up), plate (10 across, 8 up) or fine (1 and 1). Kept as the person's setting. | | `library.status` | Library Status | yes | none | Read whether a parts library is in use, where it was found, its update, whether its index is ready, the fetch in progress if any, and the consent and attribution the library card shows. Reading never fetches; only the person can consent to a fetch. | | `model.info` | Model Information | yes | `table` (boolean, optional) | Read the model's name, description (its title line), author, file, format and the library update it was saved with and the one in use; its counts (placements, parts through every use, different parts, colours, part and colour pairs, submodels, steps, missing parts, and overlapping pairs as overlap.check counts them); the parts the library lacks by number; its size in LDU, studs, bricks and millimetres; the licences model.set_info accepts; and its parts list unless table is false. | @@ -106,7 +125,9 @@ Written by `./formblocks agents sync` from the engine's command catalogue; never | `model.tree` | Model Tree | yes | `submodel` (string, optional) | Read one submodel's steps and placements, each with its id, part, colour, position, rotation, step and hidden mark, and the submodels with their uses. | | `overlap.check` | Check Overlaps | yes | `ids` (array, optional), `nested` (boolean, optional) | List each pair of overlapping placements, for the given placements or the whole model: two parts whose real shapes cut more than 1 LDU into each other, with the depth in LDU and the shared volume in cubic LDU. Parts joined through seated connectors never count. Nested pairs, one part sitting in another's hollow by design, are counted apart in nested_count and listed under nested when asked. | | `overlap.nested` | Nested Pairs | yes | `on` (boolean) | Choose what the overlap check reports: false reports only real overlaps (the proposed default), true reports nested pairs too, parts that sit in another's hollow by design, such as a rim in its tyre or a pin in its hole. Nested pairs never block placing or moving either way. Kept as the person's setting. | +| `overlap.nested_toggle` | Nested Pairs On or Off | yes | none | Turn the reporting of nested pairs off when it is on and on when it is off, deciding from the engine's own setting. Kept as the person's setting. | | `overlap.set` | Overlap Check | yes | `on` (boolean) | Turn the overlap check on or off: with it on, placing and moving never put a part where its real shape would cut more than 1 LDU into another's. Kept as the person's setting. | +| `overlap.toggle` | Overlap Check On or Off | yes | none | Turn the overlap check off when it is on and on when it is off, deciding from the engine's own setting, so two quick presses always end where they began. Kept as the person's setting. | | `part.connectors` | Part Connectors | yes | `part` (string), `kind` (string, optional) | List a library part's connectors as the connection model derives them: kind, position, axis, ref, length, index and where each came from, with the counts, the body box and the footprint; kind keeps only connectors of one kind. | | `part.delete` | Delete | no | `ids` (array, optional) | Remove placements from the model; deleting the last use of a submodel keeps the submodel. | | `part.duplicate` | Duplicate | no | `ids` (array, optional), `delta` (array, optional) | Copy placements, keeping colours and relative places, offset by delta; the copies go into the step shown and become the selection. | @@ -114,7 +135,7 @@ Written by `./formblocks agents sync` from the engine's command catalogue; never | `part.fit` | Fit Part | yes | `part` (string), `rotation` (array, optional), `position` (array, optional), `on` (string, optional), `origin` (array, optional), `direction` (array, optional), `ids` (array, optional), `submodel` (string, optional), `snap` (boolean, optional) | Answer where a part would go and which connectors it would join, from a position, a placement to seat on, or a pointer ray, with snapping, the grid step and the overlap check as set; changes nothing. Position and rotation are in LDraw axes (-Y up); a pointer ray is in the window's scene axes (+Y up), as for every command that takes one. | | `part.hide` | Hide | no | `ids` (array, optional) | Hide placements: they stay in the model but are not drawn or picked, and the project file remembers it. | | `part.hide_others` | Hide Others | no | `ids` (array, optional) | Hide every placement of the submodel being edited except the given ones or the selection, to work on one area alone. | -| `part.move` | Move | no | `ids` (array, optional), `delta` (array) | Move placements by an offset in LDU, exactly, with no snapping. | +| `part.move` | Move | no | `ids` (array, optional), `delta` (array) | Move placements by an offset in LDU, exactly, with no snapping; with the overlap check on, a move into a part that does not move is refused. | | `part.move_at_ray` | Move Selection at Pointer | no | `grab` (string), `origin` (array), `direction` (array), `rotation` (array, optional), `held` (integer, optional), `ids` (array, optional), `snap` (boolean, optional) | Put down a dragged selection where a pointer ray in the window's scene axes takes the grabbed placement, seated, on the grid or refused exactly as the drag preview answers, resting on what lies under its footprint when the place under the pointer would cut into another part; the others keep their places relative to it. Give held as the drag preview answered it so the part lands as previewed. One undo step. | | `part.pick` | Pick at Pointer | yes | `origin` (array), `direction` (array), `ground` (boolean, optional) | Name the placement of the submodel being edited that a pointer ray in the window's scene axes meets first on its real triangles, with the point and the face's normal, or the ground; hidden parts are passed through. | | `part.pivot` | Pivot | yes | `ids` (array, optional), `origin` (array, optional), `direction` (array, optional) | Say what placements turn about when the pivot dial turns them: the centre of the box around their shapes with the X, Y and Z axes, or, for one part joined by a hinge, the hinge's point and axis alone; with a pointer ray, the point where it meets a part of the submodel being edited (or the connector within 8 LDU of it), with X, Y and Z, and as without a ray when it meets none. Each point and axis in LDraw's axes and in the window's scene axes, with how far the box reaches from the point. | @@ -122,7 +143,7 @@ Written by `./formblocks agents sync` from the engine's command catalogue; never | `part.place_at_ray` | Place Part at Pointer | no | `part` (string), `colour` (integer), `origin` (array), `direction` (array), `rotation` (array, optional), `held` (integer, optional), `step` (integer, optional), `snap` (boolean, optional) | Place a library part where a pointer ray in the window's scene axes puts it, seated, on the grid or refused exactly as the placement preview answers, resting on what lies under its whole footprint when the place under the pointer would cut into another part; it goes into the step shown of the submodel being edited and becomes the selection. | | `part.recolour` | Recolour | no | `ids` (array, optional), `colour` (integer) | Give placements a colour; a use of a submodel in colour 16 passes it to its parts in colour 16. | | `part.rotate` | Rotate | no | `ids` (array, optional), `axis` (string, optional), `quarter_turns` (integer, optional), `angle` (number, optional), `axis_vector` (array, optional), `about` (array, optional) | Turn placements about an axis through a point: by whole quarter turns, or by an angle in degrees, about X, Y, Z or any direction in LDraw axes, about the centre of their box when no point is given. What turned is lifted straight up when it would end below the ground, and with the overlap check on a turn into a part that does not turn is refused. One undo step. | -| `part.set_transform` | Set Position and Rotation | no | `id` (string), `position` (array, optional), `rotation` (array, optional) | Put one placement at an exact position, rotation or both, as the details panel does. | +| `part.set_transform` | Set Position and Rotation | no | `id` (string), `position` (array, optional), `rotation` (array, optional) | Put one placement at an exact position, rotation or both, as the details panel does; with the overlap check on, a place inside another part is refused. | | `part.show` | Show | no | `ids` (array, optional) | Show hidden placements again; every hidden placement in the model when no ids are given (Show all). | | `parts.list` | Parts List | yes | `scope` (string, optional), `group` (string, optional), `submodels` (string, optional), `text` (boolean, optional) | Read the parts a model needs, one row per part and colour with its description, colour name, count and the placements of the submodel being edited that hold it; a submodel's parts counted once for each use unless submodels is row, a moved part counted under the number it moved to, parts missing from the library first and marked. With text true the answer also holds the list as tab separated text. | | `parts.list_save` | Save Parts List | no | `path` (string), `separator` (string, optional), `scope` (string, optional), `group` (string, optional), `submodels` (string, optional) | Write the parts list to a file as CSV in UTF-8 with a byte order mark and CR LF line ends: a header row, then one row per part and colour with LDraw part number, description, LDraw colour number, colour name and count; comma separated, or tab separated for a .tsv path or separator tab. A cell starting with =, +, - or @ is written after an apostrophe so a spreadsheet reads it as text. | @@ -132,20 +153,25 @@ Written by `./formblocks agents sync` from the engine's command catalogue; never | `picture.steps` | Save Step Pictures | no | `folder` (string), `name` (string, optional), `width` (integer, optional), `height` (integer, optional), `scale` (integer, optional), `background` (string, optional), `ground` (boolean, optional), `view` (string, optional), `fade` (boolean, optional) | Draw one PNG for every step of the submodel being edited, each showing the steps up to it, and write them into a folder as name-01.png, name-02.png and so on. Needs the FormBlocks window open. | | `select.add` | Add to Selection | yes | `ids` (array) | Add placements to the selection. | | `select.all` | Select All | yes | none | Select every visible placement of the submodel being edited. | -| `select.by_colour` | Select Same Colour | yes | `colour` (integer, optional) | Select every visible placement in a colour, or in the colours of the selection when no colour is given. | -| `select.by_part` | Select Same Part | yes | `part` (string, optional) | Select every visible placement of a part, or of the parts of the selection when no part is given; a printed part is a different part. | +| `select.attached` | Select Attached | yes | `ids` (array, optional), `add` (boolean, optional) | Select the given placements, or the selection, and every visible placement joined to them through seated connectors, however far the chain goes; a use of a submodel joins nothing. | +| `select.by_colour` | Select Same Colour | yes | `colour` (integer, optional), `add` (boolean, optional) | Select every visible placement in a colour, or in the colours of the selection when no colour is given. | +| `select.by_part` | Select Same Part | yes | `part` (string, optional), `add` (boolean, optional) | Select every visible placement of a part, or of the parts of the selection when no part is given; a printed part is a different part. | +| `select.by_part_colour` | Select Same Part and Colour | yes | `ids` (array, optional), `add` (boolean, optional) | Select every visible placement that matches one of the given placements, or of the selection, in both its part and its colour; a printed part is a different part. | | `select.clear` | Select None | yes | none | Clear the selection. | | `select.get` | Selection | yes | none | Read the selection: the placements, how many, in how many colours, and the centre of their origins. | | `select.invert` | Invert Selection | yes | none | Select every visible placement that was not selected and let go of the rest. | | `select.remove` | Remove from Selection | yes | `ids` (array) | Let go of placements without touching the rest of the selection. | | `select.set` | Select | yes | `ids` (array) | Make the selection exactly these placements; an empty list clears it. | | `snap.set` | Snapping | yes | `on` (boolean) | Turn snapping on or off: with it on, a part being placed or moved seats on free compatible connectors within reach; with it off, it moves in grid steps only. Kept as the person's setting. | +| `snap.toggle` | Snapping On or Off | yes | none | Turn snapping off when it is on and on when it is off, deciding from the engine's own setting, so two quick presses always end where they began. Kept as the person's setting. | | `step.break_after` | New Step | no | `id` (string, optional) | Start a new step after a placement, moving the placements after it in its step into the new step; with no id, add an empty step after the step shown and show it. | | `step.delete` | Delete Step | no | `step` (integer), `submodel` (string, optional) | Delete a step; its placements move to the start of the next step, or to the end of the step before when it is the last. | | `step.goto` | Show Step | yes | `index` (integer, optional), `to` (string, optional) | Show a step of the submodel being edited, by number or as first, previous, next or last: every placement of steps 1 to it is drawn, later ones are hidden, and new parts go into it. | | `step.list` | Steps | yes | `submodel` (string, optional) | Read the steps of a submodel: each step's number, name and placement ids, and which step is shown. | | `step.move_parts` | Move to Step | no | `ids` (array, optional), `step` (integer) | Move placements of one submodel into another of its steps; one past the last step starts a new step at the end. | +| `step.move_to_new` | Move to New Step | no | `ids` (array, optional) | Put placements of one submodel into a new step right after the step shown, and show it. | | `step.rename` | Rename Step | no | `step` (integer), `name` (string), `submodel` (string, optional) | Name a step, or clear its name with an empty name; the name is kept in the file as the step's first line. | +| `step.reorder` | Move Step | no | `step` (integer), `to` (integer), `submodel` (string, optional) | Move a step with everything in it to another place in its submodel's order; the steps between close up and are numbered again. The step shown stays the same step. | | `submodel.create` | Pack | no | `ids` (array, optional), `name` (string) | Pack placements of one submodel into a new submodel and put one use of it in their place. | | `submodel.delete` | Delete Submodel | no | `name` (string), `with_uses` (boolean, optional) | Delete a submodel that is not the main model; one that still has uses is kept unless with_uses is true, which deletes the uses too. | | `submodel.dissolve` | Unpack | no | `id` (string, optional) | Put a use's parts back into its parent at the same places, in the use's step; the submodel goes when its last use is unpacked. | diff --git a/.agents/skills/formblocks-driving/sub-skills/clipboard/SUB-SKILL.md b/.agents/skills/formblocks-driving/sub-skills/clipboard/SUB-SKILL.md new file mode 100644 index 0000000..eafa723 --- /dev/null +++ b/.agents/skills/formblocks-driving/sub-skills/clipboard/SUB-SKILL.md @@ -0,0 +1,38 @@ +--- +name: clipboard +description: Copies, cuts and pastes parts in a FormBlocks model as LDraw part lines with clipboard.copy, clipboard.cut and clipboard.paste. Use when asked to repeat a group of parts somewhere else, move a built unit by a fixed offset, paste parts given as LDraw text, or take parts out of one place to put them down in another, and when a paste is refused or lands on top of the original. +--- + +# Clipboard + +The clipboard holds LDraw part lines: one line per placement, `1 colour x y z a b c d e f g h i part.dat`, in LDraw's axes with -Y up. It is the same text the window puts on the system clipboard with Ctrl+C, so parts copied here paste into other LDraw programs and the other way round. The engine keeps the last copy too, so a paste with no `text` uses it. + +## The three commands + +| Command | Kind | What it does | +| --- | --- | --- | +| `clipboard.copy` | read | Answers `{text, count}` for the placements in `ids` (the selection when left out). Changes nothing. | +| `clipboard.cut` | change | The same answer, and removes the placements: one undo step. | +| `clipboard.paste` | change | Adds the parts of the lines in `text` (or the engine's last copy) to the step shown of the submodel being edited, keeping colours and the places of the parts relative to each other, and selects them. | + +`paste` takes one placing rule: + +- `delta` `[x, y, z]`: the whole group moves by that offset in LDU. `delta [0, 0, 0]` puts the copies exactly on the originals, which is almost never what you want; with the overlap check on it is refused: "delta: the copies would overlap p1 by 24.0 LDU with the overlap check on, so nothing was pasted." +- `origin` and `direction` (a pointer ray in the scene's axes), with `held`, `rotation` and `snap`: seat the group the way the window seats copies held under the pointer. Use this to let snapping find the studs; use `delta` when you know the place. + +```bash +./formblocks cli run clipboard.copy 'ids=["p1","p2"]' +./formblocks cli run clipboard.paste 'delta=[100,0,0]' +./formblocks cli run clipboard.paste text=nonsense +``` + +The copy answered `count` 2 and the text of two lines; the paste with `delta [100, 0, 0]` answered two placements 100 LDU along X, in the step shown, with new ids; `text=nonsense` was refused with "text: there is no LDraw part line (a line starting with 1) to paste." and changed nothing. + +## Traps + +- New ids: the pasted parts are new placements (`p3`, `p4`), never the originals. Read their ids from the answer. +- Paste goes into the step shown and the submodel being edited. Give nothing for them: set the step first with `step.goto`, or move the parts afterwards with `step.move_parts`. +- A paste copies parts, never a part file's own lines, and lines that do not start with `1` are ignored. +- A pasted group is not checked against the parts below unless the person's overlap check is on; read the answer, then `overlap.check`. +- Repeating a unit many times is better done by packing it into a submodel (`sub-skills/submodels/SUB-SKILL.md`) than by pasting copies, because a change then shows in every use. +- From outside the window `cut` and `paste` wait for the person's answer there; `copy` never does. diff --git a/.agents/skills/formblocks-driving/sub-skills/clips-and-hinges/SUB-SKILL.md b/.agents/skills/formblocks-driving/sub-skills/clips-and-hinges/SUB-SKILL.md index a54221b..0fce61c 100644 --- a/.agents/skills/formblocks-driving/sub-skills/clips-and-hinges/SUB-SKILL.md +++ b/.agents/skills/formblocks-driving/sub-skills/clips-and-hinges/SUB-SKILL.md @@ -34,6 +34,10 @@ The clip's centre is put on the bar's line, and it slides along the bar in grid A floating bar is put exactly with `part.set_transform`, because `part.place` rounds an unseated part to the grid (the first line answered position `[4, -76, 4]` and `seated` false). With `on`, the clip took the first free stretch of the bar, its centre at y = -70. With a position, a clip whose centre was at y = -41 seated at -50, the nearest place at the Stud step. The clip of `4085c` is at `[0, 4, -20]` in the part's own axes (`part.connectors part=4085c`), so its origin ends up 4 above the clip's centre and 20 behind the bar's line. Always read `seated`, `joined` and `marks` in the answer. +## Plates that carry a clip, handle or hinge finger + +From 0.6.0 such a plate seats on studs from above: `part.fit` of `4085c` and of `2540` over a `3001` at `[3, -12, 2]` answered `seated` true at `[10, -8, -10]` and `[0, -8, -10]`, each joined to the brick's studs. A bar's `ref` (read it with `part.connectors part=2540`: `[0, 0, 1]`, the side its own plate is on) and a clip's `ref` (`[0, 0, -1]` for `4085c`) now decide the turn: a clip mates only with its body turned away from the bar's part, and snapping never turns it, so turn the clip first. The second rule is read from the specification; a clip held near a bar high in the air did not seat in either turn when tried, so treat it as not shown working here and check `seated`. + ## Seating hinge halves Snapping never turns a part. Turn the half first so its pivot line runs the way its partner's does, then place it near: it moves so the two lines meet. @@ -63,4 +67,4 @@ Two halves joined by a seated hinge answered `count` 0. A clip seated on a bar, ## Not found, not built -A hinge or clip drawn without the library's own pieces is found only where the engine's list of corrections names it (the 1 x 2 hinge brick, the swivel plates, the 1 x 1 tile with a clip); other parts do not snap, so place them by position and say so. Pins, axles, ball joints, a bar into a hole, hinge turning limits, click positions and flexible parts are not built: do not promise them. +A hinge or clip drawn without the library's own pieces is found only where the engine's list of corrections names it (the 1 x 2 hinge brick, the swivel plates, the 1 x 1 tile with a clip); other parts do not snap, so place them by position and say so. Pins and axles are in their own sub-skill (`sub-skills/pins-and-axles/SUB-SKILL.md`). Ball joints, a bar into a hole, hinge turning limits, click positions and flexible parts are not built: do not promise them. diff --git a/.agents/skills/formblocks-driving/sub-skills/colours/SUB-SKILL.md b/.agents/skills/formblocks-driving/sub-skills/colours/SUB-SKILL.md index ec4ccbb..48b6f50 100644 --- a/.agents/skills/formblocks-driving/sub-skills/colours/SUB-SKILL.md +++ b/.agents/skills/formblocks-driving/sub-skills/colours/SUB-SKILL.md @@ -45,6 +45,7 @@ Read the table again when in doubt; a library update can add colours, and the pe - Recolouring a use of a submodel in colour 16 passes the new colour to the parts inside that are in 16; parts with their own colour keep it. - `select.by_colour` selects every visible placement in a colour, then `part.recolour` without `ids` acts on that selection. - `colours.used` (read) lists the colours the model uses, most used first, each with `code`, `name`, `value`, `count` and `known` (false for a code the library does not define): the quickest way to check a build's colours. +- `colours.favourite` (view) with `colour` stars a colour in the person's palette (Starred); `on` true or false sets it, and left out it turns the star the other way. It answered `{colour: 4, on: true, favourite_colours: [4]}` and, run again, `on` false and an empty list. `colours.list` rows carry `favourite`, true for a starred colour. It is the person's setting and changes no part. - `colours.current` (view) chooses the colour the person's next part from the palette gets. It is the person's setting and recolours nothing; an agent passes `colour` on each `part.place` instead and leaves it alone. ## Choosing colours for a build diff --git a/.agents/skills/formblocks-driving/sub-skills/pins-and-axles/SUB-SKILL.md b/.agents/skills/formblocks-driving/sub-skills/pins-and-axles/SUB-SKILL.md new file mode 100644 index 0000000..f201610 --- /dev/null +++ b/.agents/skills/formblocks-driving/sub-skills/pins-and-axles/SUB-SKILL.md @@ -0,0 +1,64 @@ +--- +name: pins-and-axles +description: Seats pins and axles in beams, bushes and bricks with a hole in FormBlocks with part.fit, part.place, part.connectors and part.rotate about the pin. Use when asked to build with beams with holes, pins, friction pins, axles, bushes, or a brick with a hole, to join two beams with a pin, to put an axle through a beam, to turn a beam on its pin, or when a pin or axle will not seat or reads as a different kind than expected. +--- + +# Pins and axles + +Added in 0.6.0. The engine finds pins, axles and the holes they go into from a part's own shape, and snaps them with the same rule as studs and clips: `part.place`, `part.fit` and the window's drags all use it. Read what a part has with `part.connectors` (read; pass `kind` to list one kind). + +## The kinds + +| Kind | What it is | Pairs with | +| --- | --- | --- | +| `pin` | A round shaft that turns freely in a hole, 20 LDU long for a full pin, 10 for a half pin. | `pin_hole` | +| `pin_friction` | The same shaft with friction ribs. The engine treats it as a pin; it does not hold an angle. | `pin_hole` | +| `pin_hole` | A round bore, 20 deep in a beam. Takes a pin from either face, or an axle. | `pin`, `pin_friction`, `axle` | +| `axle` | A cross-shaped shaft, 80 LDU for an Axle 4. | `axle_hole`, `pin_hole` | +| `axle_hole` | A cross-shaped bore, as in a bush. | `axle` | + +A pin does not go into an axle hole, and neither pins nor axles go into studs or anti-studs. A pin hole takes an axle and lets it turn. Parts whose pins or holes are drawn without the library's own pieces are not found: place those by position and say so. + +## Joining two beams with a pin + +A pin joined to a beam is seated by its end. Turn the pin first, since snapping never turns a part: `3673` Technic Pin 1/2 has a pin at each end, and with the matrix `0 1 0 / -1 0 0 / 0 0 1` its first end points down. + +```bash +./formblocks cli run part.place part=32524 colour=7 'position=[0,0,0]' +./formblocks cli run part.set_transform id=p1 'position=[0,0,0]' +./formblocks cli run part.place part=3673 colour=4 'position=[1,-13,2]' 'rotation=[0,1,0,-1,0,0,0,0,1]' +./formblocks cli run part.place part=32524 colour=7 'position=[2,-24,-41]' +``` + +Run here: the pin answered `seated` true at `[0, -10, 0]` with one joined pair and a mark at `[0, 10, 0]`, and the second beam seated at `[0, -20, -40]`, joined to the pin. The first line rounded the beam to `[9, -2, 9]` (an unseated part goes to the grid), hence the `part.set_transform`. `overlap.check` answered `count` 0 and `nested_count` 0: a pin fitted in a hole is joined, not an overlap. + +## Turning a beam on its pin + +`part.pivot` on the second beam answers kind `hinge`, about `[0, -20, 0]` along the pin; give both to `part.rotate`. + +```bash +./formblocks cli run part.pivot 'ids=["p3"]' +./formblocks cli run part.rotate 'ids=["p3"]' 'axis_vector=[0,1,0]' 'about=[0,-20,0]' angle=45 +``` + +The beam turned 45 degrees to `[-28.284, -20, -28.284]` and `overlap.check` still answered `count` 0. A beam turns all the way round on a pin; turning limits are not built. + +## An axle through a beam + +An axle is seated on a hole's line and slides along it in grid steps from its middle. + +```bash +./formblocks cli run part.fit part=3705 'position=[1,-7,2]' 'rotation=[0,1,0,-1,0,0,0,0,1]' +``` + +Run here against the same lone beam: `3705` Axle 4, turned upright, answered `seated` true at `[0, 0, 0]` (the beam's middle hole), mark at `[0, -40, 0]`. Unturned, the same call answered `seated` false: the axle must run along the hole. A bush turned to take it was fitted at `[1, -48, 2]` and answered false in this run, with no axle there; seating a bush on an axle is described in the specification (`spec/CONNECTIONS.md`, example 11) and not run here. + +## Reading and failures + +- `part.connectors part=32524` lists seven `pin_hole` entries, each `length` 20. +- `part.connectors part=3705` lists one `axle`, `length` 80. +- When a pin or axle does not seat, check the turn first (axis along the hole), then the distance (within the snap reach of the hole), then that the hole is not already taken. + +## Not built + +Ball joints and sockets, gears meshing, flexible parts, other scales' pins (the Scala pin), turning limits, friction as a held angle, and click positions on axles. Do not promise them. diff --git a/.agents/skills/formblocks-driving/sub-skills/placing-and-snapping/SUB-SKILL.md b/.agents/skills/formblocks-driving/sub-skills/placing-and-snapping/SUB-SKILL.md index 43eb734..908bae0 100644 --- a/.agents/skills/formblocks-driving/sub-skills/placing-and-snapping/SUB-SKILL.md +++ b/.agents/skills/formblocks-driving/sub-skills/placing-and-snapping/SUB-SKILL.md @@ -12,7 +12,7 @@ Read `references/coordinates-and-units.md` first if positions in LDU with -Y up - A stud is the round knob on top of a part, 4 LDU high, on a 20 LDU grid. - An anti-stud is a place on a part's underside that takes one stud: the gaps between the walls and tubes of a brick, or the inside of a tube. - A part is seated when its anti-studs sit on another part's studs (or its studs in another part's anti-studs). Seating is how real bricks hold together, so a model built of seated parts is one that could be built. -- FormBlocks finds these connectors from each part's own geometry; `part.connectors` lists them for any part. Only ordinary studs and anti-studs exist in this version: pins, axles, clips and hinges do not seat. +- FormBlocks finds these connectors from each part's own geometry; `part.connectors` lists them for any part. Studs and anti-studs are the ordinary joins; clips on bars and hinge halves seat too (`sub-skills/clips-and-hinges/SUB-SKILL.md`). Pins and axles seat in holes (`sub-skills/pins-and-axles/SUB-SKILL.md`); ball joints do not seat yet. ## The ground @@ -41,7 +41,7 @@ With snapping off (`snap: false`), the part goes exactly to the position, seated Snapping never turns a part. To seat crosswise, give the turned `rotation`. -Snapping, the grid step and the overlap check are the person's settings: `snap.set` (`on`), `grid.step` (`stud`, `plate` or `fine`) and `overlap.set` (`on`) change them for every later placement, in the window too. Pass `snap` on one call instead, and change a setting only when the person asks. +Snapping, the grid step and the overlap check are the person's settings: `snap.set` (`on`), `grid.step` (`stud`, `plate` or `fine`) and `overlap.set` (`on`) change them for every later placement, in the window too. `snap.toggle`, `overlap.toggle` and `grid.next` flip or step the same settings from the engine's own state, which is what the window's keys use, so two quick presses end where they began; prefer the `set` forms, which say the end state. Pass `snap` on one call instead, and change a setting only when the person asks. A fourth way to say where is a pointer ray, as the window drops the ghost: `part.place_at_ray`, in the scene's axes. It also rests a part on what lies under its whole footprint, so a plate dropped over an open gap lies across the parts either side. `sub-skills/moving-parts/SUB-SKILL.md` covers it. diff --git a/.agents/skills/formblocks-driving/sub-skills/selection/SUB-SKILL.md b/.agents/skills/formblocks-driving/sub-skills/selection/SUB-SKILL.md index 2449d58..2872006 100644 --- a/.agents/skills/formblocks-driving/sub-skills/selection/SUB-SKILL.md +++ b/.agents/skills/formblocks-driving/sub-skills/selection/SUB-SKILL.md @@ -22,6 +22,10 @@ Selection commands are `view` commands: they change what is shown, never the mod | `select.invert` | none | Every visible placement that was not selected, letting go of the rest. | | `select.by_colour` | `colour` | Every visible placement in that colour, or in the colours of the selection when left out. | | `select.by_part` | `part` | Every visible placement of that part, or of the parts of the selection when left out. A printed part counts as a different part. | +| `select.by_part_colour` | `ids` | Every visible placement that matches one of the given placements, or of the selection, in both its part and its colour. | +| `select.attached` | `ids` | The given placements, or the selection, and every visible placement joined to them through seated connectors, however far the chain goes; a use of a submodel joins nothing. | + +`select.by_colour`, `select.by_part`, `select.by_part_colour` and `select.attached` also take `add` (true): the matches are added to the selection instead of replacing it. In a model of two stacked red and blue 2 x 4 bricks, a red 2 x 2 plate on its own and a red 2 x 4 brick elsewhere, `select.attached` for the lower brick answered both stacked bricks and nothing else, and `select.by_colour` for red answered the three red parts. ## Rules @@ -45,6 +49,7 @@ So you can follow what they tell you (`spec/SPEC.md` 6.1): - A click selects one part; a click on empty space or the ground clears the selection. Shift+click adds a part; Ctrl+click (Cmd on macOS) adds it or takes it away. - A drag that starts on empty space draws a selection box. Left to right selects the parts wholly inside it, right to left every part it touches. Shift with the box adds; Ctrl adds the parts not yet selected or, when all are, takes them away. Esc while drawing drops the box. - A drag that starts on a part moves it, or the selection it belongs to (`sub-skills/moving-parts/SUB-SKILL.md`). +- Q goes through the pick modes a click uses (one part, same colour, same part, same part and colour, attached), and the Select menu has the same four kinds; each reaches the engine as the matching `select.*` command. - Ctrl+A selects all, Ctrl+I inverts, Esc clears. Rows of the Model, Steps and Parts tabs select their parts too. The box needs the view, so it has no command: an agent selects by ids or by kind. Every selection the person makes reaches the engine as `select.*` commands, so `select.get` always answers what the window shows. diff --git a/.agents/skills/formblocks-driving/sub-skills/steps/SUB-SKILL.md b/.agents/skills/formblocks-driving/sub-skills/steps/SUB-SKILL.md index 8821ae3..6ee30e7 100644 --- a/.agents/skills/formblocks-driving/sub-skills/steps/SUB-SKILL.md +++ b/.agents/skills/formblocks-driving/sub-skills/steps/SUB-SKILL.md @@ -15,6 +15,8 @@ Each submodel has its own building steps, numbered from 1. Every placement is in | `step.goto` | view | `index` or `to` | Shows step `index` of the submodel being edited, or the `first`, `previous`, `next` or `last` step. New parts go into the step shown. Walking a model step by step is `sub-skills/step-walking/SUB-SKILL.md`. | | `step.break_after` | change | `id` | Starts a new step after placement `id`, moving the placements after it in its step into the new step. With no `id`, adds an empty step after the step shown and shows it. | | `step.move_parts` | change | `ids`, `step` | Moves placements into another step of their submodel; one past the last starts a new step at the end. | +| `step.move_to_new` | change | `ids` | Puts the placements into a new step right after the step shown, and shows it. With the step shown being 2 of 3, the placement went into a new step 3 and the old step 3 became 4. | +| `step.reorder` | change | `step`, `to`, `submodel` | Moves a whole step, with its parts, to another place in the order; the steps between close up and are renumbered. With three steps of one brick each, `step=3 to=1` answered the old third step first. A `to` outside the steps ("to must be from 1 to 3 in untitled.ldr.") or equal to `step` ("step 1 is already number 1; nothing moved.") is refused. | | `step.rename` | change | `step`, `name`, `submodel` | Names a step; an empty name clears it. | | `step.delete` | change | `step`, `submodel` | Deletes a step; its placements move to the start of the next step, or to the end of the step before when it was the last. A submodel keeps at least one step. | diff --git a/.agents/skills/formblocks-harness/SKILL.md b/.agents/skills/formblocks-harness/SKILL.md index a0cc957..427d375 100644 --- a/.agents/skills/formblocks-harness/SKILL.md +++ b/.agents/skills/formblocks-harness/SKILL.md @@ -4,7 +4,7 @@ description: "Use when asked to install, boot, verify, debug, extend or release license: Apache-2.0 metadata: product: FormBlocks - pack-version: "0.5.0" + pack-version: "0.6.0" audience: developer agent --- diff --git a/.agents/skills/formblocks-harness/sub-skills/add-connector-kind/SUB-SKILL.md b/.agents/skills/formblocks-harness/sub-skills/add-connector-kind/SUB-SKILL.md index 1559257..e046f9a 100644 --- a/.agents/skills/formblocks-harness/sub-skills/add-connector-kind/SUB-SKILL.md +++ b/.agents/skills/formblocks-harness/sub-skills/add-connector-kind/SUB-SKILL.md @@ -1,6 +1,6 @@ --- name: add-connector-kind -description: Adds a connector kind to FormBlocks' connection model as a module that registers itself in backend/app/connect/kinds/, with its data beside it as JSON. Use when adding a joint beyond studs, anti-studs, clips, bars and the hinge families, such as pins or axles, when correcting the primitive list of an existing kind, or when a part's connectors come out wrong. +description: Adds a connector kind to FormBlocks' connection model as a module that registers itself in backend/app/connect/kinds/, with its data beside it as JSON. Use when adding a joint beyond studs, anti-studs, clips, bars, the hinge families, pins and axles, such as ball joints or gears, when correcting the primitive list of an existing kind, or when a part's connectors come out wrong. --- # Add a connector kind @@ -16,7 +16,7 @@ Load `sub-skills/laws-and-logs/SUB-SKILL.md` and `sub-skills/clean-room-and-spec ## Where the module lives -- `backend/app/connect/kinds/[kind].py`, one module per kind or per family of kinds. `kinds.load()` imports every module in the package whose name does not start with `_`, in name order, so no list is edited anywhere. +- `backend/app/connect/kinds/[kind].py`, one module per kind or per family of kinds (`pin.py` holds three pin kinds, `axle.py` two, and `_shaft.py` is the measuring they share). `kinds.load()` imports every module in the package whose name does not start with `_`, in name order, so no list is edited anywhere. - The module's data (primitive file names, tolerances) sits beside it as `[kind].json` and is read when the module loads, so a list can be corrected without touching code. A data file that cannot be read stops the engine with a sentence naming the file. - At the end of the module, one call per kind: `PIN = register(PinKind())`. @@ -42,6 +42,10 @@ A subclass of `Kind` from `backend/app/connect/kinds/__init__.py`: `kinds/clip.py` (clip and bar) and `kinds/hinge.py` (the five hinge families, three read from primitives and two from overrides only) are the worked examples; each has its numbers in `clip.json` or `hinge.json`. `mates_with` is declared once per kind and the registry makes it symmetric, so a half pairs only with the other half of its own family. +`kinds/pin.py` (`pin`, `pin_friction`, `pin_hole`) and `kinds/axle.py` (`axle`, `axle_hole`), with `_shaft.py` for what they share, are the worked examples of a kind built in two passes. No primitive draws a whole hole, so `claims` and `from_reference` make one piece per open face (a face point and the inward direction), and `settle` joins the pieces once the walk is over: two faces that look at each other on one line, nearest first and at most `max_depth` apart, become one hole; a face left alone has its bore probed for its depth. A hole is a point with a depth: its `position` is the middle of the bore, its `axis` runs along it, its `length` is the depth from face to face, and the mate puts a pin's collar at the hole's near face, half the depth from `position` (`spec/CONNECTIONS.md`, "The mate of a pin in a hole"). A pin or an axle is a segment (`spans`), so a long one can take two holes. + +`version` is read from the top of the kind's JSON file (`"version"` in `pin.json`, `axle.json`, `clip.json`), not written in the module: raise it there in the same commit whenever the kind's rule or its data changes, and every cached part is derived again. + Connectors already carry `ref` (for kinds whose turn about the axis matters) and `length` (for kinds that slide), so the connector shape does not change. ## Overrides diff --git a/.claude/skills/formblocks-driving/SKILL.md b/.claude/skills/formblocks-driving/SKILL.md index 906173e..41713d7 100644 --- a/.claude/skills/formblocks-driving/SKILL.md +++ b/.claude/skills/formblocks-driving/SKILL.md @@ -1,10 +1,10 @@ --- name: formblocks-driving -description: "Use when asked to build, stack, change, check, picture or save a brick model in FormBlocks through its MCP tools or ./formblocks cli: a wall, a tower, a house, a table, any LDraw model. Finds parts and colours in the LDraw parts library, places and seats bricks, clips and hinge halves on placements or the ground, builds walls in overlapping courses with plates, tiles and slopes, moves, turns, duplicates and recolours parts, uses the selection and submodels, splits a model into steps and walks them, counts parts and saves the parts list as CSV, saves PNG pictures and reads them back to check a build, checks overlaps, and opens, saves and exports .fblk, .ldr and .mpd files. Covers Claude Code, Codex, Cursor and Antigravity in the agent dock or outside it, and the person's approval, which an agent never gives itself. Includes worked examples, coordinates, error codes and scripts. Not for changing FormBlocks' source code or installing it (formblocks-harness)." +description: "Use when asked to build, stack, change, check, picture or save a brick model in FormBlocks through its MCP tools or ./formblocks cli: a wall, a tower, a house, a table, any LDraw model. Finds parts and colours in the LDraw parts library, places and seats bricks, clips and hinge halves on placements or the ground, builds walls in overlapping courses with plates, tiles and slopes, moves, turns, duplicates, copies, pastes and recolours parts, uses the selection and submodels, splits a model into steps and walks them, counts parts and saves the parts list as CSV, saves PNG pictures and reads them back to check a build, checks overlaps, and opens, saves and exports .fblk, .ldr and .mpd files. Covers Claude Code, Codex, Cursor and Antigravity in the agent dock or outside it, and the person's approval, which an agent never gives itself. Includes worked examples, coordinates, error codes and scripts. Not for changing FormBlocks' source code or installing it (formblocks-harness)." license: Apache-2.0 metadata: product: FormBlocks - pack-version: "0.5.0" + pack-version: "0.6.0" audience: operating agent --- @@ -23,6 +23,8 @@ FormBlocks keeps one open model in its engine: submodels holding placements of L | Clips on bars, hinge halves, hinge plates and bricks, swivel plates, sliding a clip, folding a hinge, part.connectors kinds | `sub-skills/clips-and-hinges/SUB-SKILL.md` | | Planning a build, walls in overlapping courses, corners, openings, plates and tiles, roofs of slopes | `sub-skills/building-in-order/SUB-SKILL.md` | | Moving, turning, duplicating, recolouring, hiding, showing and deleting placements, undo and redo | `sub-skills/changing-parts/SUB-SKILL.md` | +| Beams with holes, pins, friction pins, axles, bushes, a brick with a hole, joining beams, turning a beam on a pin | `sub-skills/pins-and-axles/SUB-SKILL.md` | +| Copying, cutting and pasting parts as LDraw lines, repeating a group at an offset, clipboard.copy, clipboard.cut, clipboard.paste | `sub-skills/clipboard/SUB-SKILL.md` | | Turning parts by any angle, about a point, an axis or a hinge's axis, part.pivot, the angle step, a turn lifted or refused | `sub-skills/turning-parts/SUB-SKILL.md` | | Moving or copying parts along a pointer ray as the window drags them, part.pick, the scene's axes, resting across a gap, what the person's drags and Ctrl+D do | `sub-skills/moving-parts/SUB-SKILL.md` | | Reading and setting the selection, selecting by colour or part, showing the person which parts | `sub-skills/selection/SUB-SKILL.md` | diff --git a/.claude/skills/formblocks-driving/references/command-catalogue.md b/.claude/skills/formblocks-driving/references/command-catalogue.md index 9c9f875..7c1baaf 100644 --- a/.claude/skills/formblocks-driving/references/command-catalogue.md +++ b/.claude/skills/formblocks-driving/references/command-catalogue.md @@ -4,8 +4,8 @@ Written by `./formblocks agents sync` from the engine's command catalogue; never ## Contents -- MCP tools: the 72 tools an agent sees, each with whether it only reads. -- Commands: the 66 catalogue commands with their titles, parameters and summaries, in name order. +- MCP tools: the 85 tools an agent sees, each with whether it only reads. +- Commands: the 79 catalogue commands with their titles, parameters and summaries, in name order. ## MCP tools @@ -17,10 +17,16 @@ Written by `./formblocks agents sync` from the engine's command catalogue; never | `formblocks_redo` | no | Redo changes that formblocks_undo took back, one step each. A new change after an undo empties what can be redone. Returns {revision, labels, label}. | | `formblocks_status` | yes | Read what this FormBlocks is: its version, the model's revision, placement count, file and unsaved mark, how many commands there are, its data folder, whether the window's engine is running, and the person's standing choice for outside agents (ask, allowed or blocked). Call it first. | | `formblocks_undo` | no | Undo the last changes, one step per command. Returns {revision, labels, label}: the new revision and the titles of the commands taken back, newest first. Nothing to undo answers an empty labels list. | +| `cmd_angle_next` | yes | Go to the next angle step after the engine's own: 90, 45, 22.5, 15, 5, 1 degrees, then 90 again. Kept as the person's setting. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_angle_step` | yes | Choose the angle step a turn with the pointer moves in and Alt with R, T or Y turns by: 90, 45, 22.5, 15, 5 or 1 degrees. Kept as the person's setting. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | +| `cmd_clipboard_copy` | yes | Write placements as LDraw part lines (type 1, colour, position, rotation, file name), the text the window puts on the system clipboard; the engine keeps it too, for clipboard.paste without text. Only reads. | +| `cmd_clipboard_cut` | no | Copy placements as LDraw part lines, as clipboard.copy does, and remove them from the model. One undo step. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | +| `cmd_clipboard_paste` | no | Add the parts that LDraw part lines name, keeping their colours and their places relative to one another, into the step shown of the submodel being edited; they become the selection. With a pointer ray in the window's scene axes they go where the ray takes the lowest of them, seated, resting or refused exactly as a drag of copies; without one they go where the lines put them, moved by delta. One undo step. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_colours_current` | yes | Choose the colour the next placed part gets, and put it at the front of the recent colours. Kept as the person's setting; it recolours nothing. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | +| `cmd_colours_favourite` | yes | Star or unstar a colour: a starred colour is listed among the favourite colours, newest first. Left out, on turns the star the other way. Kept as the person's setting; it changes no model. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_colours_list` | yes | List the library's colours with code, name, value, edge and finish, or the swatches of one group, hue family or name words. Only reads. | | `cmd_colours_used` | yes | List the colours used in the open model, most used first: each colour's number, name, value, how many parts of the whole model are in it, and whether the library defines it. Only reads. | +| `cmd_grid_next` | yes | Go to the next grid step after the engine's own: stud, plate, fine, then stud again. Kept as the person's setting. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_grid_step` | yes | Choose the grid step: stud (20 LDU across, 8 up), plate (10 across, 8 up) or fine (1 and 1). Kept as the person's setting. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_library_status` | yes | Read whether a parts library is in use, where it was found, its update, whether its index is ready, the fetch in progress if any, and the consent and attribution the library card shows. Reading never fetches; only the person can consent to a fetch. Only reads. | | `cmd_model_info` | yes | Read the model's name, description (its title line), author, file, format and the library update it was saved with and the one in use; its counts (placements, parts through every use, different parts, colours, part and colour pairs, submodels, steps, missing parts, and overlapping pairs as overlap.check counts them); the parts the library lacks by number; its size in LDU, studs, bricks and millimetres; the licences model.set_info accepts; and its parts list unless table is false. Only reads. | @@ -35,7 +41,9 @@ Written by `./formblocks agents sync` from the engine's command catalogue; never | `cmd_model_tree` | yes | Read one submodel's steps and placements, each with its id, part, colour, position, rotation, step and hidden mark, and the submodels with their uses. Only reads. | | `cmd_overlap_check` | yes | List each pair of overlapping placements, for the given placements or the whole model: two parts whose real shapes cut more than 1 LDU into each other, with the depth in LDU and the shared volume in cubic LDU. Parts joined through seated connectors never count. Nested pairs, one part sitting in another's hollow by design, are counted apart in nested_count and listed under nested when asked. Only reads. | | `cmd_overlap_nested` | yes | Choose what the overlap check reports: false reports only real overlaps (the proposed default), true reports nested pairs too, parts that sit in another's hollow by design, such as a rim in its tyre or a pin in its hole. Nested pairs never block placing or moving either way. Kept as the person's setting. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | +| `cmd_overlap_nested_toggle` | yes | Turn the reporting of nested pairs off when it is on and on when it is off, deciding from the engine's own setting. Kept as the person's setting. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_overlap_set` | yes | Turn the overlap check on or off: with it on, placing and moving never put a part where its real shape would cut more than 1 LDU into another's. Kept as the person's setting. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | +| `cmd_overlap_toggle` | yes | Turn the overlap check off when it is on and on when it is off, deciding from the engine's own setting, so two quick presses always end where they began. Kept as the person's setting. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_part_connectors` | yes | List a library part's connectors as the connection model derives them: kind, position, axis, ref, length, index and where each came from, with the counts, the body box and the footprint; kind keeps only connectors of one kind. Only reads. | | `cmd_part_delete` | no | Remove placements from the model; deleting the last use of a submodel keeps the submodel. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_part_duplicate` | no | Copy placements, keeping colours and relative places, offset by delta; the copies go into the step shown and become the selection. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | @@ -43,7 +51,7 @@ Written by `./formblocks agents sync` from the engine's command catalogue; never | `cmd_part_fit` | yes | Answer where a part would go and which connectors it would join, from a position, a placement to seat on, or a pointer ray, with snapping, the grid step and the overlap check as set; changes nothing. Position and rotation are in LDraw axes (-Y up); a pointer ray is in the window's scene axes (+Y up), as for every command that takes one. Only reads. | | `cmd_part_hide` | no | Hide placements: they stay in the model but are not drawn or picked, and the project file remembers it. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_part_hide_others` | no | Hide every placement of the submodel being edited except the given ones or the selection, to work on one area alone. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | -| `cmd_part_move` | no | Move placements by an offset in LDU, exactly, with no snapping. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | +| `cmd_part_move` | no | Move placements by an offset in LDU, exactly, with no snapping; with the overlap check on, a move into a part that does not move is refused. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_part_move_at_ray` | no | Put down a dragged selection where a pointer ray in the window's scene axes takes the grabbed placement, seated, on the grid or refused exactly as the drag preview answers, resting on what lies under its footprint when the place under the pointer would cut into another part; the others keep their places relative to it. Give held as the drag preview answered it so the part lands as previewed. One undo step. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_part_pick` | yes | Name the placement of the submodel being edited that a pointer ray in the window's scene axes meets first on its real triangles, with the point and the face's normal, or the ground; hidden parts are passed through. Only reads. | | `cmd_part_pivot` | yes | Say what placements turn about when the pivot dial turns them: the centre of the box around their shapes with the X, Y and Z axes, or, for one part joined by a hinge, the hinge's point and axis alone; with a pointer ray, the point where it meets a part of the submodel being edited (or the connector within 8 LDU of it), with X, Y and Z, and as without a ray when it meets none. Each point and axis in LDraw's axes and in the window's scene axes, with how far the box reaches from the point. Only reads. | @@ -51,7 +59,7 @@ Written by `./formblocks agents sync` from the engine's command catalogue; never | `cmd_part_place_at_ray` | no | Place a library part where a pointer ray in the window's scene axes puts it, seated, on the grid or refused exactly as the placement preview answers, resting on what lies under its whole footprint when the place under the pointer would cut into another part; it goes into the step shown of the submodel being edited and becomes the selection. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_part_recolour` | no | Give placements a colour; a use of a submodel in colour 16 passes it to its parts in colour 16. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_part_rotate` | no | Turn placements about an axis through a point: by whole quarter turns, or by an angle in degrees, about X, Y, Z or any direction in LDraw axes, about the centre of their box when no point is given. What turned is lifted straight up when it would end below the ground, and with the overlap check on a turn into a part that does not turn is refused. One undo step. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | -| `cmd_part_set_transform` | no | Put one placement at an exact position, rotation or both, as the details panel does. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | +| `cmd_part_set_transform` | no | Put one placement at an exact position, rotation or both, as the details panel does; with the overlap check on, a place inside another part is refused. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_part_show` | no | Show hidden placements again; every hidden placement in the model when no ids are given (Show all). Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_parts_list` | yes | Read the parts a model needs, one row per part and colour with its description, colour name, count and the placements of the submodel being edited that hold it; a submodel's parts counted once for each use unless submodels is row, a moved part counted under the number it moved to, parts missing from the library first and marked. With text true the answer also holds the list as tab separated text. Only reads. | | `cmd_parts_list_save` | no | Write the parts list to a file as CSV in UTF-8 with a byte order mark and CR LF line ends: a header row, then one row per part and colour with LDraw part number, description, LDraw colour number, colour name and count; comma separated, or tab separated for a .tsv path or separator tab. A cell starting with =, +, - or @ is written after an apostrophe so a spreadsheet reads it as text. Opens, starts or writes a model file; not an undo step. An outside agent waits for the person to allow it in the window. | @@ -61,20 +69,25 @@ Written by `./formblocks agents sync` from the engine's command catalogue; never | `cmd_picture_steps` | no | Draw one PNG for every step of the submodel being edited, each showing the steps up to it, and write them into a folder as name-01.png, name-02.png and so on. Needs the FormBlocks window open. Opens, starts or writes a model file; not an undo step. An outside agent waits for the person to allow it in the window. | | `cmd_select_add` | yes | Add placements to the selection. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_select_all` | yes | Select every visible placement of the submodel being edited. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | +| `cmd_select_attached` | yes | Select the given placements, or the selection, and every visible placement joined to them through seated connectors, however far the chain goes; a use of a submodel joins nothing. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_select_by_colour` | yes | Select every visible placement in a colour, or in the colours of the selection when no colour is given. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_select_by_part` | yes | Select every visible placement of a part, or of the parts of the selection when no part is given; a printed part is a different part. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | +| `cmd_select_by_part_colour` | yes | Select every visible placement that matches one of the given placements, or of the selection, in both its part and its colour; a printed part is a different part. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_select_clear` | yes | Clear the selection. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_select_get` | yes | Read the selection: the placements, how many, in how many colours, and the centre of their origins. Only reads. | | `cmd_select_invert` | yes | Select every visible placement that was not selected and let go of the rest. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_select_remove` | yes | Let go of placements without touching the rest of the selection. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_select_set` | yes | Make the selection exactly these placements; an empty list clears it. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_snap_set` | yes | Turn snapping on or off: with it on, a part being placed or moved seats on free compatible connectors within reach; with it off, it moves in grid steps only. Kept as the person's setting. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | +| `cmd_snap_toggle` | yes | Turn snapping off when it is on and on when it is off, deciding from the engine's own setting, so two quick presses always end where they began. Kept as the person's setting. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_step_break_after` | no | Start a new step after a placement, moving the placements after it in its step into the new step; with no id, add an empty step after the step shown and show it. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_step_delete` | no | Delete a step; its placements move to the start of the next step, or to the end of the step before when it is the last. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_step_goto` | yes | Show a step of the submodel being edited, by number or as first, previous, next or last: every placement of steps 1 to it is drawn, later ones are hidden, and new parts go into it. Changes only the view (the selection, the step shown or the submodel being edited); no undo step. | | `cmd_step_list` | yes | Read the steps of a submodel: each step's number, name and placement ids, and which step is shown. Only reads. | | `cmd_step_move_parts` | no | Move placements of one submodel into another of its steps; one past the last step starts a new step at the end. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | +| `cmd_step_move_to_new` | no | Put placements of one submodel into a new step right after the step shown, and show it. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_step_rename` | no | Name a step, or clear its name with an empty name; the name is kept in the file as the step's first line. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | +| `cmd_step_reorder` | no | Move a step with everything in it to another place in its submodel's order; the steps between close up and are numbered again. The step shown stays the same step. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_submodel_create` | no | Pack placements of one submodel into a new submodel and put one use of it in their place. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_submodel_delete` | no | Delete a submodel that is not the main model; one that still has uses is kept unless with_uses is true, which deletes the uses too. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | | `cmd_submodel_dissolve` | no | Put a use's parts back into its parent at the same places, in the use's step; the submodel goes when its last use is unpacked. Changes the model; one undo step. An outside agent waits for the person to allow it in the window. | @@ -88,10 +101,16 @@ Written by `./formblocks agents sync` from the engine's command catalogue; never | Command | Title | Reads only | Parameters | What it does | | --- | --- | --- | --- | --- | +| `angle.next` | Next Angle Step | yes | none | Go to the next angle step after the engine's own: 90, 45, 22.5, 15, 5, 1 degrees, then 90 again. Kept as the person's setting. | | `angle.step` | Angle Step | yes | `step` (number) | Choose the angle step a turn with the pointer moves in and Alt with R, T or Y turns by: 90, 45, 22.5, 15, 5 or 1 degrees. Kept as the person's setting. | +| `clipboard.copy` | Copy | yes | `ids` (array, optional) | Write placements as LDraw part lines (type 1, colour, position, rotation, file name), the text the window puts on the system clipboard; the engine keeps it too, for clipboard.paste without text. | +| `clipboard.cut` | Cut | no | `ids` (array, optional) | Copy placements as LDraw part lines, as clipboard.copy does, and remove them from the model. One undo step. | +| `clipboard.paste` | Paste | no | `text` (string, optional), `origin` (array, optional), `direction` (array, optional), `rotation` (array, optional), `held` (integer, optional), `snap` (boolean, optional), `delta` (array, optional) | Add the parts that LDraw part lines name, keeping their colours and their places relative to one another, into the step shown of the submodel being edited; they become the selection. With a pointer ray in the window's scene axes they go where the ray takes the lowest of them, seated, resting or refused exactly as a drag of copies; without one they go where the lines put them, moved by delta. One undo step. | | `colours.current` | Current Colour | yes | `colour` (integer) | Choose the colour the next placed part gets, and put it at the front of the recent colours. Kept as the person's setting; it recolours nothing. | +| `colours.favourite` | Favourite Colour | yes | `colour` (integer), `on` (boolean, optional) | Star or unstar a colour: a starred colour is listed among the favourite colours, newest first. Left out, on turns the star the other way. Kept as the person's setting; it changes no model. | | `colours.list` | Colours | yes | `text` (string, optional), `group` (string, optional), `hue` (string, optional) | List the library's colours with code, name, value, edge and finish, or the swatches of one group, hue family or name words. | | `colours.used` | Colours Used | yes | none | List the colours used in the open model, most used first: each colour's number, name, value, how many parts of the whole model are in it, and whether the library defines it. | +| `grid.next` | Next Grid Step | yes | none | Go to the next grid step after the engine's own: stud, plate, fine, then stud again. Kept as the person's setting. | | `grid.step` | Grid Step | yes | `step` (string) | Choose the grid step: stud (20 LDU across, 8 up), plate (10 across, 8 up) or fine (1 and 1). Kept as the person's setting. | | `library.status` | Library Status | yes | none | Read whether a parts library is in use, where it was found, its update, whether its index is ready, the fetch in progress if any, and the consent and attribution the library card shows. Reading never fetches; only the person can consent to a fetch. | | `model.info` | Model Information | yes | `table` (boolean, optional) | Read the model's name, description (its title line), author, file, format and the library update it was saved with and the one in use; its counts (placements, parts through every use, different parts, colours, part and colour pairs, submodels, steps, missing parts, and overlapping pairs as overlap.check counts them); the parts the library lacks by number; its size in LDU, studs, bricks and millimetres; the licences model.set_info accepts; and its parts list unless table is false. | @@ -106,7 +125,9 @@ Written by `./formblocks agents sync` from the engine's command catalogue; never | `model.tree` | Model Tree | yes | `submodel` (string, optional) | Read one submodel's steps and placements, each with its id, part, colour, position, rotation, step and hidden mark, and the submodels with their uses. | | `overlap.check` | Check Overlaps | yes | `ids` (array, optional), `nested` (boolean, optional) | List each pair of overlapping placements, for the given placements or the whole model: two parts whose real shapes cut more than 1 LDU into each other, with the depth in LDU and the shared volume in cubic LDU. Parts joined through seated connectors never count. Nested pairs, one part sitting in another's hollow by design, are counted apart in nested_count and listed under nested when asked. | | `overlap.nested` | Nested Pairs | yes | `on` (boolean) | Choose what the overlap check reports: false reports only real overlaps (the proposed default), true reports nested pairs too, parts that sit in another's hollow by design, such as a rim in its tyre or a pin in its hole. Nested pairs never block placing or moving either way. Kept as the person's setting. | +| `overlap.nested_toggle` | Nested Pairs On or Off | yes | none | Turn the reporting of nested pairs off when it is on and on when it is off, deciding from the engine's own setting. Kept as the person's setting. | | `overlap.set` | Overlap Check | yes | `on` (boolean) | Turn the overlap check on or off: with it on, placing and moving never put a part where its real shape would cut more than 1 LDU into another's. Kept as the person's setting. | +| `overlap.toggle` | Overlap Check On or Off | yes | none | Turn the overlap check off when it is on and on when it is off, deciding from the engine's own setting, so two quick presses always end where they began. Kept as the person's setting. | | `part.connectors` | Part Connectors | yes | `part` (string), `kind` (string, optional) | List a library part's connectors as the connection model derives them: kind, position, axis, ref, length, index and where each came from, with the counts, the body box and the footprint; kind keeps only connectors of one kind. | | `part.delete` | Delete | no | `ids` (array, optional) | Remove placements from the model; deleting the last use of a submodel keeps the submodel. | | `part.duplicate` | Duplicate | no | `ids` (array, optional), `delta` (array, optional) | Copy placements, keeping colours and relative places, offset by delta; the copies go into the step shown and become the selection. | @@ -114,7 +135,7 @@ Written by `./formblocks agents sync` from the engine's command catalogue; never | `part.fit` | Fit Part | yes | `part` (string), `rotation` (array, optional), `position` (array, optional), `on` (string, optional), `origin` (array, optional), `direction` (array, optional), `ids` (array, optional), `submodel` (string, optional), `snap` (boolean, optional) | Answer where a part would go and which connectors it would join, from a position, a placement to seat on, or a pointer ray, with snapping, the grid step and the overlap check as set; changes nothing. Position and rotation are in LDraw axes (-Y up); a pointer ray is in the window's scene axes (+Y up), as for every command that takes one. | | `part.hide` | Hide | no | `ids` (array, optional) | Hide placements: they stay in the model but are not drawn or picked, and the project file remembers it. | | `part.hide_others` | Hide Others | no | `ids` (array, optional) | Hide every placement of the submodel being edited except the given ones or the selection, to work on one area alone. | -| `part.move` | Move | no | `ids` (array, optional), `delta` (array) | Move placements by an offset in LDU, exactly, with no snapping. | +| `part.move` | Move | no | `ids` (array, optional), `delta` (array) | Move placements by an offset in LDU, exactly, with no snapping; with the overlap check on, a move into a part that does not move is refused. | | `part.move_at_ray` | Move Selection at Pointer | no | `grab` (string), `origin` (array), `direction` (array), `rotation` (array, optional), `held` (integer, optional), `ids` (array, optional), `snap` (boolean, optional) | Put down a dragged selection where a pointer ray in the window's scene axes takes the grabbed placement, seated, on the grid or refused exactly as the drag preview answers, resting on what lies under its footprint when the place under the pointer would cut into another part; the others keep their places relative to it. Give held as the drag preview answered it so the part lands as previewed. One undo step. | | `part.pick` | Pick at Pointer | yes | `origin` (array), `direction` (array), `ground` (boolean, optional) | Name the placement of the submodel being edited that a pointer ray in the window's scene axes meets first on its real triangles, with the point and the face's normal, or the ground; hidden parts are passed through. | | `part.pivot` | Pivot | yes | `ids` (array, optional), `origin` (array, optional), `direction` (array, optional) | Say what placements turn about when the pivot dial turns them: the centre of the box around their shapes with the X, Y and Z axes, or, for one part joined by a hinge, the hinge's point and axis alone; with a pointer ray, the point where it meets a part of the submodel being edited (or the connector within 8 LDU of it), with X, Y and Z, and as without a ray when it meets none. Each point and axis in LDraw's axes and in the window's scene axes, with how far the box reaches from the point. | @@ -122,7 +143,7 @@ Written by `./formblocks agents sync` from the engine's command catalogue; never | `part.place_at_ray` | Place Part at Pointer | no | `part` (string), `colour` (integer), `origin` (array), `direction` (array), `rotation` (array, optional), `held` (integer, optional), `step` (integer, optional), `snap` (boolean, optional) | Place a library part where a pointer ray in the window's scene axes puts it, seated, on the grid or refused exactly as the placement preview answers, resting on what lies under its whole footprint when the place under the pointer would cut into another part; it goes into the step shown of the submodel being edited and becomes the selection. | | `part.recolour` | Recolour | no | `ids` (array, optional), `colour` (integer) | Give placements a colour; a use of a submodel in colour 16 passes it to its parts in colour 16. | | `part.rotate` | Rotate | no | `ids` (array, optional), `axis` (string, optional), `quarter_turns` (integer, optional), `angle` (number, optional), `axis_vector` (array, optional), `about` (array, optional) | Turn placements about an axis through a point: by whole quarter turns, or by an angle in degrees, about X, Y, Z or any direction in LDraw axes, about the centre of their box when no point is given. What turned is lifted straight up when it would end below the ground, and with the overlap check on a turn into a part that does not turn is refused. One undo step. | -| `part.set_transform` | Set Position and Rotation | no | `id` (string), `position` (array, optional), `rotation` (array, optional) | Put one placement at an exact position, rotation or both, as the details panel does. | +| `part.set_transform` | Set Position and Rotation | no | `id` (string), `position` (array, optional), `rotation` (array, optional) | Put one placement at an exact position, rotation or both, as the details panel does; with the overlap check on, a place inside another part is refused. | | `part.show` | Show | no | `ids` (array, optional) | Show hidden placements again; every hidden placement in the model when no ids are given (Show all). | | `parts.list` | Parts List | yes | `scope` (string, optional), `group` (string, optional), `submodels` (string, optional), `text` (boolean, optional) | Read the parts a model needs, one row per part and colour with its description, colour name, count and the placements of the submodel being edited that hold it; a submodel's parts counted once for each use unless submodels is row, a moved part counted under the number it moved to, parts missing from the library first and marked. With text true the answer also holds the list as tab separated text. | | `parts.list_save` | Save Parts List | no | `path` (string), `separator` (string, optional), `scope` (string, optional), `group` (string, optional), `submodels` (string, optional) | Write the parts list to a file as CSV in UTF-8 with a byte order mark and CR LF line ends: a header row, then one row per part and colour with LDraw part number, description, LDraw colour number, colour name and count; comma separated, or tab separated for a .tsv path or separator tab. A cell starting with =, +, - or @ is written after an apostrophe so a spreadsheet reads it as text. | @@ -132,20 +153,25 @@ Written by `./formblocks agents sync` from the engine's command catalogue; never | `picture.steps` | Save Step Pictures | no | `folder` (string), `name` (string, optional), `width` (integer, optional), `height` (integer, optional), `scale` (integer, optional), `background` (string, optional), `ground` (boolean, optional), `view` (string, optional), `fade` (boolean, optional) | Draw one PNG for every step of the submodel being edited, each showing the steps up to it, and write them into a folder as name-01.png, name-02.png and so on. Needs the FormBlocks window open. | | `select.add` | Add to Selection | yes | `ids` (array) | Add placements to the selection. | | `select.all` | Select All | yes | none | Select every visible placement of the submodel being edited. | -| `select.by_colour` | Select Same Colour | yes | `colour` (integer, optional) | Select every visible placement in a colour, or in the colours of the selection when no colour is given. | -| `select.by_part` | Select Same Part | yes | `part` (string, optional) | Select every visible placement of a part, or of the parts of the selection when no part is given; a printed part is a different part. | +| `select.attached` | Select Attached | yes | `ids` (array, optional), `add` (boolean, optional) | Select the given placements, or the selection, and every visible placement joined to them through seated connectors, however far the chain goes; a use of a submodel joins nothing. | +| `select.by_colour` | Select Same Colour | yes | `colour` (integer, optional), `add` (boolean, optional) | Select every visible placement in a colour, or in the colours of the selection when no colour is given. | +| `select.by_part` | Select Same Part | yes | `part` (string, optional), `add` (boolean, optional) | Select every visible placement of a part, or of the parts of the selection when no part is given; a printed part is a different part. | +| `select.by_part_colour` | Select Same Part and Colour | yes | `ids` (array, optional), `add` (boolean, optional) | Select every visible placement that matches one of the given placements, or of the selection, in both its part and its colour; a printed part is a different part. | | `select.clear` | Select None | yes | none | Clear the selection. | | `select.get` | Selection | yes | none | Read the selection: the placements, how many, in how many colours, and the centre of their origins. | | `select.invert` | Invert Selection | yes | none | Select every visible placement that was not selected and let go of the rest. | | `select.remove` | Remove from Selection | yes | `ids` (array) | Let go of placements without touching the rest of the selection. | | `select.set` | Select | yes | `ids` (array) | Make the selection exactly these placements; an empty list clears it. | | `snap.set` | Snapping | yes | `on` (boolean) | Turn snapping on or off: with it on, a part being placed or moved seats on free compatible connectors within reach; with it off, it moves in grid steps only. Kept as the person's setting. | +| `snap.toggle` | Snapping On or Off | yes | none | Turn snapping off when it is on and on when it is off, deciding from the engine's own setting, so two quick presses always end where they began. Kept as the person's setting. | | `step.break_after` | New Step | no | `id` (string, optional) | Start a new step after a placement, moving the placements after it in its step into the new step; with no id, add an empty step after the step shown and show it. | | `step.delete` | Delete Step | no | `step` (integer), `submodel` (string, optional) | Delete a step; its placements move to the start of the next step, or to the end of the step before when it is the last. | | `step.goto` | Show Step | yes | `index` (integer, optional), `to` (string, optional) | Show a step of the submodel being edited, by number or as first, previous, next or last: every placement of steps 1 to it is drawn, later ones are hidden, and new parts go into it. | | `step.list` | Steps | yes | `submodel` (string, optional) | Read the steps of a submodel: each step's number, name and placement ids, and which step is shown. | | `step.move_parts` | Move to Step | no | `ids` (array, optional), `step` (integer) | Move placements of one submodel into another of its steps; one past the last step starts a new step at the end. | +| `step.move_to_new` | Move to New Step | no | `ids` (array, optional) | Put placements of one submodel into a new step right after the step shown, and show it. | | `step.rename` | Rename Step | no | `step` (integer), `name` (string), `submodel` (string, optional) | Name a step, or clear its name with an empty name; the name is kept in the file as the step's first line. | +| `step.reorder` | Move Step | no | `step` (integer), `to` (integer), `submodel` (string, optional) | Move a step with everything in it to another place in its submodel's order; the steps between close up and are numbered again. The step shown stays the same step. | | `submodel.create` | Pack | no | `ids` (array, optional), `name` (string) | Pack placements of one submodel into a new submodel and put one use of it in their place. | | `submodel.delete` | Delete Submodel | no | `name` (string), `with_uses` (boolean, optional) | Delete a submodel that is not the main model; one that still has uses is kept unless with_uses is true, which deletes the uses too. | | `submodel.dissolve` | Unpack | no | `id` (string, optional) | Put a use's parts back into its parent at the same places, in the use's step; the submodel goes when its last use is unpacked. | diff --git a/.claude/skills/formblocks-driving/sub-skills/clipboard/SUB-SKILL.md b/.claude/skills/formblocks-driving/sub-skills/clipboard/SUB-SKILL.md new file mode 100644 index 0000000..eafa723 --- /dev/null +++ b/.claude/skills/formblocks-driving/sub-skills/clipboard/SUB-SKILL.md @@ -0,0 +1,38 @@ +--- +name: clipboard +description: Copies, cuts and pastes parts in a FormBlocks model as LDraw part lines with clipboard.copy, clipboard.cut and clipboard.paste. Use when asked to repeat a group of parts somewhere else, move a built unit by a fixed offset, paste parts given as LDraw text, or take parts out of one place to put them down in another, and when a paste is refused or lands on top of the original. +--- + +# Clipboard + +The clipboard holds LDraw part lines: one line per placement, `1 colour x y z a b c d e f g h i part.dat`, in LDraw's axes with -Y up. It is the same text the window puts on the system clipboard with Ctrl+C, so parts copied here paste into other LDraw programs and the other way round. The engine keeps the last copy too, so a paste with no `text` uses it. + +## The three commands + +| Command | Kind | What it does | +| --- | --- | --- | +| `clipboard.copy` | read | Answers `{text, count}` for the placements in `ids` (the selection when left out). Changes nothing. | +| `clipboard.cut` | change | The same answer, and removes the placements: one undo step. | +| `clipboard.paste` | change | Adds the parts of the lines in `text` (or the engine's last copy) to the step shown of the submodel being edited, keeping colours and the places of the parts relative to each other, and selects them. | + +`paste` takes one placing rule: + +- `delta` `[x, y, z]`: the whole group moves by that offset in LDU. `delta [0, 0, 0]` puts the copies exactly on the originals, which is almost never what you want; with the overlap check on it is refused: "delta: the copies would overlap p1 by 24.0 LDU with the overlap check on, so nothing was pasted." +- `origin` and `direction` (a pointer ray in the scene's axes), with `held`, `rotation` and `snap`: seat the group the way the window seats copies held under the pointer. Use this to let snapping find the studs; use `delta` when you know the place. + +```bash +./formblocks cli run clipboard.copy 'ids=["p1","p2"]' +./formblocks cli run clipboard.paste 'delta=[100,0,0]' +./formblocks cli run clipboard.paste text=nonsense +``` + +The copy answered `count` 2 and the text of two lines; the paste with `delta [100, 0, 0]` answered two placements 100 LDU along X, in the step shown, with new ids; `text=nonsense` was refused with "text: there is no LDraw part line (a line starting with 1) to paste." and changed nothing. + +## Traps + +- New ids: the pasted parts are new placements (`p3`, `p4`), never the originals. Read their ids from the answer. +- Paste goes into the step shown and the submodel being edited. Give nothing for them: set the step first with `step.goto`, or move the parts afterwards with `step.move_parts`. +- A paste copies parts, never a part file's own lines, and lines that do not start with `1` are ignored. +- A pasted group is not checked against the parts below unless the person's overlap check is on; read the answer, then `overlap.check`. +- Repeating a unit many times is better done by packing it into a submodel (`sub-skills/submodels/SUB-SKILL.md`) than by pasting copies, because a change then shows in every use. +- From outside the window `cut` and `paste` wait for the person's answer there; `copy` never does. diff --git a/.claude/skills/formblocks-driving/sub-skills/clips-and-hinges/SUB-SKILL.md b/.claude/skills/formblocks-driving/sub-skills/clips-and-hinges/SUB-SKILL.md index a54221b..0fce61c 100644 --- a/.claude/skills/formblocks-driving/sub-skills/clips-and-hinges/SUB-SKILL.md +++ b/.claude/skills/formblocks-driving/sub-skills/clips-and-hinges/SUB-SKILL.md @@ -34,6 +34,10 @@ The clip's centre is put on the bar's line, and it slides along the bar in grid A floating bar is put exactly with `part.set_transform`, because `part.place` rounds an unseated part to the grid (the first line answered position `[4, -76, 4]` and `seated` false). With `on`, the clip took the first free stretch of the bar, its centre at y = -70. With a position, a clip whose centre was at y = -41 seated at -50, the nearest place at the Stud step. The clip of `4085c` is at `[0, 4, -20]` in the part's own axes (`part.connectors part=4085c`), so its origin ends up 4 above the clip's centre and 20 behind the bar's line. Always read `seated`, `joined` and `marks` in the answer. +## Plates that carry a clip, handle or hinge finger + +From 0.6.0 such a plate seats on studs from above: `part.fit` of `4085c` and of `2540` over a `3001` at `[3, -12, 2]` answered `seated` true at `[10, -8, -10]` and `[0, -8, -10]`, each joined to the brick's studs. A bar's `ref` (read it with `part.connectors part=2540`: `[0, 0, 1]`, the side its own plate is on) and a clip's `ref` (`[0, 0, -1]` for `4085c`) now decide the turn: a clip mates only with its body turned away from the bar's part, and snapping never turns it, so turn the clip first. The second rule is read from the specification; a clip held near a bar high in the air did not seat in either turn when tried, so treat it as not shown working here and check `seated`. + ## Seating hinge halves Snapping never turns a part. Turn the half first so its pivot line runs the way its partner's does, then place it near: it moves so the two lines meet. @@ -63,4 +67,4 @@ Two halves joined by a seated hinge answered `count` 0. A clip seated on a bar, ## Not found, not built -A hinge or clip drawn without the library's own pieces is found only where the engine's list of corrections names it (the 1 x 2 hinge brick, the swivel plates, the 1 x 1 tile with a clip); other parts do not snap, so place them by position and say so. Pins, axles, ball joints, a bar into a hole, hinge turning limits, click positions and flexible parts are not built: do not promise them. +A hinge or clip drawn without the library's own pieces is found only where the engine's list of corrections names it (the 1 x 2 hinge brick, the swivel plates, the 1 x 1 tile with a clip); other parts do not snap, so place them by position and say so. Pins and axles are in their own sub-skill (`sub-skills/pins-and-axles/SUB-SKILL.md`). Ball joints, a bar into a hole, hinge turning limits, click positions and flexible parts are not built: do not promise them. diff --git a/.claude/skills/formblocks-driving/sub-skills/colours/SUB-SKILL.md b/.claude/skills/formblocks-driving/sub-skills/colours/SUB-SKILL.md index ec4ccbb..48b6f50 100644 --- a/.claude/skills/formblocks-driving/sub-skills/colours/SUB-SKILL.md +++ b/.claude/skills/formblocks-driving/sub-skills/colours/SUB-SKILL.md @@ -45,6 +45,7 @@ Read the table again when in doubt; a library update can add colours, and the pe - Recolouring a use of a submodel in colour 16 passes the new colour to the parts inside that are in 16; parts with their own colour keep it. - `select.by_colour` selects every visible placement in a colour, then `part.recolour` without `ids` acts on that selection. - `colours.used` (read) lists the colours the model uses, most used first, each with `code`, `name`, `value`, `count` and `known` (false for a code the library does not define): the quickest way to check a build's colours. +- `colours.favourite` (view) with `colour` stars a colour in the person's palette (Starred); `on` true or false sets it, and left out it turns the star the other way. It answered `{colour: 4, on: true, favourite_colours: [4]}` and, run again, `on` false and an empty list. `colours.list` rows carry `favourite`, true for a starred colour. It is the person's setting and changes no part. - `colours.current` (view) chooses the colour the person's next part from the palette gets. It is the person's setting and recolours nothing; an agent passes `colour` on each `part.place` instead and leaves it alone. ## Choosing colours for a build diff --git a/.claude/skills/formblocks-driving/sub-skills/pins-and-axles/SUB-SKILL.md b/.claude/skills/formblocks-driving/sub-skills/pins-and-axles/SUB-SKILL.md new file mode 100644 index 0000000..f201610 --- /dev/null +++ b/.claude/skills/formblocks-driving/sub-skills/pins-and-axles/SUB-SKILL.md @@ -0,0 +1,64 @@ +--- +name: pins-and-axles +description: Seats pins and axles in beams, bushes and bricks with a hole in FormBlocks with part.fit, part.place, part.connectors and part.rotate about the pin. Use when asked to build with beams with holes, pins, friction pins, axles, bushes, or a brick with a hole, to join two beams with a pin, to put an axle through a beam, to turn a beam on its pin, or when a pin or axle will not seat or reads as a different kind than expected. +--- + +# Pins and axles + +Added in 0.6.0. The engine finds pins, axles and the holes they go into from a part's own shape, and snaps them with the same rule as studs and clips: `part.place`, `part.fit` and the window's drags all use it. Read what a part has with `part.connectors` (read; pass `kind` to list one kind). + +## The kinds + +| Kind | What it is | Pairs with | +| --- | --- | --- | +| `pin` | A round shaft that turns freely in a hole, 20 LDU long for a full pin, 10 for a half pin. | `pin_hole` | +| `pin_friction` | The same shaft with friction ribs. The engine treats it as a pin; it does not hold an angle. | `pin_hole` | +| `pin_hole` | A round bore, 20 deep in a beam. Takes a pin from either face, or an axle. | `pin`, `pin_friction`, `axle` | +| `axle` | A cross-shaped shaft, 80 LDU for an Axle 4. | `axle_hole`, `pin_hole` | +| `axle_hole` | A cross-shaped bore, as in a bush. | `axle` | + +A pin does not go into an axle hole, and neither pins nor axles go into studs or anti-studs. A pin hole takes an axle and lets it turn. Parts whose pins or holes are drawn without the library's own pieces are not found: place those by position and say so. + +## Joining two beams with a pin + +A pin joined to a beam is seated by its end. Turn the pin first, since snapping never turns a part: `3673` Technic Pin 1/2 has a pin at each end, and with the matrix `0 1 0 / -1 0 0 / 0 0 1` its first end points down. + +```bash +./formblocks cli run part.place part=32524 colour=7 'position=[0,0,0]' +./formblocks cli run part.set_transform id=p1 'position=[0,0,0]' +./formblocks cli run part.place part=3673 colour=4 'position=[1,-13,2]' 'rotation=[0,1,0,-1,0,0,0,0,1]' +./formblocks cli run part.place part=32524 colour=7 'position=[2,-24,-41]' +``` + +Run here: the pin answered `seated` true at `[0, -10, 0]` with one joined pair and a mark at `[0, 10, 0]`, and the second beam seated at `[0, -20, -40]`, joined to the pin. The first line rounded the beam to `[9, -2, 9]` (an unseated part goes to the grid), hence the `part.set_transform`. `overlap.check` answered `count` 0 and `nested_count` 0: a pin fitted in a hole is joined, not an overlap. + +## Turning a beam on its pin + +`part.pivot` on the second beam answers kind `hinge`, about `[0, -20, 0]` along the pin; give both to `part.rotate`. + +```bash +./formblocks cli run part.pivot 'ids=["p3"]' +./formblocks cli run part.rotate 'ids=["p3"]' 'axis_vector=[0,1,0]' 'about=[0,-20,0]' angle=45 +``` + +The beam turned 45 degrees to `[-28.284, -20, -28.284]` and `overlap.check` still answered `count` 0. A beam turns all the way round on a pin; turning limits are not built. + +## An axle through a beam + +An axle is seated on a hole's line and slides along it in grid steps from its middle. + +```bash +./formblocks cli run part.fit part=3705 'position=[1,-7,2]' 'rotation=[0,1,0,-1,0,0,0,0,1]' +``` + +Run here against the same lone beam: `3705` Axle 4, turned upright, answered `seated` true at `[0, 0, 0]` (the beam's middle hole), mark at `[0, -40, 0]`. Unturned, the same call answered `seated` false: the axle must run along the hole. A bush turned to take it was fitted at `[1, -48, 2]` and answered false in this run, with no axle there; seating a bush on an axle is described in the specification (`spec/CONNECTIONS.md`, example 11) and not run here. + +## Reading and failures + +- `part.connectors part=32524` lists seven `pin_hole` entries, each `length` 20. +- `part.connectors part=3705` lists one `axle`, `length` 80. +- When a pin or axle does not seat, check the turn first (axis along the hole), then the distance (within the snap reach of the hole), then that the hole is not already taken. + +## Not built + +Ball joints and sockets, gears meshing, flexible parts, other scales' pins (the Scala pin), turning limits, friction as a held angle, and click positions on axles. Do not promise them. diff --git a/.claude/skills/formblocks-driving/sub-skills/placing-and-snapping/SUB-SKILL.md b/.claude/skills/formblocks-driving/sub-skills/placing-and-snapping/SUB-SKILL.md index 43eb734..908bae0 100644 --- a/.claude/skills/formblocks-driving/sub-skills/placing-and-snapping/SUB-SKILL.md +++ b/.claude/skills/formblocks-driving/sub-skills/placing-and-snapping/SUB-SKILL.md @@ -12,7 +12,7 @@ Read `references/coordinates-and-units.md` first if positions in LDU with -Y up - A stud is the round knob on top of a part, 4 LDU high, on a 20 LDU grid. - An anti-stud is a place on a part's underside that takes one stud: the gaps between the walls and tubes of a brick, or the inside of a tube. - A part is seated when its anti-studs sit on another part's studs (or its studs in another part's anti-studs). Seating is how real bricks hold together, so a model built of seated parts is one that could be built. -- FormBlocks finds these connectors from each part's own geometry; `part.connectors` lists them for any part. Only ordinary studs and anti-studs exist in this version: pins, axles, clips and hinges do not seat. +- FormBlocks finds these connectors from each part's own geometry; `part.connectors` lists them for any part. Studs and anti-studs are the ordinary joins; clips on bars and hinge halves seat too (`sub-skills/clips-and-hinges/SUB-SKILL.md`). Pins and axles seat in holes (`sub-skills/pins-and-axles/SUB-SKILL.md`); ball joints do not seat yet. ## The ground @@ -41,7 +41,7 @@ With snapping off (`snap: false`), the part goes exactly to the position, seated Snapping never turns a part. To seat crosswise, give the turned `rotation`. -Snapping, the grid step and the overlap check are the person's settings: `snap.set` (`on`), `grid.step` (`stud`, `plate` or `fine`) and `overlap.set` (`on`) change them for every later placement, in the window too. Pass `snap` on one call instead, and change a setting only when the person asks. +Snapping, the grid step and the overlap check are the person's settings: `snap.set` (`on`), `grid.step` (`stud`, `plate` or `fine`) and `overlap.set` (`on`) change them for every later placement, in the window too. `snap.toggle`, `overlap.toggle` and `grid.next` flip or step the same settings from the engine's own state, which is what the window's keys use, so two quick presses end where they began; prefer the `set` forms, which say the end state. Pass `snap` on one call instead, and change a setting only when the person asks. A fourth way to say where is a pointer ray, as the window drops the ghost: `part.place_at_ray`, in the scene's axes. It also rests a part on what lies under its whole footprint, so a plate dropped over an open gap lies across the parts either side. `sub-skills/moving-parts/SUB-SKILL.md` covers it. diff --git a/.claude/skills/formblocks-driving/sub-skills/selection/SUB-SKILL.md b/.claude/skills/formblocks-driving/sub-skills/selection/SUB-SKILL.md index 2449d58..2872006 100644 --- a/.claude/skills/formblocks-driving/sub-skills/selection/SUB-SKILL.md +++ b/.claude/skills/formblocks-driving/sub-skills/selection/SUB-SKILL.md @@ -22,6 +22,10 @@ Selection commands are `view` commands: they change what is shown, never the mod | `select.invert` | none | Every visible placement that was not selected, letting go of the rest. | | `select.by_colour` | `colour` | Every visible placement in that colour, or in the colours of the selection when left out. | | `select.by_part` | `part` | Every visible placement of that part, or of the parts of the selection when left out. A printed part counts as a different part. | +| `select.by_part_colour` | `ids` | Every visible placement that matches one of the given placements, or of the selection, in both its part and its colour. | +| `select.attached` | `ids` | The given placements, or the selection, and every visible placement joined to them through seated connectors, however far the chain goes; a use of a submodel joins nothing. | + +`select.by_colour`, `select.by_part`, `select.by_part_colour` and `select.attached` also take `add` (true): the matches are added to the selection instead of replacing it. In a model of two stacked red and blue 2 x 4 bricks, a red 2 x 2 plate on its own and a red 2 x 4 brick elsewhere, `select.attached` for the lower brick answered both stacked bricks and nothing else, and `select.by_colour` for red answered the three red parts. ## Rules @@ -45,6 +49,7 @@ So you can follow what they tell you (`spec/SPEC.md` 6.1): - A click selects one part; a click on empty space or the ground clears the selection. Shift+click adds a part; Ctrl+click (Cmd on macOS) adds it or takes it away. - A drag that starts on empty space draws a selection box. Left to right selects the parts wholly inside it, right to left every part it touches. Shift with the box adds; Ctrl adds the parts not yet selected or, when all are, takes them away. Esc while drawing drops the box. - A drag that starts on a part moves it, or the selection it belongs to (`sub-skills/moving-parts/SUB-SKILL.md`). +- Q goes through the pick modes a click uses (one part, same colour, same part, same part and colour, attached), and the Select menu has the same four kinds; each reaches the engine as the matching `select.*` command. - Ctrl+A selects all, Ctrl+I inverts, Esc clears. Rows of the Model, Steps and Parts tabs select their parts too. The box needs the view, so it has no command: an agent selects by ids or by kind. Every selection the person makes reaches the engine as `select.*` commands, so `select.get` always answers what the window shows. diff --git a/.claude/skills/formblocks-driving/sub-skills/steps/SUB-SKILL.md b/.claude/skills/formblocks-driving/sub-skills/steps/SUB-SKILL.md index 8821ae3..6ee30e7 100644 --- a/.claude/skills/formblocks-driving/sub-skills/steps/SUB-SKILL.md +++ b/.claude/skills/formblocks-driving/sub-skills/steps/SUB-SKILL.md @@ -15,6 +15,8 @@ Each submodel has its own building steps, numbered from 1. Every placement is in | `step.goto` | view | `index` or `to` | Shows step `index` of the submodel being edited, or the `first`, `previous`, `next` or `last` step. New parts go into the step shown. Walking a model step by step is `sub-skills/step-walking/SUB-SKILL.md`. | | `step.break_after` | change | `id` | Starts a new step after placement `id`, moving the placements after it in its step into the new step. With no `id`, adds an empty step after the step shown and shows it. | | `step.move_parts` | change | `ids`, `step` | Moves placements into another step of their submodel; one past the last starts a new step at the end. | +| `step.move_to_new` | change | `ids` | Puts the placements into a new step right after the step shown, and shows it. With the step shown being 2 of 3, the placement went into a new step 3 and the old step 3 became 4. | +| `step.reorder` | change | `step`, `to`, `submodel` | Moves a whole step, with its parts, to another place in the order; the steps between close up and are renumbered. With three steps of one brick each, `step=3 to=1` answered the old third step first. A `to` outside the steps ("to must be from 1 to 3 in untitled.ldr.") or equal to `step` ("step 1 is already number 1; nothing moved.") is refused. | | `step.rename` | change | `step`, `name`, `submodel` | Names a step; an empty name clears it. | | `step.delete` | change | `step`, `submodel` | Deletes a step; its placements move to the start of the next step, or to the end of the step before when it was the last. A submodel keeps at least one step. | diff --git a/.claude/skills/formblocks-harness/SKILL.md b/.claude/skills/formblocks-harness/SKILL.md index a0cc957..427d375 100644 --- a/.claude/skills/formblocks-harness/SKILL.md +++ b/.claude/skills/formblocks-harness/SKILL.md @@ -4,7 +4,7 @@ description: "Use when asked to install, boot, verify, debug, extend or release license: Apache-2.0 metadata: product: FormBlocks - pack-version: "0.5.0" + pack-version: "0.6.0" audience: developer agent --- diff --git a/.claude/skills/formblocks-harness/sub-skills/add-connector-kind/SUB-SKILL.md b/.claude/skills/formblocks-harness/sub-skills/add-connector-kind/SUB-SKILL.md index 1559257..e046f9a 100644 --- a/.claude/skills/formblocks-harness/sub-skills/add-connector-kind/SUB-SKILL.md +++ b/.claude/skills/formblocks-harness/sub-skills/add-connector-kind/SUB-SKILL.md @@ -1,6 +1,6 @@ --- name: add-connector-kind -description: Adds a connector kind to FormBlocks' connection model as a module that registers itself in backend/app/connect/kinds/, with its data beside it as JSON. Use when adding a joint beyond studs, anti-studs, clips, bars and the hinge families, such as pins or axles, when correcting the primitive list of an existing kind, or when a part's connectors come out wrong. +description: Adds a connector kind to FormBlocks' connection model as a module that registers itself in backend/app/connect/kinds/, with its data beside it as JSON. Use when adding a joint beyond studs, anti-studs, clips, bars, the hinge families, pins and axles, such as ball joints or gears, when correcting the primitive list of an existing kind, or when a part's connectors come out wrong. --- # Add a connector kind @@ -16,7 +16,7 @@ Load `sub-skills/laws-and-logs/SUB-SKILL.md` and `sub-skills/clean-room-and-spec ## Where the module lives -- `backend/app/connect/kinds/[kind].py`, one module per kind or per family of kinds. `kinds.load()` imports every module in the package whose name does not start with `_`, in name order, so no list is edited anywhere. +- `backend/app/connect/kinds/[kind].py`, one module per kind or per family of kinds (`pin.py` holds three pin kinds, `axle.py` two, and `_shaft.py` is the measuring they share). `kinds.load()` imports every module in the package whose name does not start with `_`, in name order, so no list is edited anywhere. - The module's data (primitive file names, tolerances) sits beside it as `[kind].json` and is read when the module loads, so a list can be corrected without touching code. A data file that cannot be read stops the engine with a sentence naming the file. - At the end of the module, one call per kind: `PIN = register(PinKind())`. @@ -42,6 +42,10 @@ A subclass of `Kind` from `backend/app/connect/kinds/__init__.py`: `kinds/clip.py` (clip and bar) and `kinds/hinge.py` (the five hinge families, three read from primitives and two from overrides only) are the worked examples; each has its numbers in `clip.json` or `hinge.json`. `mates_with` is declared once per kind and the registry makes it symmetric, so a half pairs only with the other half of its own family. +`kinds/pin.py` (`pin`, `pin_friction`, `pin_hole`) and `kinds/axle.py` (`axle`, `axle_hole`), with `_shaft.py` for what they share, are the worked examples of a kind built in two passes. No primitive draws a whole hole, so `claims` and `from_reference` make one piece per open face (a face point and the inward direction), and `settle` joins the pieces once the walk is over: two faces that look at each other on one line, nearest first and at most `max_depth` apart, become one hole; a face left alone has its bore probed for its depth. A hole is a point with a depth: its `position` is the middle of the bore, its `axis` runs along it, its `length` is the depth from face to face, and the mate puts a pin's collar at the hole's near face, half the depth from `position` (`spec/CONNECTIONS.md`, "The mate of a pin in a hole"). A pin or an axle is a segment (`spans`), so a long one can take two holes. + +`version` is read from the top of the kind's JSON file (`"version"` in `pin.json`, `axle.json`, `clip.json`), not written in the module: raise it there in the same commit whenever the kind's rule or its data changes, and every cached part is derived again. + Connectors already carry `ref` (for kinds whose turn about the axis matters) and `length` (for kinds that slide), so the connector shape does not change. ## Overrides diff --git a/.docs/wiki/Building.md b/.docs/wiki/Building.md index 21f1e89..2400e1d 100644 --- a/.docs/wiki/Building.md +++ b/.docs/wiki/Building.md @@ -13,6 +13,8 @@ cd formblocks ./formblocks # the engine and the window together ``` +The launcher opens no browser: it prints its two addresses, you open `http://localhost:5330` yourself, and it runs until you close its terminal. `./formblocks serve` has the engine serve the built window on `http://127.0.0.1:8330` instead; it gives its key to the first page that loads, so use one tab there (a second shows "The engine did not answer"). + On Windows use `formblocks_oc_install.bat` and `formblocks.bat`. Neither has been run yet; only Linux has run FormBlocks from source. | Service | Address | Notes | @@ -55,6 +57,6 @@ CI also boots the engine and probes `/api/health`, runs `bash -n` over the shell ## The desktop app and releases -`./formblocks install-desktop` checks the toolchain, `./formblocks desktop dev` runs the shell and `./build_app` builds and installs it. The bundle takes its icons from `src-tauri/icons`, made from the owner's art in `assets/`. One desktop build has been run, on Linux x64 (a deb and an AppImage, unsigned, made as formcompiler makes them). Its frozen engine started, the window drew under a virtual display with software WebGL and opened the sample car, and closing it ended every process. The macOS and Windows builds, signing, the updater and the rpm have not been run. +`./formblocks install-desktop` checks the toolchain, `./formblocks desktop dev` runs the shell and `./build_app` builds and installs it. The bundle takes its icons from `src-tauri/icons`, made from the owner's art in `assets/`. One desktop build has been run, on Linux x64 (a deb, an rpm and an AppImage, unsigned, made as formcompiler makes them). Each frozen engine started, the window drew under a virtual display with software WebGL and opened the sample car, and closing it ended every process. The macOS and Windows builds, signing and the updater have not been run. A start that fails shows the engine's reason in a dialog and ends the app; the same reasons print as one `formblocks-start-error:` line from the engine. Nothing in this repository pushes, signs or publishes a release. The family's compiler, formcompiler, builds each release from `apps/formblocks.json` after `ci.yml` has passed on a `compile_vX.Y.Z` branch, and an owner publishes it. `docs/RELEASE.md` lists the version sites a release bumps by hand and says what formcompiler runs. diff --git a/.docs/wiki/Home.md b/.docs/wiki/Home.md index d127ed2..4e810a5 100644 --- a/.docs/wiki/Home.md +++ b/.docs/wiki/Home.md @@ -2,7 +2,7 @@ FormBlocks is an Apache-2.0 brick building app for macOS, Linux and Windows. You find parts in the open LDraw parts library, place and snap them in a 3D view, colour them, build in steps, count what the model needs, save LDraw files and pictures, and an agent program can do the same through the engine's command line and MCP server. -Version: 0.5.0 (in active development, functional). +Version: 0.6.0 (in active development, functional). ## Start here diff --git a/.docs/wiki/Window.md b/.docs/wiki/Window.md index 6f1191a..2a25584 100644 --- a/.docs/wiki/Window.md +++ b/.docs/wiki/Window.md @@ -10,11 +10,15 @@ The full walk through is `docs/MANUAL.md` in the repository. This page is the ma ## Turning parts -Select parts and a pivot dial shows: one ring about the up axis. Drag along it to turn in angle steps, Shift for whole degrees, Esc to put the parts back. Press **A** for the next angle step (90, 45, 22.5, 15, 5 or 1 degrees), **J** for the pivot tool with three rings and a click to set the pivot, and hold Alt with **R**, **T** or **Y** to turn by the angle step. A turn never leaves a part under the ground. A hinge half turns about its hinge. +Select parts and a pivot dial shows: one ring about the up axis. Drag along it to turn in angle steps, Shift for whole degrees, Esc to put the parts back. Press **A** for the next angle step (90, 45, 22.5, 15, 5 or 1 degrees), **J** for the pivot tool with three rings and a click to set the pivot, and hold Alt with **R**, **T** or **Y** to turn by the angle step. With the pivot tool on (**J**), type a number of degrees into the box at the foot of the view and press Enter to turn by exactly that (a minus sign turns the other way). A turn never leaves a part under the ground. A hinge half turns about its hinge. ## Clips and hinges -A clip seats on a bar and slides along it in grid steps; two hinge halves of one family seat on one pivot line once the half is turned the right way round. The manual's "Clips, bars and hinges" lists the five hinge families and what is not built yet (pins, axles, ball joints, hinge limits). +A clip seats on a bar and slides along it in grid steps; two hinge halves of one family seat on one pivot line once the half is turned the right way round. The manual's "Clips, bars and hinges" lists the five hinge families and what is not built yet (ball joints, hinge limits, a pin that holds its angle). + +## Pins and axles + +A pin seats in the round hole of a beam, and a beam over an upright pin takes the hole's line; an axle goes through a pin hole or a cross-shaped hole such as a bush's. Turn the part first, since snapping never turns a part. A beam on a pin turns about the pin. The manual's "Pins and axles" says more. ## Overlaps and nested pairs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 27c00a7..f3af04d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -100,6 +100,39 @@ jobs: sys.exit(1 if bad else 0) PY + desktop: + needs: [frontend, backend] + strategy: + fail-fast: false + matrix: + os: [macos-latest, macos-15-intel, windows-latest] + runs-on: ${{ matrix.os }} + timeout-minutes: 45 + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version-file: .nvmrc + cache: npm + cache-dependency-path: frontend/package-lock.json + - uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0 + with: + python-version: '3.12' + - name: Install as formcompiler does + run: | + ./formblocks install --lite + ./formblocks install-desktop + - name: Freeze the engine and run its self-check + run: ./formblocks freeze + - name: Type check the shell with the frozen engine in place + working-directory: src-tauri + run: cargo check --locked + agents: runs-on: ubuntu-24.04 timeout-minutes: 15 diff --git a/CHANGELOG.md b/CHANGELOG.md index 1c45d44..ac24664 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,27 @@ # Changelog +## v0.6.0 · 2026-11-27 + +The sixth version adds pins and axles as joins, lets plates with a clip, a handle or a hinge finger sit on studs, brings the clipboard and more editing tools, and makes the panels fit short windows. The repository is private until 13 December 2026. + +- Pins and axles: a pin seats in a pin hole and an axle slides through axle holes in grid steps, found from each part's own shape; 2,458 parts of the official library gain such a join. A part held on one pin or one axle turns about it with the pivot tool. A seated pin counts as fitted in the overlap check. +- Plates with a side piece sit on studs: a plate that carries a clip, a handle or a hinge finger now seats on studs from above with its side piece over the edge, and takes a plate on its own studs. 1,095 parts gain the hollows that make this work; no part lost one. Worked examples 5 to 8 of the connection specification are recomputed on purpose; examples 1 to 4 and every brick-on-brick number are unchanged. +- A clip keeps its own body clear: a clip seats on a bar only when it is held with its body pointing away from the bar's part. Held the wrong way it is not offered the bar; turn it and it seats. Snapping still never turns a part. +- Copy, cut and paste (Ctrl+C, Ctrl+X, Ctrl+V): pasted parts are held on the pointer and seat by the snap. Also new: a stamp (C) and a brush (B) that place the held part again by click or by stroke, a sampler (I) that takes a part and colour from the model, move handles (M), an orthographic view (P), Select Attached, Select Same Part and Colour, and an Add option on the select-by-kind commands. A part dragged from the palette is placed where it is dropped. +- Typing an angle: with the pivot tool on, type degrees and press Enter to turn by exactly that. +- With the overlap check on, a nudge or a typed position can no longer push a part into another. Pressing a status-bar switch twice quickly now always counts twice, and Ctrl+Z during a drag cancels the drag instead of undoing an earlier change. +- The right column on short windows: the colour palette shows whole rows of swatches, Details is never cut through a row, and the tab in use keeps at least four rows; all three sections fit at 1024 by 700. Recent, used and starred colours share one row, and S or a right click stars a colour. +- Model tree and steps: a row menu (right click, the menu key or Shift+F10) packs parts into a submodel, renames, makes independent, unpacks, hides and deletes; Ctrl+G and Ctrl+Shift+G pack and unpack. Parts and steps can be dragged to another place or moved with Alt+Up and Alt+Down; F2 renames a step. +- The Info tab says, quietly, when the model inside a file has a different name from the file. Nothing is renamed for you. +- Preferences has a Building page with the angle step and how much earlier steps fade. A parts list sorted by colour is saved grouped by colour. +- Keyboard: Ctrl+A, Ctrl+C, Ctrl+X and the other editing keys stay with a text field while you type in it. Lists, the palette grids and groups of choices are one Tab stop each and move with the arrow keys, and every control shows where the focus is. +- Without WebGL 2 the viewport says so in a sentence instead of staying blank. +- The desktop app: every start-up failure now ends in a sentence you can act on (the engine missing, a data folder that cannot be written, a second copy already open, an engine that does not answer); before, a missing engine left no window at all. The Linux build makes a deb, an rpm and an AppImage. +- Agents: `clipboard.copy`, `clipboard.cut`, `clipboard.paste`, `select.attached`, `select.by_part_colour`, `step.reorder`, `step.move_to_new`, `colours.favourite`, and the switches `snap.toggle`, `overlap.toggle`, `overlap.nested_toggle`, `grid.next` and `angle.next`. `part.connectors` lists pins, axles and their holes. Two new sub-skills in the driving pack: the clipboard, and pins and axles. The manual has a new chapter, "A first model". +- Run for this version: `./formblocks doctor`, the type check, the window build, the engine freeze with its self-check, `./formblocks agents check`, the Form App Contract checker (0 MUST, 0 SHOULD, 83 clauses checked) and the registry's eight checks, all passing; the Linux desktop build as formcompiler runs it (deb, rpm, AppImage, unsigned), each started under a virtual display with the sample car drawn and a brick placed; headless Chrome walks with real pointer and key events (a clip plate on a handle the right way and the wrong way, a pin in a beam, a second beam turned a typed 180 degrees about the pin, an axle through both, copy and paste, the brush, steps dragged, a submodel packed and entered, save and reopen) with layout shift 0 on a hard reload and without recent input under a 4x slower processor and a slow network. Claude Code 2.1.332 was a real program, not signed in. +- Not run for this version: a signed-in agent turn, any `.bat` script, Windows, macOS, a desktop build after the last window fixes, the workflow on GitHub, and a frame time on a real graphics card. +- Known: what counts as an overlap is still the owner's decision, and the check still cannot tell a part pushed in by exactly 1 LDU from one that sits there by design; a hide tool, a right-click menu in the viewport, saved camera views and changing a key are not built; a saved parts list groups colours by number while the table sorts them by name; a picture still cannot be drawn with no window open. + ## v0.5.0 · 2026-11-27 The fifth version turns parts with the pointer, adds clips, bars and hinges as joins, makes the overlap check quiet on real models, gives the right column room and a model information tab, and was built and started as a desktop app for the first time, on Linux. The repository is private until 13 December 2026. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 118ae27..8479393 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -37,7 +37,7 @@ Run what CI runs: CI also boots the engine and probes `/api/health`, runs `bash -n` over the shell scripts, and fails on a long dash in tracked markdown or a pictograph in tracked text. - Keep each pull request to one change. -- Write commit subjects the way the history does: `type(scope): lowercase sentence describing the effect (x.y.z)`. Leave the version alone; a maintainer bumps every version site together when releasing. +- Write commit subjects the way the history does: `type(scope): lowercase sentence describing the effect (x.y.z)`, where `type` is one of feat, fix, docs, refactor, perf, chore, style, build or ci, a scope in brackets is always given, and the first word after the colon is lowercase. A subject that breaks this cannot be repaired once the history is signed. Leave the version alone; a maintainer bumps every version site together when releasing. - A feature is a command in the engine's registry, so the window, the command line and the MCP server all get it. Run `./formblocks agents sync` after adding one and commit what it writes. - Every route that changes something needs the window's key. The engine binds 127.0.0.1 and nothing else. - The window renders once and patches in place: no flash, no flicker, no re-render of a live container. Colours, spacing and `z-index` come from the tokens file; icons are inline SVG from the app's own icon module. diff --git a/NOTICE.md b/NOTICE.md index 0e99a4a..f967492 100644 --- a/NOTICE.md +++ b/NOTICE.md @@ -46,11 +46,11 @@ FormBlocks was made from FormAnything's app template, which is FormCAD's skeleto | Work | Licence | Where | | --- | --- | --- | -| tauri 2, tauri-plugin-shell, tauri-plugin-dialog, tauri-plugin-single-instance, regex, serde, serde_json | MIT OR Apache-2.0 | `src-tauri/Cargo.toml`, exact versions in `src-tauri/Cargo.lock` | +| tauri 2.12.5, tauri-plugin-shell 2.6.0, tauri-plugin-single-instance 2.5.5, regex 1.13.1, serde 1.0.229, serde_json 1.0.154 | MIT OR Apache-2.0 | `src-tauri/Cargo.toml`, the versions as `src-tauri/Cargo.lock` holds them | | tauri-plugin-dialog 2.8.4 | MIT OR Apache-2.0; the desktop's file dialogs for open, save and choosing a library folder, allowed to the window by `dialog:allow-open` and `dialog:allow-save` and called through `@tauri-apps/api` without its own JavaScript package | `src-tauri/Cargo.toml`, `src-tauri/capabilities/default.json`, `frontend/src/io/dialog.ts` | | tauri-build 2.7.4 | MIT OR Apache-2.0; the shell's build script, not shipped | `src-tauri/Cargo.toml` (build dependency), exact version in `src-tauri/Cargo.lock` | | windows-sys 0.61.2 (Windows) | MIT OR Apache-2.0 | `src-tauri/Cargo.toml` | -| objc2, objc2-app-kit (macOS) | MIT OR Apache-2.0 OR Zlib | `src-tauri/Cargo.toml` | +| objc2 0.6.5, objc2-app-kit 0.3.2 (macOS) | MIT (objc2), Zlib OR Apache-2.0 OR MIT (objc2-app-kit) | `src-tauri/Cargo.toml`, the versions as `src-tauri/Cargo.lock` holds them | ### The app's own art diff --git a/README.md b/README.md index 2c5c0e8..a5d370a 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@

- version 0.5.0 + version 0.6.0 TypeScript Python Tauri 2 @@ -31,7 +31,7 @@ ## What it is -FormBlocks is an open brick building app. Its parts are the LDraw Parts Library, the open library of brick shapes kept by many authors at ldraw.org; FormBlocks fetches it once, after you agree, or reads a copy you already have, and never bundles it. Models are LDraw files, so they open in every other LDraw program. It is written from its own functional specification in [`spec/`](spec), not from any other program. +FormBlocks is an open brick building app for anyone who designs models from bricks on a computer, whether by hand or with an agent program, and wants files that other LDraw programs open too. Its parts are the LDraw Parts Library, an open library of brick shapes kept by many authors at ldraw.org and licensed CC BY 2.0 and CC BY 4.0; FormBlocks fetches it once, only after you agree to the address, size and licence it shows, or reads a copy you already have, and never bundles it. It is written from its own functional specification in [`spec/`](spec), not from any other program. @@ -42,11 +42,11 @@ FormBlocks is an open brick building app. Its parts are the LDraw Parts Library,
> [!IMPORTANT] -> **Status:** in active development, functional. In the window you can choose or fetch the parts library, find parts in the palette, place them with the pointer in the 3D view where they seat on studs (including across a gap, resting on the tops of what is under them) and, with the clip and hinge parts, on bars and on each other's hinge halves, drag placed parts and copies of them, select with the pointer or a box, turn parts by the pointer on a pivot dial in angle steps from 90 degrees down to 1 (a hinge half turns about its hinge), colour parts, nudge, hide, pack parts into submodels, add and walk building steps with the earlier steps dimmed, read the model tree and the details of a part. +> **Status:** in active development, functional. In the window you can choose or fetch the parts library, find parts in the palette, place them with the pointer in the 3D view where they seat on studs (including across a gap, resting on the tops of what is under them) and, with the clip, hinge, pin and axle parts, on bars, on each other's hinge halves and on pins and axles in beams, drag placed parts and copies of them, select with the pointer or a box, turn parts by the pointer on a pivot dial in angle steps from 90 degrees down to 1 (a hinge half turns about its hinge, and a beam about its pin), type an exact angle on the dial, copy, cut and paste parts, pick by kind, and use the stamp, brush and sampler on keys, colour parts, nudge, hide, pack parts into submodels, add and walk building steps with the earlier steps dimmed, read the model tree and the details of a part. > > You can also count what a model needs in the Parts tab and save it as CSV, read and edit the model's name, description, author and licence beside its counts and size in the Info tab, fold and resize the right column's three sections, tell real overlaps from parts that nest by design, save a picture of the view (and one picture per step), and save and open `.fblk`, `.ldr` and `.mpd` files. > -> The agent dock runs Claude Code, Codex, Cursor and Antigravity beside the model. Not yet in the window: the stamp, brush and sampler tools, move handles, a typed angle on the pivot dial, pins, axles and ball joints, and a limit on how far a hinge opens. [docs/MANUAL.md](docs/MANUAL.md) walks through all of it and ends with what does not work yet. +> The agent dock runs Claude Code, Codex, Cursor and Antigravity beside the model. Not yet in the window: a row of tool buttons (the tools are on keys), a right-button menu, ball joints, and a limit on how far a hinge opens. [docs/MANUAL.md](docs/MANUAL.md) walks through all of it and ends with what does not work yet. ## Quick start @@ -55,11 +55,19 @@ FormBlocks is an open brick building app. Its parts are the LDraw Parts Library, ```sh git clone https://github.com/nodemode-dev/formblocks.git cd formblocks -./formblocks_oc_install # the engine's venv and the window's packages -./formblocks # the window at http://localhost:5330 +./formblocks_oc_install # the engine's venv and the window's packages, once +./formblocks # starts the engine and the window; open http://localhost:5330 in a browser ``` -On Windows use `formblocks_oc_install.bat` and `formblocks.bat`. `./formblocks doctor` checks the toolchain, the installs and the ports. +The launcher opens no browser by itself and runs until you close its terminal. On Windows use `formblocks_oc_install.bat` and `formblocks.bat`. `./formblocks doctor` checks the toolchain, the installs and the ports. + +**What it needs:** + +- A computer you can run Python and Node on (it was run on Linux; macOS and Windows are made to work and were not run), and a browser, or the desktop app. +- The LDraw Parts Library, about 147 MB as one archive and about 20,000 parts. It is not part of FormBlocks. On the first start the window asks whether to use a library folder you already have or to fetch the official one; nothing is downloaded until you press the fetch button, and only you can press it. +- A browser or webview with WebGL 2: without it the 3D view stays blank. +- No account, no sign-in and no network except that one fetch. The first use of a library takes a little while to index. +- Agent programs (Claude Code, Codex, Cursor, Antigravity) are optional, are the makers' own, and each needs its own sign-in with its maker. | Service | Address | Notes | | --- | --- | --- | @@ -152,7 +160,9 @@ Agents: [`CLAUDE.md`](CLAUDE.md), [`AGENTS.md`](AGENTS.md) · Contributing: [`CO ## Status In active development, functional. It is made to run from source on macOS, Linux and Windows, and has been run from source on Linux only; desktop builds come from formcompiler; the app has its icons. -One desktop build has been made, on Linux x64 only (a deb of 50 MB and an AppImage of 121 MB, unsigned): its frozen engine started, the window drew and showed the sample car under a virtual display, and closing it ended every process; no macOS or Windows build has been run. The engine and the window have been run against the full official library of release 2026-10, the window in a headless browser with software rendering, so how fast it draws on a real graphics card is not measured. All four agent programs were run for real, none signed in: Claude Code 2.1.332, Codex 0.172.0, Cursor's agent and Antigravity 1.5.18, each found, started from a dock tab and from the launcher, and given a token that opened the engine's `/mcp` and nothing else, and stopped working when the tab closed. Releases are made by the family's compiler from [`apps/formblocks.json`](apps/formblocks.json), never by this repository. +One desktop build has been made, on Linux x64 only (a deb of 50 MB, an rpm of 133 MB and an AppImage of 125 MB, unsigned): each started its frozen engine, drew the window and showed the sample car under a virtual display, and closing it ended every process; a start that fails now shows the engine's reason in a dialog instead of hanging; no macOS or Windows build has been run. + +The engine and the window have been run against the full official library of release 2026-10, the window in a headless browser with software rendering, so how fast it draws on a real graphics card is not measured. All four agent programs were run for real, none signed in: Claude Code 2.1.332, Codex 0.172.0, Cursor's agent and Antigravity 1.5.18, each found, started from a dock tab and from the launcher, and given a token that opened the engine's `/mcp` and nothing else, and stopped working when the tab closed. Releases are made by the family's compiler from [`apps/formblocks.json`](apps/formblocks.json), never by this repository. ## Licensing diff --git a/agents/manifest.json b/agents/manifest.json index b54fb86..dfaa3f8 100644 --- a/agents/manifest.json +++ b/agents/manifest.json @@ -10,10 +10,16 @@ "formblocks_redo", "formblocks_status", "formblocks_undo", + "cmd_angle_next", "cmd_angle_step", + "cmd_clipboard_copy", + "cmd_clipboard_cut", + "cmd_clipboard_paste", "cmd_colours_current", + "cmd_colours_favourite", "cmd_colours_list", "cmd_colours_used", + "cmd_grid_next", "cmd_grid_step", "cmd_library_status", "cmd_model_info", @@ -28,7 +34,9 @@ "cmd_model_tree", "cmd_overlap_check", "cmd_overlap_nested", + "cmd_overlap_nested_toggle", "cmd_overlap_set", + "cmd_overlap_toggle", "cmd_part_connectors", "cmd_part_delete", "cmd_part_duplicate", @@ -54,20 +62,25 @@ "cmd_picture_steps", "cmd_select_add", "cmd_select_all", + "cmd_select_attached", "cmd_select_by_colour", "cmd_select_by_part", + "cmd_select_by_part_colour", "cmd_select_clear", "cmd_select_get", "cmd_select_invert", "cmd_select_remove", "cmd_select_set", "cmd_snap_set", + "cmd_snap_toggle", "cmd_step_break_after", "cmd_step_delete", "cmd_step_goto", "cmd_step_list", "cmd_step_move_parts", + "cmd_step_move_to_new", "cmd_step_rename", + "cmd_step_reorder", "cmd_submodel_create", "cmd_submodel_delete", "cmd_submodel_dissolve", @@ -81,10 +94,14 @@ "formblocks_get_doc", "formblocks_list_commands", "formblocks_status", + "cmd_angle_next", "cmd_angle_step", + "cmd_clipboard_copy", "cmd_colours_current", + "cmd_colours_favourite", "cmd_colours_list", "cmd_colours_used", + "cmd_grid_next", "cmd_grid_step", "cmd_library_status", "cmd_model_info", @@ -93,7 +110,9 @@ "cmd_model_tree", "cmd_overlap_check", "cmd_overlap_nested", + "cmd_overlap_nested_toggle", "cmd_overlap_set", + "cmd_overlap_toggle", "cmd_part_connectors", "cmd_part_fit", "cmd_part_pick", @@ -103,14 +122,17 @@ "cmd_parts_show", "cmd_select_add", "cmd_select_all", + "cmd_select_attached", "cmd_select_by_colour", "cmd_select_by_part", + "cmd_select_by_part_colour", "cmd_select_clear", "cmd_select_get", "cmd_select_invert", "cmd_select_remove", "cmd_select_set", "cmd_snap_set", + "cmd_snap_toggle", "cmd_step_goto", "cmd_step_list", "cmd_submodel_enter", @@ -121,6 +143,8 @@ "formblocks_execute", "formblocks_redo", "formblocks_undo", + "cmd_clipboard_cut", + "cmd_clipboard_paste", "cmd_model_insert", "cmd_model_new", "cmd_model_open", @@ -146,7 +170,9 @@ "cmd_step_break_after", "cmd_step_delete", "cmd_step_move_parts", + "cmd_step_move_to_new", "cmd_step_rename", + "cmd_step_reorder", "cmd_submodel_create", "cmd_submodel_delete", "cmd_submodel_dissolve", @@ -166,6 +192,7 @@ "building-in-order", "changing-parts", "checking-a-model", + "clipboard", "clips-and-hinges", "colours", "connect-and-status", @@ -176,6 +203,7 @@ "parts-library", "parts-list", "pictures", + "pins-and-axles", "placing-and-snapping", "selection", "step-walking", diff --git a/apps/formblocks.json b/apps/formblocks.json index ad6f6b1..92b48f0 100644 --- a/apps/formblocks.json +++ b/apps/formblocks.json @@ -30,7 +30,7 @@ "macos": "", "linux": "", "windows": "", - "tauri_config": "" + "tauri_config": "{\"bundle\":{\"linux\":{\"rpm\":{\"compression\":{\"type\":\"none\"}}}}}" }, "setup": {"macos": "", "linux": "", "windows": ""}, "post_build": {"macos": "", "linux": "", "windows": ""}, @@ -66,5 +66,5 @@ "linux": "glibc 2.35" } }, - "notes_for_owner": "The proposed entry for FormBlocks, made from FormAnything's template. The project file .fblk is FormBlocks' own and is not yet in formcompiler's registry. The parts library is not bundled: the app fetches it from library.ldraw.org on first run, after the person's consent, so no extra or asset is needed. Windows runs ./formblocks in Git Bash; if that path fails on its first run, set windows_shell to cmd, which runs formblocks.bat, whose desktop build passes --config on. install_args is --lite, which installs everything today because the app has no optional part. The desktop bundle needs the app's icons in src-tauri/icons before its first build. minimum_os repeats FormCAD's, which is built by the same pipeline." + "notes_for_owner": "The proposed entry for FormBlocks, made from FormAnything's template. The project file .fblk is FormBlocks' own and is not yet in formcompiler's registry. The parts library is not bundled: the app fetches it from library.ldraw.org on first run, after the person's consent, so no extra or asset is needed. Windows runs ./formblocks in Git Bash; if that path fails on its first run, set windows_shell to cmd, which runs formblocks.bat, whose desktop build passes --config on. install_args is --lite, which installs everything. The three contract calls ran on Linux x64 from a fresh clone with this tauri_config, unsigned: deb, rpm and AppImage start and stop cleanly. macOS and Windows are unbuilt; src-tauri/HASHOUT_LOG.md lists what to look at. The engine is the resource engine/ (FormCAD's way); on macOS the freeze signs its Mach-O files before tauri build. minimum_os is the owner's answer." } diff --git a/apps/products-row.json b/apps/products-row.json index 66da865..53de9d5 100644 --- a/apps/products-row.json +++ b/apps/products-row.json @@ -4,12 +4,15 @@ "group": "other", "status": "in-development", "kind": "bricks", + "alt_of": "BrickLink Studio", "summary": "Brick building on the open LDraw parts library: find parts, place and snap them in 3D, colour them and save LDraw files.", "identifier": "ai.nodemode.formblocks", "repository": "https://github.com/nodemode-dev/formblocks", "licence": "Apache-2.0", "project_extensions": [".fblk"], "minimum_os": { - "macos": "macOS 14" + "macos": "macOS 14", + "windows": "", + "linux": "glibc 2.35" } } diff --git a/assets/screenshot.png b/assets/screenshot.png index a4e9546..e2ab6ab 100644 Binary files a/assets/screenshot.png and b/assets/screenshot.png differ diff --git a/backend/HASHOUT_LOG.md b/backend/HASHOUT_LOG.md index c865299..d8d2902 100644 --- a/backend/HASHOUT_LOG.md +++ b/backend/HASHOUT_LOG.md @@ -2,6 +2,51 @@ Living record of decisions and removed context for the engine, newest first. Read before editing. +## A paste by offset refuses an overlap · 0.6.0 (app/cmd/commands/clipboard.py, app/cmd/placing.py) + +`SPEC.md` 8.2: with the check on, placing and duplicating never put a part where it would overlap. A paste at a pointer ray already followed the drag's rule; a paste without one, where the lines put the parts moved by `delta`, did not ask at all, so pasting a copy back with no offset stacked it inside its original. `placing.refuse_copies` now tests each pasted part's real shape at its new place against the model (`overlap_check`, with seated pairs judged as fitted, as for a turn) before anything is inserted, and the paste is refused with the pairs. Uses of submodels are not tested, as in a turn. `part.duplicate` keeps its old behaviour: with no offset it copies exactly onto the originals, which agents use before moving the copies, so refusing it would break that use. Checked on 9230: a copy pasted with no offset was refused with the check on, one pasted a brick higher or 100 LDU across was not, and with the check off the first went through. + +## The self-check names the pin and axle kinds' data files · 0.6.0 (formblocks_engine.py) + +The pin and axle kinds of this version each read a JSON file beside their module, `app/connect/kinds/pin.json` and `axle.json`, and stop the engine with a sentence when it cannot be read, as the stud, clip and hinge kinds do. +`--selfcheck` now lists them under `data_files` with the other five, so a freeze that drops one names it. `setup/freeze_backend` already carries every `*.json` under `app/`. Checked: `backend/venv/bin/python backend/formblocks_engine.py --selfcheck` answers `data_files` ok and `modules` ok; the frozen engine was not built by this lane. + +## step.reorder and step.move_to_new · 0.6.0 (app/cmd/commands/step_order.py) + +`SPEC.md` 11.3 has "Move to new step", which puts the selected parts in a new step right after the step shown; `step.move_parts` could only start a new step at the end. `step.move_to_new` takes the ids (the selection when left out), takes them out of whatever steps held them (an emptied step stays, as 11.5 keeps empty steps), inserts a step holding them after the step shown and shows it. Reordering steps was asked for this turn and is added to 11.3: `step.reorder` moves a step whole to another number and the steps between close up; the step shown stays the same step, so a person walking at step 4 who drags step 8 to the front is now at step 5 and still sees what they saw. Both keep the file's step lines right: every step but the last is closed by `0 STEP`, and the last keeps whatever the file had (the sample car ends with one). +Moving a step onto its own number is refused with the reason, so it adds no undo step. Both live in their own module beside `step.py` and use its `_steps` answer. Run against the engine on 9240 with the car: step 8 to 1 with step 3 shown gave steps of 10, 5, 10, 3, 4, 15, 11, 3 placements with step 4 shown; `p1` and `p2` to a new step gave nine steps with the new one shown; the saved file had nine `0 STEP` lines; two undos gave back the car's eight steps exactly. + +## colours.favourite stars a colour · 0.6.0 (app/cmd/commands/colours.py) + +`SPEC.md` 3.2 and 3.4 have a colour starred or unstarred from its swatch with `colours.favourite` (colour, on or off), and the settings have kept `favourite_colours` since 0.3.0, but nothing could write it except a hand edit of `settings.json`. The command is of kind `view` like `colours.current`: a setting of the person's, never an undo step. A starred colour goes to the front of the list, so the window's favourites row shows the newest star first; `on` left out turns the star the other way, which is what a key on a swatch wants, and the answer says which way it went. 16 and 24 are refused with the reason, as the settings already refuse them as the current colour. Run against the engine on 9240: 1 starred, 4 starred on, 1 unstarred left `[4]`; 16 refused with 422. + +## The four kinds of selection take add · 0.6.0 (app/cmd/commands/select.py, app/cmd/commands/select_kind.py) + +`SPEC.md` 6.2: in any pick mode Shift+click adds what the mode would select to the selection already made, so kinds can be combined. `select.by_colour`, `select.by_part`, `select.by_part_colour` and `select.attached` each take `add`; with it true the parts found are appended to the selection, each once and after the ones already there, through one helper (`select.choose`). One command per click keeps it a single change of the selection, which a window adding the found ids itself would have made two. Checked on 9230 through the window: same colour with Shift added the green parts to a yellow one. + +## select.by_part_colour and select.attached · 0.6.0 (app/cmd/commands/select_kind.py) + +`SPEC.md` 6.2 and 6.5 name four kinds; `select.by_colour` and `select.by_part` were built, these are the other two. Both start from given placements or the selection, as the Select menu's "same as selected" entries and a click in a pick mode need. Same part and colour matches the pair, by the same part key `select.by_part` uses, so a printed part is a different part. Attached walks outward from the start through every neighbour whose connectors are seated with the current part's (`connect.joined`, the test the overlap check uses for a fitted pair: studs, clips on bars, hinges), however far the chain goes; hidden parts are passed over and so break a chain, since a hidden part offers no connectors (9.3), and a use of a submodel joins nothing because it has no connectors of its own. Checked on 9230: a stack of two 3001 and a 3003, with a loose 3001 beside it, gave the stack from either end, the loose brick alone, and only the bottom brick once the middle one was hidden. + +## clipboard.copy, clipboard.cut, clipboard.paste and POST /api/place/paste · 0.6.0 (app/cmd/commands/clipboard.py, app/cmd/placing.py, app/routers/place.py) + +`SPEC.md` 5.4 and 5.7: the clipboard holds the copied parts as LDraw lines, so they paste between windows and into a text editor, and paste brings them in as a ghost under the pointer. Copy writes one type 1 line per placement (colour, position, rotation, file name, exactly as a saved file writes them) and answers the text; the window puts it on the system clipboard. The engine keeps the last text too, so an agent or the command line, which have no system clipboard, can paste without giving it. Cut is copy and delete in one undo step. +Paste reads only the part lines of any LDraw text, refuses a name that is neither in the library nor a submodel of this model (and a use that would hold itself), and adds the parts in their relative places: with a pointer ray, by the rule of a drag of copies (5.1), the lowest pasted part seated under the pointer and the others following it, lifted onto the ground, refused with the overlap check on; without one, where the lines put them, moved by `delta`. A paste of uses of submodels alone cannot be held under the pointer, as with Ctrl+D (they have no connectors), and must use `delta`. `placing.paste` is `placing.drag` for parts that are not in the model yet: the pasted parts are named `c1`, `c2` and so on in the order of their lines, which is how the preview route's `moves` and the window's ghosts name them. +The route answers what a paste at a ray would do and changes nothing, as `/api/place/drag` does. Checked on 9230: two bricks copied, pasted 200 LDU across, pasted at a ray onto the top of the stack, seated; cut removed one; a line naming a part the library lacks was refused. + +## A start that cannot go on says why, in one line the shell can show · 0.6.0 (formblocks_engine.py) + +Before, a data folder the engine could not write ended in a Python traceback, a second engine on the same data folder printed a bare sentence, and a taken `FORMBLOCKS_PORT` ended in uvicorn's own error with exit 3; the desktop shell saw none of it and said only that the engine failed to start. Each of these now ends in one line on standard error that starts with `formblocks-start-error: ` and says what to do: the data folder that cannot be written and why (`--user-data-dir` names another), FormBlocks already running on that folder and its process (close it, or another data folder), the port that is taken (close the other program, or `FORMBLOCKS_PORT` 0 to let the engine choose), and an engine that cannot load its own modules (reinstall). The exit codes are 4, 2, 3 and 5. +The folder is tried by writing and removing a small file before the lock is taken, because `mkdir` succeeds on an existing folder that is read only; the port is tried by binding it (with `SO_REUSEADDR` on macOS and Linux, as uvicorn binds) only when a fixed port is asked for, so the desktop's port 0 costs nothing, and the lock is released when the port or the import fails. Checked from source on Linux: `FORMBLOCKS_DATA_DIR` under `/proc`, under a file, on a read-only tmpfs and in a folder below it each gave the data folder line and exit 4; a second engine on the data folder of one running on 9251 gave the already running line and exit 2; a third on 9251 with its own folder gave the port line and exit 3 and left no lock; the self-check passed. The shell side is in `src-tauri/HASHOUT_LOG.md`. + +## The switches flip in the engine: snap.toggle, overlap.toggle, overlap.nested_toggle, grid.next, angle.next · 0.6.0 (app/cmd/commands/view_switches.py) + +Pressing O twice quickly under heavy throttling once left the overlap check on. Every status bar switch and its key sent `x.set` with the opposite of the value the window had last read, so a second press made before the first answer arrived sent the same value again, and S, G, A and the Nested switch had the same fault. The engine owns the setting, so it now decides the flip: each of these five commands reads its own setting under the document's lock and writes the next value (the opposite, or the next of stud, plate, fine, or of 90, 45, 22.5, 15, 5, 1), so presses are taken in the order they arrive and two always end where they began. They are `view` commands like the `.set` ones they sit beside, never undo steps, and answer every switch's value. The `.set` commands stay for preferences and agents that know the value they want. Checked on 9230: two `overlap.toggle` gave on then off; `angle.next` walked 90 to 45 to 22.5 and round to 90. + +## Nudges and typed values refuse an overlap · 0.6.0 (app/cmd/commands/part.py, app/cmd/placing.py) + +`SPEC.md` 5.3: nudges and typed values ignore connectors, "and the overlap check still applies". `part.move` and `part.set_transform` never asked it, so with the check on an arrow key put a brick 80 LDU into its neighbour and the details panel put one exactly on top of another. Both now work out every new place first and ask the same test a turn asks (`placing.overlaps_after`, the turn's own `_turn_clashes` under a public name: each moved part's real shape against its neighbours, the parts that move together and hidden parts left out, joined pairs judged as fitted), and refuse with the pairs and depths before anything is written, so a refused nudge leaves no undo step. With the check off nothing changes. Checked on 9230: a brick moved 80 LDU into another and one typed onto another's place were refused, both moved together and one stacked on top were not, and with the check off the same move went through. + ## The self-check names every data file the engine reads · 0.5.0 (formblocks_engine.py) `--selfcheck` listed the stud kind's data, the overrides and the categories under `data_files`; the clip and hinge kinds' `clip.json` and `hinge.json`, added in 0.5.0, were caught only indirectly, as a module that fails to import. They are now named with the others, so a freeze that drops one says which file is missing. These five are every file the engine's package reads beside its code (the rest of `app/` that is not Python is hashout logs and `FORMAT.md`). Checked: `./formblocks freeze` then `src-tauri/engine/formblocks-engine --selfcheck` answers `data_files` ok and `modules` ok, and the frozen `_internal/app` holds all five. @@ -12,7 +57,9 @@ Living record of decisions and removed context for the engine, newest first. Rea ## On Windows a program is started without the command interpreter whenever it can be · 0.5.0 (app/services/windows_start.py, agent_programs.py, chat.py) -The first fix for Windows (below, "a tab's first message is typed") kept every `.cmd` program behind `cmd.exe` and only kept the message off its line. FormAnything's agent lane, working on the same fault, described a stronger rule, and this is FormBlocks' own version of it: most `.cmd` programs are not batch programs at all but npm's or pnpm's small shim, whose one real line runs `node` on a script in the package (Claude Code and Codex from npm) or runs an `.exe` the package carries. `windows_start.py` reads the shim, finds the last quoted path that starts with the shim's own folder (`%dp0%` or `%~dp0`) on the line that passes `%*`, and, when that file exists and is a script or a program, starts it directly: the `.exe` itself, or `node.exe` beside the shim (else the `node` on the child's PATH) with the script. No interpreter is involved, so a message, a folder or a JSON setting reaches the program exactly, and the message stays an argument after `--` even on Windows. Any other batch file must go through the interpreter, and then only as `cmd.exe /d /v:off /c call ` (no AutoRun commands, no delayed expansion, `call` so a quoted path with spaces is run as one), and only when no word holds `"`, `%`, `^`, `!`, a line break or NUL, and `& | < > ( )` appear only in words with a space or tab, which the C runtime's joining puts inside quotes the interpreter respects; otherwise it is refused with a sentence. A dock tab whose program needs the interpreter still gets its first message typed, as before. `start_words` takes the child's environment so `node` and `COMSPEC` are looked for where the program will run, so a tab now issues its token before building the command and revokes it if the command is refused. Unix is unchanged: the login shell with each word in single quotes. `agent_lookup.py` (the family's file, held to its hash) still starts `--version` checks its own way, which carries no supplied text. Checked here, on Linux, with shims written in npm's and pnpm's forms and the platform made to take this path: an npm `codex.cmd` started `node codex.js -- `, an npm `claude.cmd` naming an `.exe` started that `.exe`, a pnpm `cursor-agent.cmd` started the `node.exe` beside it with its `.mjs`, all with a message holding quotes, `&`, `%`, `|`, `<`, `^`, `!` and a line break intact; a plain `other.bat` was refused for that message and for a JSON word, allowed `plain` and `a & b`, refused `a&b`. The dock and Chat on Linux started as before. Not run: Windows. +The first fix for Windows (below, "a tab's first message is typed") kept every `.cmd` program behind `cmd.exe` and only kept the message off its line. FormAnything's agent lane, working on the same fault, described a stronger rule, and this is FormBlocks' own version of it: most `.cmd` programs are not batch programs at all but npm's or pnpm's small shim, whose one real line runs `node` on a script in the package (Claude Code and Codex from npm) or runs an `.exe` the package carries. `windows_start.py` reads the shim, finds the last quoted path that starts with the shim's own folder (`%dp0%` or `%~dp0`) on the line that passes `%*`, and, when that file exists and is a script or a program, starts it directly: the `.exe` itself, or `node.exe` beside the shim (else the `node` on the child's PATH) with the script. +No interpreter is involved, so a message, a folder or a JSON setting reaches the program exactly, and the message stays an argument after `--` even on Windows. Any other batch file must go through the interpreter, and then only as `cmd.exe /d /v:off /c call ` (no AutoRun commands, no delayed expansion, `call` so a quoted path with spaces is run as one), and only when no word holds `"`, `%`, `^`, `!`, a line break or NUL, and `& | < > ( )` appear only in words with a space or tab, which the C runtime's joining puts inside quotes the interpreter respects; otherwise it is refused with a sentence. A dock tab whose program needs the interpreter still gets its first message typed, as before. +`start_words` takes the child's environment so `node` and `COMSPEC` are looked for where the program will run, so a tab now issues its token before building the command and revokes it if the command is refused. Unix is unchanged: the login shell with each word in single quotes. `agent_lookup.py` (the family's file, held to its hash) still starts `--version` checks its own way, which carries no supplied text. Checked here, on Linux, with shims written in npm's and pnpm's forms and the platform made to take this path: an npm `codex.cmd` started `node codex.js -- `, an npm `claude.cmd` naming an `.exe` started that `.exe`, a pnpm `cursor-agent.cmd` started the `node.exe` beside it with its `.mjs`, all with a message holding quotes, `&`, `%`, `|`, `<`, `^`, `!` and a line break intact; a plain `other.bat` was refused for that message and for a JSON word, allowed `plain` and `a & b`, refused `a&b`. The dock and Chat on Linux started as before. Not run: Windows. ## A pivot ray that meets no part answers the centre, not a refusal · 0.5.0 (app/cmd/commands/part.py) @@ -28,7 +75,8 @@ This corrects "part.pivot takes a pointer ray to turn about the point clicked". ## A turn about a hinge is never lifted: the ground stops it · 0.5.0 (app/cmd/placing.py, app/cmd/commands/part.py) -Lifting a turned part off the ground is right for a part turned about its own centre, but a part turned about the hinge it hangs on would be lifted off the hinge, and the next `part.pivot` no longer found it joined: checked in process with a Hinge Plate 1 x 2 with 2 Fingers (4276b) joined to one with 3 Fingers (4275b) on the ground, a turn of -45 degrees about the hinge was lifted 28.5 LDU and the hinge came apart. `placing.turn` now asks `on_hinge` whether the turn's point lies on the hinge axis `hinge_of` finds (within 0.5 LDU) and its axis is that axis either way; such a turn that would go below the ground is blocked, with the ground named as what it meets, so the dial stops at the last free angle and `part.rotate` refuses with a sentence saying why. A turn of the same part about its centre (R, or the dial of a group) still lifts. The label names a negative axis as such ("about -Z") rather than as a direction. Checked in process with the same pair: -45 about the hinge was refused, +45 turned it up off the ground with the hinge still joined and `part.pivot` still answering the hinge, and a further +90 was refused at 5.7 LDU into the ground. +Lifting a turned part off the ground is right for a part turned about its own centre, but a part turned about the hinge it hangs on would be lifted off the hinge, and the next `part.pivot` no longer found it joined: checked in process with a Hinge Plate 1 x 2 with 2 Fingers (4276b) joined to one with 3 Fingers (4275b) on the ground, a turn of -45 degrees about the hinge was lifted 28.5 LDU and the hinge came apart. `placing.turn` now asks `on_hinge` whether the turn's point lies on the hinge axis `hinge_of` finds (within 0.5 LDU) and its axis is that axis either way; such a turn that would go below the ground is blocked, with the ground named as what it meets, so the dial stops at the last free angle and `part.rotate` refuses with a sentence saying why. A turn of the same part about its centre (R, or the dial of a group) still lifts. +The label names a negative axis as such ("about -Z") rather than as a direction. Checked in process with the same pair: -45 about the hinge was refused, +45 turned it up off the ground with the hinge still joined and `part.pivot` still answering the hinge, and a further +90 was refused at 5.7 LDU into the ground. ## part.connectors lists one kind when asked, with each connector's index · 0.5.0 (app/cmd/commands/connect.py) @@ -36,7 +84,8 @@ With clips, bars and six pairs of hinge halves beside studs, a baseplate's hundr ## A part joined by a hinge turns about the hinge, through the connect lane's hinge_axes · 0.5.0 (app/cmd/placing.py) -`SPEC.md` 5.2 (decided in 0.5.0) turns one part joined by a hinge connector about the hinge's axis. `placing.hinge_of` is the one place that finds it: for a selection of one library part it asks `app.connect.hinge_axes` (the interface the connector lane wrote down this turn, stable by its word) for the axes that placement is joined on, in the hash of its submodel, and takes the first one's `point_ldraw` and `direction_ldraw`; `part.pivot` then answers that point with the one hinge axis, and the dial sends it back to `part.rotate` as `about` and `axis_vector`. The import is made when asked and a missing name means no hinge, so the engine runs the same with or without the hinge kinds, and nothing here names a kind. A group, or a part joined by two hinges, turns about the first axis only for one part and about its centre for a group, since a group's members may sit on hinges that do not share an axis. Checked in process: with `hinge_axes` not yet in `app.connect`, `part.pivot` on a 3001 still answered its centre; the hinge path itself was not run, for want of the function. +`SPEC.md` 5.2 (decided in 0.5.0) turns one part joined by a hinge connector about the hinge's axis. `placing.hinge_of` is the one place that finds it: for a selection of one library part it asks `app.connect.hinge_axes` (the interface the connector lane wrote down this turn, stable by its word) for the axes that placement is joined on, in the hash of its submodel, and takes the first one's `point_ldraw` and `direction_ldraw`; `part.pivot` then answers that point with the one hinge axis, and the dial sends it back to `part.rotate` as `about` and `axis_vector`. The import is made when asked and a missing name means no hinge, so the engine runs the same with or without the hinge kinds, and nothing here names a kind. +A group, or a part joined by two hinges, turns about the first axis only for one part and about its centre for a group, since a group's members may sit on hinges that do not share an axis. Checked in process: with `hinge_axes` not yet in `app.connect`, `part.pivot` on a 3001 still answered its centre; the hinge path itself was not run, for want of the function. ## `overlap.check` lists nested pairs apart, and when asked · 0.5.0 (app/cmd/commands/connect.py) @@ -53,7 +102,10 @@ Every switch command now answers `overlap_nested` with the other three. The summ ## On Windows a tab's first message is typed, never put where the command interpreter reads it · 0.5.0 (app/services/agent_programs.py, app/services/chat.py) -A dock tab opened with a first message started Claude Code as `claude ... -- `. On Windows the program found is often a `.cmd` file (npm's shim), and the family finder starts such a file as `cmd.exe /c claude.cmd ...`. The command interpreter reads that whole line before the program does: `&`, `|`, `<` and `>` outside its idea of a quoted stretch start other commands or redirect, `^` is eaten, `%NAME%` is replaced by a variable even inside quotes, and a line break ends the command. The pseudo-terminal library joins the words with the C runtime's quoting (`\"` for a quote), which the interpreter does not know, so a message with a quote in it flips the interpreter's quoting and leaves the rest of the message bare. No quoting fixes this for any text (a line break cannot be carried at all), so the message is kept off that line: when the program would start through the interpreter, the tab starts it without the message and types the message into the tab once the program has printed something and then been quiet for 0.8 seconds (up to 30 seconds), the same keystrokes as a message sent to a Claude tab already running. Everywhere else the message stays an argument after `--`, because the login shell's start quotes each word in single quotes and nothing is read twice. Second, `start_words` refuses to start a `.cmd` or `.bat` program when any of its arguments holds a character the interpreter acts on (`& | < > ^ % !`, a line break or NUL); FormBlocks' own arguments (the MCP settings, the note, a resume id, Codex's `-c` settings) have none, so this refuses only text that should not be there, and Chat, which sends every message on standard input already, goes through the same check. `agent_lookup.py` is the family's file, held to its hash, so this lives in FormBlocks' own module; the family's copy should start an interpreter with `/d` and make the same check. Checked here on Linux with a stand-in `claude` that records its arguments, folder and typed lines, the message `it's "quoted" & 50% | ^ !x %PATH%`, a line break, `second line`, a line break, `-p --leading-dash`, in a folder named `odd & 50% folder`: as before, the stand-in received the message intact as the last argument, in that folder, with the tab's token in its environment; with the start made to take the interpreter path, the argument list ended at the note and the three lines arrived as typed input. `start_words` refused a `.cmd` with the message as an argument and passed the Claude and Codex arguments FormBlocks gives. Not run: Windows itself. +A dock tab opened with a first message started Claude Code as `claude ... -- `. On Windows the program found is often a `.cmd` file (npm's shim), and the family finder starts such a file as `cmd.exe /c claude.cmd ...`. The command interpreter reads that whole line before the program does: `&`, `|`, `<` and `>` outside its idea of a quoted stretch start other commands or redirect, `^` is eaten, `%NAME%` is replaced by a variable even inside quotes, and a line break ends the command. The pseudo-terminal library joins the words with the C runtime's quoting (`\"` for a quote), which the interpreter does not know, so a message with a quote in it flips the interpreter's quoting and leaves the rest of the message bare. +No quoting fixes this for any text (a line break cannot be carried at all), so the message is kept off that line: when the program would start through the interpreter, the tab starts it without the message and types the message into the tab once the program has printed something and then been quiet for 0.8 seconds (up to 30 seconds), the same keystrokes as a message sent to a Claude tab already running. Everywhere else the message stays an argument after `--`, because the login shell's start quotes each word in single quotes and nothing is read twice. +Second, `start_words` refuses to start a `.cmd` or `.bat` program when any of its arguments holds a character the interpreter acts on (`& | < > ^ % !`, a line break or NUL); FormBlocks' own arguments (the MCP settings, the note, a resume id, Codex's `-c` settings) have none, so this refuses only text that should not be there, and Chat, which sends every message on standard input already, goes through the same check. `agent_lookup.py` is the family's file, held to its hash, so this lives in FormBlocks' own module; the family's copy should start an interpreter with `/d` and make the same check. +Checked here on Linux with a stand-in `claude` that records its arguments, folder and typed lines, the message `it's "quoted" & 50% | ^ !x %PATH%`, a line break, `second line`, a line break, `-p --leading-dash`, in a folder named `odd & 50% folder`: as before, the stand-in received the message intact as the last argument, in that folder, with the tab's token in its environment; with the start made to take the interpreter path, the argument list ended at the note and the three lines arrived as typed input. `start_words` refused a `.cmd` with the message as an argument and passed the Claude and Codex arguments FormBlocks gives. Not run: Windows itself. ## POST /api/place/turn answers a turn without making it · 0.5.0 (app/routers/place.py) @@ -61,23 +113,29 @@ The pivot dial turns the selected parts in place in the window while the person ## part.rotate turns by an angle about any axis, lifts off the ground and refuses an overlap; part.pivot and angle.step · 0.5.0 (app/cmd/commands/part.py, app/cmd/placing.py) -`SPEC.md` 5.2 (decided in 0.5.0). `part.rotate` keeps `axis` and `quarter_turns` as they were, so the window's R, T and Y and every saved script still work, and takes `angle` in degrees in place of `quarter_turns` and `axis_vector` (a direction in LDraw axes, such as a hinge's) in place of `axis`; exactly one of each pair. Its default point is now the centre of the box around the placements' shapes as placed, not the centre of their origins: a part's origin is the top of its body, so tipping a brick about its origin swung it half its height off where it was, and the dial needs a point a person sees as the middle. The rule lives in `placing.turn` so the window's preview route and the command run the same code: every placement turns about the point, a quarter turn about X, Y or Z unrounded and anything else through `transform.settle`; the lowest point before and after is read from the parts' real triangles (a turned box of a part turned 45 degrees reaches lower than the part does), from the shape's box when there are none, and through the placements of a use's submodel; when the turned lowest point is below the ground (LDraw's y over 0), or below where the selection already was when it started lower, the whole turn is lifted straight up by the difference. With the overlap check on, each turned library part is checked by the overlap check's own `overlap_check` against the parts of its submodel that do not turn, hidden ones skipped and parts it is still joined to (a turn about a hinge keeps its joint) allowed, and a clash refuses the whole command with the pairs named, as a move is. `part.pivot` (read) answers the point, the axes in both LDraw and scene axes, and the box's half diagonal for the dial's size, so the window draws only what it is told; `placing.hinge_of` is the one place a hinge pivot is found. `angle.step` (view) sets the setting as `grid.step` sets its own. Checked in process with the 2026-10 library: four quarter turns of a 3001 gave back its exact matrix and position; a grounded 3001 tipped about X was lifted 6 LDU; a 22.5 degree turn wrote six place entries; a turn into a neighbour with the check on was refused naming both parts and changed nothing; `angle.step 30` was refused with the list. +`SPEC.md` 5.2 (decided in 0.5.0). `part.rotate` keeps `axis` and `quarter_turns` as they were, so the window's R, T and Y and every saved script still work, and takes `angle` in degrees in place of `quarter_turns` and `axis_vector` (a direction in LDraw axes, such as a hinge's) in place of `axis`; exactly one of each pair. Its default point is now the centre of the box around the placements' shapes as placed, not the centre of their origins: a part's origin is the top of its body, so tipping a brick about its origin swung it half its height off where it was, and the dial needs a point a person sees as the middle. +The rule lives in `placing.turn` so the window's preview route and the command run the same code: every placement turns about the point, a quarter turn about X, Y or Z unrounded and anything else through `transform.settle`; the lowest point before and after is read from the parts' real triangles (a turned box of a part turned 45 degrees reaches lower than the part does), from the shape's box when there are none, and through the placements of a use's submodel; when the turned lowest point is below the ground (LDraw's y over 0), or below where the selection already was when it started lower, the whole turn is lifted straight up by the difference. +With the overlap check on, each turned library part is checked by the overlap check's own `overlap_check` against the parts of its submodel that do not turn, hidden ones skipped and parts it is still joined to (a turn about a hinge keeps its joint) allowed, and a clash refuses the whole command with the pairs named, as a move is. `part.pivot` (read) answers the point, the axes in both LDraw and scene axes, and the box's half diagonal for the dial's size, so the window draws only what it is told; `placing.hinge_of` is the one place a hinge pivot is found. `angle.step` (view) sets the setting as `grid.step` sets its own. Checked in process with the 2026-10 library: four quarter turns of a 3001 gave back its exact matrix and position; a grounded 3001 tipped about X was lifted 6 LDU; a 22.5 degree turn wrote six place entries; a turn into a neighbour with the check on was refused naming both parts and changed nothing; `angle.step 30` was refused with the list. ## The right column's layout is a setting · 0.5.0 (app/core/settings.py) -`SPEC.md` 1.2 keeps the layout (collapsed panels, which tab is open, the sizes) from one start to the next, and the window kept the right column's two divider heights in the browser's local storage only, which a desktop build and a browser on the same data folder do not share. `right_column` holds the colour palette's and the details panel's heights in pixels (null for the window's own default from its tokens), the sections folded to their headers (`colours`, `tabs`, `details`) and the tab shown (`model`, `steps`, `parts`, `info`, or null). The engine only checks the shape: a height from 1 to 4,000 pixels, known section and tab names, nothing else in the object; whether a height fits the window is the window's to decide, since only it knows how tall it is. The region sits after `CHECKS` so the setting is one edit in this shared file. Checked on 9240: a write of colours 250, details folded and the Parts tab came back with details null, a height of `true` was refused with the sentence, and the value reached `settings.json`. +`SPEC.md` 1.2 keeps the layout (collapsed panels, which tab is open, the sizes) from one start to the next, and the window kept the right column's two divider heights in the browser's local storage only, which a desktop build and a browser on the same data folder do not share. `right_column` holds the colour palette's and the details panel's heights in pixels (null for the window's own default from its tokens), the sections folded to their headers (`colours`, `tabs`, `details`) and the tab shown (`model`, `steps`, `parts`, `info`, or null). The engine only checks the shape: a height from 1 to 4,000 pixels, known section and tab names, nothing else in the object; whether a height fits the window is the window's to decide, since only it knows how tall it is. The region sits after `CHECKS` so the setting is one edit in this shared file. +Checked on 9240: a write of colours 250, details folded and the Parts tab came back with details null, a height of `true` was refused with the sentence, and the value reached `settings.json`. ## model.info counts colours and overlaps and names the missing parts · 0.5.0 (app/cmd/commands/info.py, app/routers/doc.py) -The window's model information panel shows only what the engine counted, so `model.info` now also answers `counts.colours` (the different colour numbers in the whole model's parts list, through every use), `counts.overlaps` (the `count` that `overlap.check` answers for the whole model, reached through the registry so that what counts as an overlap stays that command's alone; null when no library is in use), and `missingParts`, one entry per part number the library lacks with its file and how many the model needs in all colours, and `licences`, the list `model.set_info` accepts, so the window's licence choice offers exactly those without a copy of them. A `table` parameter, true by default, leaves the parts list and its CSV text out when false: the panel asks again after every change, and the list is the Parts tab's work, not the panel's. `GET /api/doc/info` now runs the command instead of the service function, so the route and the command cannot drift apart again; `?table=false` passes through. The description a person edits is the title line LDraw files start with, already answered as `title`, so no second field holds it. Checked on 9240 with the sample car: 61 placements, 7 colours and 8 steps, the same as counting the file's type 1 lines, their colour numbers (0, 1, 4, 7, 36, 39, 46) and its `0 STEP` lines by hand; 20 overlaps, as `overlap.check` answered at that moment; a three-line model with two uses of a part the library lacks answered `zz999`, 2. +The window's model information panel shows only what the engine counted, so `model.info` now also answers `counts.colours` (the different colour numbers in the whole model's parts list, through every use), `counts.overlaps` (the `count` that `overlap.check` answers for the whole model, reached through the registry so that what counts as an overlap stays that command's alone; null when no library is in use), and `missingParts`, one entry per part number the library lacks with its file and how many the model needs in all colours, and `licences`, the list `model.set_info` accepts, so the window's licence choice offers exactly those without a copy of them. A `table` parameter, true by default, leaves the parts list and its CSV text out when false: the panel asks again after every change, and the list is the Parts tab's work, not the panel's. +`GET /api/doc/info` now runs the command instead of the service function, so the route and the command cannot drift apart again; `?table=false` passes through. The description a person edits is the title line LDraw files start with, already answered as `title`, so no second field holds it. Checked on 9240 with the sample car: 61 placements, 7 colours and 8 steps, the same as counting the file's type 1 lines, their colour numbers (0, 1, 4, 7, 36, 39, 46) and its `0 STEP` lines by hand; 20 overlaps, as `overlap.check` answered at that moment; a three-line model with two uses of a part the library lacks answered `zz999`, 2. ## A turn by any angle about any axis, exact for quarter turns · 0.5.0 (app/doc/transform.py) -`SPEC.md` 5.2 (decided in 0.5.0) turns the selection by the angle step or by whole degrees about any axis, a hinge's included. `turn_by(axis, degrees)` builds the turn from the axis and angle; when the angle is a whole number of quarter turns its cosine and sine are taken from the table 1, 0, -1, 0 rather than computed, so a quarter turn about X, Y or Z has entries of exactly 0, 1 and -1 and only moves and negates the numbers of the matrix it turns: four of them give back the same matrix bit for bit, which a computed cosine of 90 degrees (6e-17) would not. Any other turn goes through `settle`, which takes the nearest true rotation by a singular value decomposition when the matrix is one to within 0.001 (a scaled or sheared matrix read from a file is left as it is) and rounds each entry to six places, so a matrix read back from the saved file is the one in memory and 360 turns of one degree drift by under 2e-5 rather than compounding. `settle_place` rounds a turned position to three places, the precision of FormBlocks' own lines (`LDRAW.md`). Checked in process: four quarter turns about Y gave the identity exactly, two 45 degree turns settled to the exact quarter turn, 360 one degree turns ended within 1.6e-5 of the identity with determinant 1.0000000003. +`SPEC.md` 5.2 (decided in 0.5.0) turns the selection by the angle step or by whole degrees about any axis, a hinge's included. `turn_by(axis, degrees)` builds the turn from the axis and angle; when the angle is a whole number of quarter turns its cosine and sine are taken from the table 1, 0, -1, 0 rather than computed, so a quarter turn about X, Y or Z has entries of exactly 0, 1 and -1 and only moves and negates the numbers of the matrix it turns: four of them give back the same matrix bit for bit, which a computed cosine of 90 degrees (6e-17) would not. +Any other turn goes through `settle`, which takes the nearest true rotation by a singular value decomposition when the matrix is one to within 0.001 (a scaled or sheared matrix read from a file is left as it is) and rounds each entry to six places, so a matrix read back from the saved file is the one in memory and 360 turns of one degree drift by under 2e-5 rather than compounding. `settle_place` rounds a turned position to three places, the precision of FormBlocks' own lines (`LDRAW.md`). Checked in process: four quarter turns about Y gave the identity exactly, two 45 degree turns settled to the exact quarter turn, 360 one degree turns ended within 1.6e-5 of the identity with determinant 1.0000000003. ## The self-check imports every module of the engine · 0.5.0 (formblocks_engine.py) -The connect lane added two connector kinds, `clip` and `hinge`, each reading a JSON file beside its module when it is imported. The freeze carried a fixed list of data files, so the frozen engine had neither, and `formblocks-engine cli run part.connectors part=3001` ended in `RuntimeError: the clip kind's data file clip.json cannot be read`, while `--selfcheck` said `"data_files": "ok"`: it checked the three files it knew by name and imported the routers, the catalogue and the tool list, none of which imports the kinds at start. The self-check now also walks the `app` package and imports every module, reporting `"modules": "ok"` or each module that failed with its error, which fails the check and the freeze. Checked: the venv's self-check imports all 144 modules; a freeze made with the old data list now fails at its last step naming `app.connect.kinds.clip` and `app.connect.kinds.hinge`; with the freeze fixed (`setup/HASHOUT_LOG.md`) it passes and `part.connectors` lists the brick's connectors. +The connect lane added two connector kinds, `clip` and `hinge`, each reading a JSON file beside its module when it is imported. The freeze carried a fixed list of data files, so the frozen engine had neither, and `formblocks-engine cli run part.connectors part=3001` ended in `RuntimeError: the clip kind's data file clip.json cannot be read`, while `--selfcheck` said `"data_files": "ok"`: it checked the three files it knew by name and imported the routers, the catalogue and the tool list, none of which imports the kinds at start. The self-check now also walks the `app` package and imports every module, reporting `"modules": "ok"` or each module that failed with its error, which fails the check and the freeze. +Checked: the venv's self-check imports all 144 modules; a freeze made with the old data list now fails at its last step naming `app.connect.kinds.clip` and `app.connect.kinds.hinge`; with the freeze fixed (`setup/HASHOUT_LOG.md`) it passes and `part.connectors` lists the brick's connectors. ## The self-check says whether numpy came along · 0.5.0 (formblocks_engine.py) @@ -89,7 +147,8 @@ The part flattener under `app/mesh/` is the only user of `numpy`, and nothing th ## A change that cannot run is refused before the person is asked · 0.4.0 (app/automation/mcp.py, app/cmd/registry.py, app/cmd/commands/picture.py, info.py, model.py) -With the engine running and no window open, an outside agent's `picture.save` put a question up for nobody and was refused after the consent wait of 120 seconds; with a window open, a call with a `.jpg` path or a width of 5 asked the person first and failed only after they agreed. The MCP layer now checks a gated command before the question: the parameters go through the command's own `clean` (types, required, unknown names, lengths), and a command may register a `precheck` with `registry.precheck(name)` that tests what can be known without running it. `picture.save` and `picture.steps` check the path or folder, size, look, step and that a window is open to draw; `parts.list_save` its path ending and choices; `model.save_as` its path ending. A failed check answers at once with the command's own sentence, and nothing is asked. Then, when the person would be asked and no window is connected (`events.windows()`), the call is refused at once with a sentence saying so; a standing allow or block is still honoured without a window. Checked on 8347 with no window: `picture.save` to a good path, a `.jpg`, a width of 5, `picture.steps` into a missing folder, `parts.list_save` to `.xls`, `model.save_as` to `.txt`, `part.place` with an unknown parameter and a good `part.place` were each answered within 0.06 seconds. +With the engine running and no window open, an outside agent's `picture.save` put a question up for nobody and was refused after the consent wait of 120 seconds; with a window open, a call with a `.jpg` path or a width of 5 asked the person first and failed only after they agreed. The MCP layer now checks a gated command before the question: the parameters go through the command's own `clean` (types, required, unknown names, lengths), and a command may register a `precheck` with `registry.precheck(name)` that tests what can be known without running it. `picture.save` and `picture.steps` check the path or folder, size, look, step and that a window is open to draw; `parts.list_save` its path ending and choices; `model.save_as` its path ending. A failed check answers at once with the command's own sentence, and nothing is asked. +Then, when the person would be asked and no window is connected (`events.windows()`), the call is refused at once with a sentence saying so; a standing allow or block is still honoured without a window. Checked on 8347 with no window: `picture.save` to a good path, a `.jpg`, a width of 5, `picture.steps` into a missing folder, `parts.list_save` to `.xls`, `model.save_as` to `.txt`, `part.place` with an unknown parameter and a good `part.place` were each answered within 0.06 seconds. ## The picture broker is a service, and the routes only carry bytes · 0.4.0 (app/services/picture.py, app/routers/picture.py, app/cmd/commands/picture.py, app/doc/events.py) @@ -117,7 +176,8 @@ Module 2.2.0 lets a terminal record carry `status` and a channel report new stat ## A drag is held where the person took hold · 0.4.0 (app/cmd/placing.py, app/routers/place.py) -`CONNECTIONS.md` "The raw pose" holds a dragged part by its anti-stud nearest the point where the person took hold of it, but the drag route had only a connector index to go on, which the window cannot know, so every drag held the part by the middle of its underside and a brick pressed at one end jumped half its length under the pointer at the first move. `POST /api/place/drag` now takes the ray of the press as `press`; the engine meets it with the grabbed placement's own triangles (the same ray test as picking, on that placement alone), turns the point into the part's axes and answers `held`, the index of the part's connector nearest it. The window sends that index as `held` from then on and to `part.move_at_ray` or `part.duplicate_at_ray` on the drop, which already take it, so the drop seats exactly as the last preview did. `held` given wins over `press`. Checked against the 2026-10 library: a 3001 at the origin pressed straight down at its end stud (30, 10) and pointed at x = 130 lands with its centre at x = 100, the pressed end under the pointer; without `press` it lands at 120. +`CONNECTIONS.md` "The raw pose" holds a dragged part by its anti-stud nearest the point where the person took hold of it, but the drag route had only a connector index to go on, which the window cannot know, so every drag held the part by the middle of its underside and a brick pressed at one end jumped half its length under the pointer at the first move. `POST /api/place/drag` now takes the ray of the press as `press`; the engine meets it with the grabbed placement's own triangles (the same ray test as picking, on that placement alone), turns the point into the part's axes and answers `held`, the index of the part's connector nearest it. The window sends that index as `held` from then on and to `part.move_at_ray` or `part.duplicate_at_ray` on the drop, which already take it, so the drop seats exactly as the last preview did. `held` given wins over `press`. +Checked against the 2026-10 library: a 3001 at the origin pressed straight down at its end stud (30, 10) and pointed at x = 130 lands with its centre at x = 100, the pressed end under the pointer; without `press` it lands at 120. ## The contract route names the agent tab's kind · 0.4.0 (app/routers/terminal.py) @@ -141,7 +201,8 @@ Dock clause 10's `signedIn` was read for Claude Code only and null for the other ## The read-only agent tab shows what outside agents ask · 0.4.0 (app/services/agent_feed.py, app/services/terminal.py) -Dock clause 3 has a fifth kind of tab, `agent`, read only, "showing an agent's commands"; FormVis fills one from its Chat's shell calls. In FormBlocks the agents the person cannot otherwise watch are the outside ones (Claude Code, Codex, Cursor or Antigravity started elsewhere, reaching the engine through the stdio bridge or `/mcp`), so the tab is theirs. `AgentFeed` is an ASGI middleware that sits inside the guard and watches only `POST /mcp`: when a request's body has arrived it writes one line per `tools/call` (time, the agent's name from `X-FormBlocks-Agent` or the `clientInfo` of an `initialize` in the same body, the tool and its arguments cut to 160 characters, unprintable characters blanked), and when the reply has gone it writes `done`, `refused` with the engine's sentence, or `failed` with the error. The call line comes first because a change waits for the person's answer, so the tab shows what is waiting while the question is open. A tab's own token marks the call as that tab's (`tab:` caller), and those calls are left out: they show in their own tab. The tab is made at the first call, as `terminal.feed()` with no program, alive, kind `agent`, titled "Outside agents"; the live channel then carries `{"type": "terminals"}` so a window adopts it. Typing into it does nothing (there is no program), restart is refused (409) as for any tab without a program, and closing it removes it until the next call. The middleware reads bodies of at most a megabyte for this and never changes what passes. Checked against an engine at 8341 with curl: a batch of `initialize` and `formblocks_status`, then `formblocks_execute` of an unknown command, showed in the tab's replay as two calls, `done` and `failed` with the engine's sentence. +Dock clause 3 has a fifth kind of tab, `agent`, read only, "showing an agent's commands"; FormVis fills one from its Chat's shell calls. In FormBlocks the agents the person cannot otherwise watch are the outside ones (Claude Code, Codex, Cursor or Antigravity started elsewhere, reaching the engine through the stdio bridge or `/mcp`), so the tab is theirs. `AgentFeed` is an ASGI middleware that sits inside the guard and watches only `POST /mcp`: when a request's body has arrived it writes one line per `tools/call` (time, the agent's name from `X-FormBlocks-Agent` or the `clientInfo` of an `initialize` in the same body, the tool and its arguments cut to 160 characters, unprintable characters blanked), and when the reply has gone it writes `done`, `refused` with the engine's sentence, or `failed` with the error. +The call line comes first because a change waits for the person's answer, so the tab shows what is waiting while the question is open. A tab's own token marks the call as that tab's (`tab:` caller), and those calls are left out: they show in their own tab. The tab is made at the first call, as `terminal.feed()` with no program, alive, kind `agent`, titled "Outside agents"; the live channel then carries `{"type": "terminals"}` so a window adopts it. Typing into it does nothing (there is no program), restart is refused (409) as for any tab without a program, and closing it removes it until the next call. The middleware reads bodies of at most a megabyte for this and never changes what passes. Checked against an engine at 8341 with curl: a batch of `initialize` and `formblocks_status`, then `formblocks_execute` of an unknown command, showed in the tab's replay as two calls, `done` and `failed` with the engine's sentence. ## No tab inherits a tab's token · 0.4.0 (app/services/terminal.py) @@ -149,15 +210,18 @@ Dock clause 11 says a plain shell tab gets no token. The engine never put one th ## picture.save and picture.steps ask the window and let go of the model while it draws · 0.4.0 (app/cmd/commands/picture.py) -`SPEC.md` 19.4 names `picture.save` and has the command line draw "in a hidden window" when none runs. The engine cannot draw, and starting a hidden window from the engine is the desktop shell's work, not something a headless engine can do here; so for now both commands need the window open and say so in one sentence otherwise. The command checks its path, size, step and view before asking, so a wrong value is refused without a round trip. `picture.steps` asks once per step of the submodel being edited and writes `name-01.png` onwards into an existing folder, with at least two digits so the files sort. Both are `file` commands: an outside agent's call waits for the person like a save. The runner holds the document's lock around a `file` command, and the window, while it draws, may read the model's changes through routes that take the same lock; so the command releases the lock (all of the current thread's holds of it) for the wait and takes it back after. The window is told the revision the engine had when it asked and draws once it has caught up to it. Checked on 8344 without a window: the refusal, width without height, step 99 of 8, a missing folder and scale 3, each with its sentence. +`SPEC.md` 19.4 names `picture.save` and has the command line draw "in a hidden window" when none runs. The engine cannot draw, and starting a hidden window from the engine is the desktop shell's work, not something a headless engine can do here; so for now both commands need the window open and say so in one sentence otherwise. The command checks its path, size, step and view before asking, so a wrong value is refused without a round trip. `picture.steps` asks once per step of the submodel being edited and writes `name-01.png` onwards into an existing folder, with at least two digits so the files sort. Both are `file` commands: an outside agent's call waits for the person like a save. +The runner holds the document's lock around a `file` command, and the window, while it draws, may read the model's changes through routes that take the same lock; so the command releases the lock (all of the current thread's holds of it) for the wait and takes it back after. The window is told the revision the engine had when it asked and draws once it has caught up to it. Checked on 8344 without a window: the refusal, width without height, step 99 of 8, a missing folder and scale 3, each with its sentence. ## The window draws pictures and the engine writes them · 0.4.0 (app/routers/picture.py) -The engine has no renderer and must not grow one: the window already holds the scene, its meshes and its colours. So a picture is always drawn by a window and always written by the engine. `POST /api/picture/file?path=` takes the PNG bytes the window drew for the person's own Save picture and writes them where the person chose, through `files.resolve` and `files.write` like every other file (a full path, an existing folder, written beside and renamed into place). `Broker` is the other way round, for a command: it publishes `{type: picture, id, spec}` on the live channel and waits up to 90 seconds for some window to post the bytes to `POST /api/picture/answer/{id}`, or a sentence saying why it could not. With no window connected it refuses at once in a plain sentence, since nothing could draw. The bytes are checked to be a PNG whose sides are 16 to 8192 pixels (`SPEC.md` 19.3) before anything is written, and a body over 256 MB is refused. Checked with curl on 8344: a 20 by 20 PNG written, a 4 by 4 one, a `.jpg` path and a relative path refused, a call without the window key refused, an answer to an unknown id refused. +The engine has no renderer and must not grow one: the window already holds the scene, its meshes and its colours. So a picture is always drawn by a window and always written by the engine. `POST /api/picture/file?path=` takes the PNG bytes the window drew for the person's own Save picture and writes them where the person chose, through `files.resolve` and `files.write` like every other file (a full path, an existing folder, written beside and renamed into place). `Broker` is the other way round, for a command: it publishes `{type: picture, id, spec}` on the live channel and waits up to 90 seconds for some window to post the bytes to `POST /api/picture/answer/{id}`, or a sentence saying why it could not. With no window connected it refuses at once in a plain sentence, since nothing could draw. +The bytes are checked to be a PNG whose sides are 16 to 8192 pixels (`SPEC.md` 19.3) before anything is written, and a body over 256 MB is refused. Checked with curl on 8344: a 20 by 20 PNG written, a 4 by 4 one, a `.jpg` path and a relative path refused, a call without the window key refused, an answer to an unknown id refused. ## Cursor's tab works in its own folder, which carries its instructions · 0.4.0 (app/services/agent_programs.py) -The Cursor tab used to add its `formblocks_tab` entry to `.cursor/mcp.json` in the terminal's working folder. From source that is the repository, so opening the tab rewrote a tracked file; in the desktop build it is the home folder, where `.cursor/mcp.json` is Cursor's own global list, so one tab left a FormBlocks entry in every later Cursor session. Cursor now gets a folder of its own under the data folder, `agent-tabs/cursor` (mode 0700), as Antigravity already had. Its `.cursor/mcp.json` (0600) names the address and the token only as `${env:FORMBLOCKS_MCP_URL}` and `${env:FORMBLOCKS_TAB_TOKEN}`, so no token is ever written there; Antigravity's file must hold the token, so its entry is written per tab and taken out at close, as before. Both folders also get what a working folder of the repository would have given them: an `AGENTS.md` with the tab's note and where the skill is, the `formblocks-driving` pack under `.agents/skills/` (copied from the repository's `skills/` when there is one, kept equal to it, files no longer in the pack removed), and for Cursor a rule in `.cursor/rules/formblocks.mdc` that always applies. Checked with stand-ins on the engine at 8341: both tabs started in their folders, the token reached the stand-in through the environment (Cursor) and the 0600 file (Antigravity), never through the arguments, `formblocks_status` answered 200 with it, and after the Antigravity tab closed the same token got 401 and its entry was gone from the file. +The Cursor tab used to add its `formblocks_tab` entry to `.cursor/mcp.json` in the terminal's working folder. From source that is the repository, so opening the tab rewrote a tracked file; in the desktop build it is the home folder, where `.cursor/mcp.json` is Cursor's own global list, so one tab left a FormBlocks entry in every later Cursor session. Cursor now gets a folder of its own under the data folder, `agent-tabs/cursor` (mode 0700), as Antigravity already had. Its `.cursor/mcp.json` (0600) names the address and the token only as `${env:FORMBLOCKS_MCP_URL}` and `${env:FORMBLOCKS_TAB_TOKEN}`, so no token is ever written there; Antigravity's file must hold the token, so its entry is written per tab and taken out at close, as before. +Both folders also get what a working folder of the repository would have given them: an `AGENTS.md` with the tab's note and where the skill is, the `formblocks-driving` pack under `.agents/skills/` (copied from the repository's `skills/` when there is one, kept equal to it, files no longer in the pack removed), and for Cursor a rule in `.cursor/rules/formblocks.mdc` that always applies. Checked with stand-ins on the engine at 8341: both tabs started in their folders, the token reached the stand-in through the environment (Cursor) and the 0600 file (Antigravity), never through the arguments, `formblocks_status` answered 200 with it, and after the Antigravity tab closed the same token got 401 and its entry was gone from the file. ## A missing agent program's menu note is one sentence · 0.4.0 (app/services/agent_programs.py) @@ -165,11 +229,13 @@ The dock shows `note` in the program's row of the More agents menu (module 2.2.0 ## parts.list answers what the Parts tab needs, and parts.list_save writes the safe CSV · 0.4.0 (app/cmd/commands/info.py) -Both commands now read `partslist.tally` and `partslist.rows` through one helper. New parameters: scope `this_step` (the step shown alone, beside `step`, which stays "up to the step shown"), and `submodels`, `expand` by default or `row` to count each use of a submodel as one row; `parts.list` also takes `text` and then answers the list as tab separated text, the window's "Copy as text" and a paste for an agent. Each row carries a stable `key` (number, colour, part or use), `movedFrom`, `submodel` and `ids`, the placements of the scope's submodel that hold it; the answer says which submodel was counted, the step, `selectable` (true when that submodel is the one being edited, so the ids can be selected), whether the library's index was ready, the missing count and the revision. `parts.list_save` writes `partslist.table_text`. `model.info`'s `csv` field and `cli parts list --csv` still go through `services/model_info.py`, which this lane does not own; they should call `partslist.span`, `tally`, `rows` and `table_text` so every CSV is the same. Checked on 8343: the car's list and its CSV, `this_step` at step 3 (3 parts in 2 rows), the MPD with `submodels=row` giving two rows of `wheel.ldr` in green and in main colour. +Both commands now read `partslist.tally` and `partslist.rows` through one helper. New parameters: scope `this_step` (the step shown alone, beside `step`, which stays "up to the step shown"), and `submodels`, `expand` by default or `row` to count each use of a submodel as one row; `parts.list` also takes `text` and then answers the list as tab separated text, the window's "Copy as text" and a paste for an agent. Each row carries a stable `key` (number, colour, part or use), `movedFrom`, `submodel` and `ids`, the placements of the scope's submodel that hold it; the answer says which submodel was counted, the step, `selectable` (true when that submodel is the one being edited, so the ids can be selected), whether the library's index was ready, the missing count and the revision. `parts.list_save` writes `partslist.table_text`. +`model.info`'s `csv` field and `cli parts list --csv` still go through `services/model_info.py`, which this lane does not own; they should call `partslist.span`, `tally`, `rows` and `table_text` so every CSV is the same. Checked on 8343: the car's list and its CSV, `this_step` at step 3 (3 parts in 2 rows), the MPD with `submodels=row` giving two rows of `wheel.ldr` in green and in main colour. ## The parts list is tallied with the placements that hold each pair · 0.4.0 (app/doc/partslist.py) -The window's Parts tab selects the parts of a row in the viewport, so a count alone is not enough: `tally` walks the steps of one submodel and records, for every part and colour, how many there are and which of that submodel's own placements hold them, a use of a submodel holding every part inside it. A slice of steps (`span`) gives the four scopes: the whole model from the main model, the submodel being edited, its steps up to the one shown, and the step shown alone. With `expand` off a use of a submodel is one row of its own, named by the submodel and coloured by the use. `rows` labels each pair from the library and merges a part whose file is a "moved to" pointer into the row of the part it points to, keeping the numbers the model wrote in `movedFrom` (3023 in the car is counted as 3023b); an alias, whose file is a real part, keeps its own number as `SPEC.md` 13.4 asks. A part the library does not have stays a row, first and marked. `table_text` writes the CSV of `SPEC.md` 13.3 with the owner's columns (LDraw part number, description, LDraw colour number, colour name, count): UTF-8 with a byte order mark so a spreadsheet takes the names as UTF-8, CR LF line ends, quotes doubled, and a cell that starts with `=`, `+`, `-` or `@` (or a tab or a carriage return) written after an apostrophe, since alias descriptions start with `=` and a spreadsheet would take them as formulas. `walk`, `scope_key` and `counts` are kept as they were for picking, `colours.used` and `model.info`. Checked in the engine on 8343 with the car (61 parts, 32 rows, 3023 merged into 3023b) and a two-file MPD with a moved part beside its target, a missing part, an alias sticker and a submodel used twice in two colours. +The window's Parts tab selects the parts of a row in the viewport, so a count alone is not enough: `tally` walks the steps of one submodel and records, for every part and colour, how many there are and which of that submodel's own placements hold them, a use of a submodel holding every part inside it. A slice of steps (`span`) gives the four scopes: the whole model from the main model, the submodel being edited, its steps up to the one shown, and the step shown alone. With `expand` off a use of a submodel is one row of its own, named by the submodel and coloured by the use. `rows` labels each pair from the library and merges a part whose file is a "moved to" pointer into the row of the part it points to, keeping the numbers the model wrote in `movedFrom` (3023 in the car is counted as 3023b); an alias, whose file is a real part, keeps its own number as `SPEC.md` 13.4 asks. +A part the library does not have stays a row, first and marked. `table_text` writes the CSV of `SPEC.md` 13.3 with the owner's columns (LDraw part number, description, LDraw colour number, colour name, count): UTF-8 with a byte order mark so a spreadsheet takes the names as UTF-8, CR LF line ends, quotes doubled, and a cell that starts with `=`, `+`, `-` or `@` (or a tab or a carriage return) written after an apostrophe, since alias descriptions start with `=` and a spreadsheet would take them as formulas. `walk`, `scope_key` and `counts` are kept as they were for picking, `colours.used` and `model.info`. Checked in the engine on 8343 with the car (61 parts, 32 rows, 3023 merged into 3023b) and a two-file MPD with a moved part beside its target, a missing part, an alias sticker and a submodel used twice in two colours. ## The drag route's copy switch no longer shadows the model's own method · 0.3.0 (app/routers/place.py) @@ -181,7 +247,8 @@ The command's `hue` parameter said "a hue family, such as red or blue", but each ## A drag is led by the lowest moving part and never ends below the ground · 0.3.0 (app/cmd/placing.py) -This corrects the last sentences of "Dragging a selection: POST /api/place/drag and part.move_at_ray", which left the question for the window's design: grabbing the top brick of a stack and pointing at the ground seated the top brick on the ground and carried the lower one 24 LDU under it. `spec/CONNECTIONS.md`, "Moving several parts", now decides it: `drag` finds the lead, the moving placement whose placed bounding box reaches lowest after any turn of the move (the grabbed one when it is within 0.5 LDU of that, so its held connector is kept), snaps the lead from the ray, and moves the rest rigidly with it; then, if any moved box still reaches below y = 0, the whole move is lifted by that depth. The turn sent during a drag is the grabbed part's, so it is applied to the lead as the same rigid turn. With a lift the overlap test runs for every moved part, the lead included. The preview's answer names `lead` and `lifted`, and its top-level pose is the lead's seat. The same rule serves `part.duplicate_at_ray`. Checked against an engine on 8346 with two stacked 3001 and a third beside them: the stack dragged by its top to the ground stood at y = -24 and -48 with p1 leading; pointed at the third brick, p1 seated on it with 8 pairs at -48 and the top at -72; dragged by its bottom it moved as before; with a quarter turn sent the stack turned whole and stayed on the ground; a tipped pair on one level was led by the grabbed brick. +This corrects the last sentences of "Dragging a selection: POST /api/place/drag and part.move_at_ray", which left the question for the window's design: grabbing the top brick of a stack and pointing at the ground seated the top brick on the ground and carried the lower one 24 LDU under it. `spec/CONNECTIONS.md`, "Moving several parts", now decides it: `drag` finds the lead, the moving placement whose placed bounding box reaches lowest after any turn of the move (the grabbed one when it is within 0.5 LDU of that, so its held connector is kept), snaps the lead from the ray, and moves the rest rigidly with it; then, if any moved box still reaches below y = 0, the whole move is lifted by that depth. The turn sent during a drag is the grabbed part's, so it is applied to the lead as the same rigid turn. With a lift the overlap test runs for every moved part, the lead included. +The preview's answer names `lead` and `lifted`, and its top-level pose is the lead's seat. The same rule serves `part.duplicate_at_ray`. Checked against an engine on 8346 with two stacked 3001 and a third beside them: the stack dragged by its top to the ground stood at y = -24 and -48 with p1 leading; pointed at the third brick, p1 seated on it with 8 pairs at -48 and the top at -72; dragged by its bottom it moved as before; with a quarter turn sent the stack turned whole and stayed on the ground; a tipped pair on one level was led by the grabbed brick. ## Every placement carries its scene matrix · 0.3.0 (app/doc/views.py, app/mesh/scene.py) @@ -189,7 +256,8 @@ FormBlocks' rule 5 keeps the one conversion between LDraw's axes and the scene's ## colours.used and colours.current · 0.3.0 (app/cmd/commands/colours.py) -`SPEC.md` 3.1 has a row of the colours used in the open model, most used first, and 3.4 names `colours.used` for it and `colours.current` for the current colour. `colours.used` counts the parts of the whole model as built, through every use with colour 16 taken from the use (`partslist.walk`, as the parts list counts), then adds at a count of 0 any colour a placement carries that the walk did not reach (an unused submodel's parts, a use's own colour); 16 and 24 are never listed (3.2). Each row is the number, the library's name and value in the field names `colours.list` uses, the count, and `known`, false for a number the library does not define, which 3.3 still shows in the row by number. `colours.current` writes the current colour and puts it at the front of the recent colours in one settings update; like the three switches it is of kind `view`, a setting that changes no model and makes no undo step. Colour definitions written inside a model file (3.3) are not read into the document at 0.3.0, so they are not listed. Checked from the command line on the sample car with a red 3001 added: Red 28, Black 15, Light Grey 8, Trans Yellow 6 and three more; colour 16 refused naming the parameter. +`SPEC.md` 3.1 has a row of the colours used in the open model, most used first, and 3.4 names `colours.used` for it and `colours.current` for the current colour. `colours.used` counts the parts of the whole model as built, through every use with colour 16 taken from the use (`partslist.walk`, as the parts list counts), then adds at a count of 0 any colour a placement carries that the walk did not reach (an unused submodel's parts, a use's own colour); 16 and 24 are never listed (3.2). Each row is the number, the library's name and value in the field names `colours.list` uses, the count, and `known`, false for a number the library does not define, which 3.3 still shows in the row by number. +`colours.current` writes the current colour and puts it at the front of the recent colours in one settings update; like the three switches it is of kind `view`, a setting that changes no model and makes no undo step. Colour definitions written inside a model file (3.3) are not read into the document at 0.3.0, so they are not listed. Checked from the command line on the sample car with a red 3001 added: Red 28, Black 15, Light Grey 8, Trans Yellow 6 and three more; colour 16 refused naming the parameter. ## Placing a part puts it at the front of the recent parts · 0.3.0 (app/cmd/commands/part.py) @@ -201,7 +269,8 @@ FormBlocks' rule 5 keeps the one conversion between LDraw's axes and the scene's ## Duplicating under the pointer: copy in the drag and part.duplicate_at_ray · 0.3.0 (app/cmd/placing.py, app/routers/place.py, app/cmd/commands/pointer.py) -Ctrl+D (`SPEC.md` 5.4) holds copies of the selection as a ghost under the pointer, dropped like any ghost. That is the drag with one difference: the originals stay, so they are not left out of the pick, the seat or the overlap test, and a copy may seat on its own original. `POST /api/place/drag` takes `copy: true` for that preview, and `part.duplicate_at_ray` drops the copies at the poses it answers, with the originals' colours, unhidden, in the step shown, as the new selection and as one undo step "Duplicate n parts"; with the overlap check on, a copy that would overlap anything, its original included, refuses the whole drop. `part.duplicate` with an offset is unchanged for exact copies. Checked against an engine on 8344: copies of a two-brick stack dropped beside it at x = 200 with their colours and became the selection; with the check on, copies held by the upper brick over the stack were refused naming p2 and 23 LDU, and copies held by the lower brick stacked on top at y = -72 and -96. +Ctrl+D (`SPEC.md` 5.4) holds copies of the selection as a ghost under the pointer, dropped like any ghost. That is the drag with one difference: the originals stay, so they are not left out of the pick, the seat or the overlap test, and a copy may seat on its own original. `POST /api/place/drag` takes `copy: true` for that preview, and `part.duplicate_at_ray` drops the copies at the poses it answers, with the originals' colours, unhidden, in the step shown, as the new selection and as one undo step "Duplicate n parts"; with the overlap check on, a copy that would overlap anything, its original included, refuses the whole drop. `part.duplicate` with an offset is unchanged for exact copies. +Checked against an engine on 8344: copies of a two-brick stack dropped beside it at x = 200 with their colours and became the selection; with the check on, copies held by the upper brick over the stack were refused naming p2 and 23 LDU, and copies held by the lower brick stacked on top at y = -72 and -96. ## A project file keeps the snap switch and grid step · 0.3.0 (app/cmd/commands/model.py, app/doc/convert.py) @@ -213,7 +282,8 @@ The toolbar's three switches (`SPEC.md` 7.6 and 8.4, keys S, G and O) had only t ## model.set_info · 0.3.0 (app/cmd/commands/info.py, app/services/model_info.py) -The About tab lets the person edit the model's title, author and licence (`SPEC.md` 13.1, `model.set_info` in 13.5), and the window needs a command behind its fields. Each given field changes the main model's header in the model table, so the next save writes it and one undo takes it back: the title is the header's title record, never left empty, its runs of white space made one space; the author is the `0 Author:` line, put after `0 Name:` when the header has none, and an empty author keeps the line empty, as FormBlocks writes on every model; the licence is removed when empty, or written `0 !LICENSE Licensed under ` for one of the seven Creative Commons licences listed (case ignored), which is the "left empty or set to a Creative Commons licence" of 13.1. The library's own licence lines end in ": see CAreadme.txt", which names the library's readme and is wrong for a person's model, so it is left off. The model's name is its main block's name and is changed with `submodel.rename`, which keeps every reference right. `model.info` now shows the licence without the "Licensed under" words. Checked against an engine on 8344: title, author and CC BY-SA 4.0 set in one step and written as the first four lines of an `.ldr` export, GPL refused with the choices, the licence cleared, and one undo brought it back. +The About tab lets the person edit the model's title, author and licence (`SPEC.md` 13.1, `model.set_info` in 13.5), and the window needs a command behind its fields. Each given field changes the main model's header in the model table, so the next save writes it and one undo takes it back: the title is the header's title record, never left empty, its runs of white space made one space; the author is the `0 Author:` line, put after `0 Name:` when the header has none, and an empty author keeps the line empty, as FormBlocks writes on every model; the licence is removed when empty, or written `0 !LICENSE Licensed under ` for one of the seven Creative Commons licences listed (case ignored), which is the "left empty or set to a Creative Commons licence" of 13.1. +The library's own licence lines end in ": see CAreadme.txt", which names the library's readme and is wrong for a person's model, so it is left off. The model's name is its main block's name and is changed with `submodel.rename`, which keeps every reference right. `model.info` now shows the licence without the "Licensed under" words. Checked against an engine on 8344: title, author and CC BY-SA 4.0 set in one step and written as the first four lines of an `.ldr` export, GPL refused with the choices, the licence cleared, and one undo brought it back. ## cli parts list · 0.3.0 (app/automation/cli.py, app/services/model_info.py) @@ -221,7 +291,9 @@ The About tab lets the person edit the model's title, author and licence (`SPEC. ## Dragging a selection: POST /api/place/drag and part.move_at_ray · 0.3.0 (app/cmd/placing.py, app/routers/place.py, app/cmd/commands/pointer.py) -`SPEC.md` 5.1 drags the whole selection by the part pressed on, under the ghost's rules, and the moved parts never seat on each other and keep their places relative to one another. `placing.drag` takes the grabbed placement (`grab`), its part and its own rotation unless the window sends a turned one, and runs the preview's `attempt` with every moving placement left out of the pick, the seat and the overlap test; the rigid move that takes the grabbed part from its old pose to the new one is then applied to every other moving placement, so a turn made during the drag turns the whole selection about the held connector too. The moving set is `ids` when given, else the selection when the grabbed part is in it, else the grabbed part alone, which is what pressing on an unselected part does. The overlap check, when on, tests the grabbed part through the fit and every other moved part against the parts that stay, leaving out pairs joined through mated connectors; any overlap blocks. `POST /api/place/drag` answers the preview's fields for the grabbed part plus `moves`, the new pose of each moving placement in scene and LDraw axes, without changing anything; `part.move_at_ray` commits the same moves as one undo step labelled "Move n parts" and refuses a blocked place or a ray at the sky. A use of a submodel cannot be the grabbed part yet, since it has no connectors to seat by; it moves with `part.move`. Only the grabbed part seats: grabbing the top brick of a stack and pointing at the ground seats that brick on the ground and carries the bricks under it below the ground plane, as a rigid drag must; whether the lowest part of a selection should lead instead is left for the window's design. Checked against an engine on 8344: two stacked bricks dragged by the lower onto a third seated 8 pairs with the upper 24 LDU above; with the overlap check on, dragging the pair by the upper onto a floating brick was refused naming p4 and 23 LDU; a ray at the sky was refused. +`SPEC.md` 5.1 drags the whole selection by the part pressed on, under the ghost's rules, and the moved parts never seat on each other and keep their places relative to one another. `placing.drag` takes the grabbed placement (`grab`), its part and its own rotation unless the window sends a turned one, and runs the preview's `attempt` with every moving placement left out of the pick, the seat and the overlap test; the rigid move that takes the grabbed part from its old pose to the new one is then applied to every other moving placement, so a turn made during the drag turns the whole selection about the held connector too. The moving set is `ids` when given, else the selection when the grabbed part is in it, else the grabbed part alone, which is what pressing on an unselected part does. +The overlap check, when on, tests the grabbed part through the fit and every other moved part against the parts that stay, leaving out pairs joined through mated connectors; any overlap blocks. `POST /api/place/drag` answers the preview's fields for the grabbed part plus `moves`, the new pose of each moving placement in scene and LDraw axes, without changing anything; `part.move_at_ray` commits the same moves as one undo step labelled "Move n parts" and refuses a blocked place or a ray at the sky. A use of a submodel cannot be the grabbed part yet, since it has no connectors to seat by; it moves with `part.move`. +Only the grabbed part seats: grabbing the top brick of a stack and pointing at the ground seats that brick on the ground and carries the bricks under it below the ground plane, as a rigid drag must; whether the lowest part of a selection should lead instead is left for the window's design. Checked against an engine on 8344: two stacked bricks dragged by the lower onto a third seated 8 pairs with the upper 24 LDU above; with the overlap check on, dragging the pair by the upper onto a floating brick was refused naming p4 and 23 LDU; a ray at the sky was refused. ## A use of a submodel is picked on its parts' triangles · 0.3.0 (app/services/picking.py, app/services/warmer.py) @@ -245,7 +317,8 @@ The live channel said `{"type": "settings"}` only when the window's own `PUT /ap ## The document says which placements the step shown draws · 0.3.0 (app/doc/document.py) -Walking the steps (`SPEC.md` 11.2) is a view change the engine already made with `step.goto`, but the window had to work out from every placement's step number what to draw. The state that `GET /api/doc` and every `GET /api/doc/changes` answer carry now holds `shows`: the submodel being edited, the step shown and how many it has, the ids of every placement of steps 1 to it in file order (`placements`, drawn), and the ids added in that step (`added`, drawn at full strength while the earlier ones are faded). It is worked out from the submodel being edited only, since a use draws its submodel whole, and a hidden placement is still listed because hiding is the window's own mark (`SPEC.md` 11.5). Because a step change is a view change it moves the revision without touching the change feed, so the `changes` answer the window reads after the live channel's `doc` event already carries the new list. Checked against an engine on 8344 with the sample car: the opened model shows step 8 of 8 with 61 placements and 10 added; after `step.goto 2` the changes since the previous revision said step 2, 15 placements and p6 to p15 added, without a reset. +Walking the steps (`SPEC.md` 11.2) is a view change the engine already made with `step.goto`, but the window had to work out from every placement's step number what to draw. The state that `GET /api/doc` and every `GET /api/doc/changes` answer carry now holds `shows`: the submodel being edited, the step shown and how many it has, the ids of every placement of steps 1 to it in file order (`placements`, drawn), and the ids added in that step (`added`, drawn at full strength while the earlier ones are faded). It is worked out from the submodel being edited only, since a use draws its submodel whole, and a hidden placement is still listed because hiding is the window's own mark (`SPEC.md` 11.5). +Because a step change is a view change it moves the revision without touching the change feed, so the `changes` answer the window reads after the live channel's `doc` event already carries the new list. Checked against an engine on 8344 with the sample car: the opened model shows step 8 of 8 with 61 placements and 10 added; after `step.goto 2` the changes since the previous revision said step 2, 15 placements and p6 to p15 added, without a reset. ## parts.list_save · 0.3.0 (app/cmd/commands/info.py, app/automation/mcp.py) @@ -261,15 +334,19 @@ Walking the steps (`SPEC.md` 11.2) is a view change the engine already made with ## GET /api/doc/info and the parts list as CSV · 0.3.0 (app/services/model_info.py, app/routers/doc.py) -`GET /api/doc/info` is the About and Parts list tabs of `SPEC.md` 13.1 and 13.2 in one answer: the model's name, title, author and licence from the main model's header, its file, the library update it was last saved with (`builtWith`, from its `LIBRARY` line, null for a plain LDraw file) and the one in use, the counts (parts in all through every use, different parts, part and colour pairs, missing parts, submodels other than the main model, steps of the main model, placements as written), the size across, deep and high in LDU, studs, bricks and plates and millimetres (0.4 mm to the LDU) from the box round every world placement's part bounds, studs included, and the parts list with its CSV text. A row is part, number, description, colour with name and value, count, `missing`, `printed` and `movedTo`. Missing parts come first (13.2), then by part number and colour, or by colour first with `group=colour`. A part the library has moved, such as 3023, keeps the number the file gives it (13.4) and shows the description of the part it moved to, because "~Moved to 3023b" tells a person nothing about the brick in their hand; `movedTo` says where it went. Runs of spaces in a library description become one space for showing; the library writes them to align its own lists. `GET /api/doc/parts.csv?scope=&group=&separator=` gives the file itself, `text/csv` or tab separated (13.3): a header row `Part,Description,Colour,Colour name,Count`, then one row per part and colour, UTF-8, CR LF, fields quoted only when they hold the separator or a quote, which is what a spreadsheet expects. Both read under the document's lock and never wait for an index build. Checked against an engine on 8344 with the sample car: 61 parts, 26 different, 32 pairs, 8 steps, 90 by 216 by 124 LDU, library 2026-10, and 3023 listed as Plate 1 x 2, 2 black and 6 red. +`GET /api/doc/info` is the About and Parts list tabs of `SPEC.md` 13.1 and 13.2 in one answer: the model's name, title, author and licence from the main model's header, its file, the library update it was last saved with (`builtWith`, from its `LIBRARY` line, null for a plain LDraw file) and the one in use, the counts (parts in all through every use, different parts, part and colour pairs, missing parts, submodels other than the main model, steps of the main model, placements as written), the size across, deep and high in LDU, studs, bricks and plates and millimetres (0.4 mm to the LDU) from the box round every world placement's part bounds, studs included, and the parts list with its CSV text. A row is part, number, description, colour with name and value, count, `missing`, `printed` and `movedTo`. +Missing parts come first (13.2), then by part number and colour, or by colour first with `group=colour`. A part the library has moved, such as 3023, keeps the number the file gives it (13.4) and shows the description of the part it moved to, because "~Moved to 3023b" tells a person nothing about the brick in their hand; `movedTo` says where it went. Runs of spaces in a library description become one space for showing; the library writes them to align its own lists. `GET /api/doc/parts.csv?scope=&group=&separator=` gives the file itself, `text/csv` or tab separated (13.3): a header row `Part,Description,Colour,Colour name,Count`, then one row per part and colour, UTF-8, CR LF, fields quoted only when they hold the separator or a quote, which is what a spreadsheet expects. Both read under the document's lock and never wait for an index build. +Checked against an engine on 8344 with the sample car: 61 parts, 26 different, 32 pairs, 8 steps, 90 by 216 by 124 LDU, library 2026-10, and 3023 listed as Plate 1 x 2, 2 black and 6 red. ## GET /api/doc/tree · 0.3.0 (app/services/model_info.py, app/routers/doc.py) -The Model tab (`SPEC.md` 12.1) shows each placement with its description, part number or submodel name, colour swatch and step, and a use opens to show its submodel's own rows. `GET /api/doc/tree` answers every submodel once, by name, with its title, uses, unused mark and its steps, each step's rows in file order: id, part, number, description, colour with its name and value, step, hidden and open marks, `use` (the submodel's name for a use, whose row then shows the submodel's title) and `missing` for a part the library does not have (12.4). A use's row refers to its submodel by name instead of nesting it, so a submodel used ten times is sent once and the window opens a row by looking the name up; `root` is the submodel being edited, which the tree shows at its top (12.3), beside the editing path, the step shown, the selection and the revision. Descriptions come from the parts index only when it is ready, so the tree never waits for an index build: until then `libraryReady` is false, descriptions are empty, `missing` is null and the build is started, and the window reads the tree again on the library's `ready` event. Colour names are the library's own table. Checked against an engine on 8344 with the sample car: 8 steps, 61 rows, the first `4315 Hinge Plate 1 x 4 with Car Roof Holder`, black `#1B2A34`. +The Model tab (`SPEC.md` 12.1) shows each placement with its description, part number or submodel name, colour swatch and step, and a use opens to show its submodel's own rows. `GET /api/doc/tree` answers every submodel once, by name, with its title, uses, unused mark and its steps, each step's rows in file order: id, part, number, description, colour with its name and value, step, hidden and open marks, `use` (the submodel's name for a use, whose row then shows the submodel's title) and `missing` for a part the library does not have (12.4). A use's row refers to its submodel by name instead of nesting it, so a submodel used ten times is sent once and the window opens a row by looking the name up; `root` is the submodel being edited, which the tree shows at its top (12.3), beside the editing path, the step shown, the selection and the revision. +Descriptions come from the parts index only when it is ready, so the tree never waits for an index build: until then `libraryReady` is false, descriptions are empty, `missing` is null and the build is started, and the window reads the tree again on the library's `ready` event. Colour names are the library's own table. Checked against an engine on 8344 with the sample car: 8 steps, 61 rows, the first `4315 Hinge Plate 1 x 4 with Car Roof Holder`, black `#1B2A34`. ## Counting the parts a model needs · 0.3.0 (app/doc/partslist.py) -`SPEC.md` 13.2 counts what would be needed to build the whole model: a submodel used three times counts each of its parts three times. `walk` goes down from a submodel through every use, composing each use's position and turn so the world placement of every library part comes out too (the model information's size needs it), and gives a part in colour 16 the colour of the use it sits in, which is what a person building it would pick up (`SPEC.md` 10.5); colour 16 at the top stays 16. A cycle of uses, which the commands never make but a file could hold, is cut at the repeat. `through` limits the top submodel to its first steps, for "up to the step shown" (13.2), while every use inside counts whole, since a use placed in step 3 brings all its parts in step 3. Part names are compared without case because LDraw names are, and kept as the model spells them otherwise, so an alias part counts under its own number (13.4). The scopes are the main model, the submodel being edited, and the submodel being edited up to its step shown. Checked on the sample car: 61 parts, 32 part and colour pairs, 26 different parts; 3024 gives 2 black, 2 red, 2 trans yellow and 4 trans clear, 3023 gives 2 black and 6 red, 3641 gives 4 black, each the count of its lines in the file by colour. +`SPEC.md` 13.2 counts what would be needed to build the whole model: a submodel used three times counts each of its parts three times. `walk` goes down from a submodel through every use, composing each use's position and turn so the world placement of every library part comes out too (the model information's size needs it), and gives a part in colour 16 the colour of the use it sits in, which is what a person building it would pick up (`SPEC.md` 10.5); colour 16 at the top stays 16. A cycle of uses, which the commands never make but a file could hold, is cut at the repeat. `through` limits the top submodel to its first steps, for "up to the step shown" (13.2), while every use inside counts whole, since a use placed in step 3 brings all its parts in step 3. +Part names are compared without case because LDraw names are, and kept as the model spells them otherwise, so an alias part counts under its own number (13.4). The scopes are the main model, the submodel being edited, and the submodel being edited up to its step shown. Checked on the sample car: 61 parts, 32 part and colour pairs, 26 different parts; 3024 gives 2 black, 2 red, 2 trans yellow and 4 trans clear, 3023 gives 2 black and 6 red, 3641 gives 4 black, each the count of its lines in the file by colour. ## The pointer's index is warmed after every change · 0.3.0 (app/services/warmer.py, app/routers/place.py) @@ -281,15 +358,19 @@ A profile of 300 previews on a 2,000-placement model put the two lists of hidden ## part.place_at_ray and part.pick · 0.3.0 (app/cmd/commands/pointer.py, app/cmd/commands/part.py) -The drop of `SPEC.md` 4.3 must put the part exactly where the ghost was, so `part.place_at_ray {part, colour, origin, direction, rotation?, held?, step?, snap?}` runs the same `placing.attempt` as the preview, with the same scene axes, and commits its pose as one undo step labelled like `part.place`; a place the overlap check refuses, or a ray at the sky, is refused and changes nothing. Its answer is the new placement in LDraw axes, as every other part command answers, and under `preview` the preview's own answer in scene axes, so the window can check the two agree. It takes the editing submodel, since the pointer is always in it. `part.pick {origin, direction, ground?}` is the read form of `/api/place/pick` for agents and the command line. The record-making tail of `part.place` became `put` so both commands place the same way. Checked against an engine on 8344: a ray straight down placed a 3001 at LDraw (0, -24, 0) as one undo step "Place 3001.dat", and a pick down the same ray met it at scene y = 24. +The drop of `SPEC.md` 4.3 must put the part exactly where the ghost was, so `part.place_at_ray {part, colour, origin, direction, rotation?, held?, step?, snap?}` runs the same `placing.attempt` as the preview, with the same scene axes, and commits its pose as one undo step labelled like `part.place`; a place the overlap check refuses, or a ray at the sky, is refused and changes nothing. Its answer is the new placement in LDraw axes, as every other part command answers, and under `preview` the preview's own answer in scene axes, so the window can check the two agree. It takes the editing submodel, since the pointer is always in it. `part.pick {origin, direction, ground?}` is the read form of `/api/place/pick` for agents and the command line. The record-making tail of `part.place` became `put` so both commands place the same way. +Checked against an engine on 8344: a ray straight down placed a 3001 at LDraw (0, -24, 0) as one undo step "Place 3001.dat", and a pick down the same ray met it at scene y = 24. ## POST /api/place/preview and /api/place/pick · 0.3.0 (app/routers/place.py, app/cmd/placing.py, app/cmd/fitting.py, app/main.py) -The ghost under the pointer (`SPEC.md` 4.2) asks the engine on every pointer move: `POST /api/place/preview {part, colour, ray: {origin, dir}, rotation?, held?, ids?, snap?}` in the window's scene axes answers `{position, rotation, snapped, blocked, on}` in the same axes, with the LDraw pose, the marks of the connectors it would join (scene axes), how many it joins, the overlapping pairs and the revision it was worked out on. It is a read: it takes the document's lock, never changes the model and makes no undo step; it is a POST only because a ray and a rotation do not fit a query string, and like every route it needs the window key. The ray is met on real triangles (`picking.pick`), then the connection lane's `fit` runs from that hit with the snap and overlap switches and grid step of the settings, `held` naming the connector the part is gripped by (the raw pose's anchor), and `ids` the placements being dragged, which neither take part in the pick nor seat or block (`SPEC.md` 5.1). `on` is the placement the seat joins most, `ground` for a seat on the lattice or a rest on the ground, the placement under the pointer for a grid rest on it, and null when the ray points at the sky, where position is null too and the window keeps the ghost where it was (4.4). `blocked` is true when the overlap check refuses the place; the answer then still carries the place that was refused, so the window can draw the warning there while it keeps the ghost at its own last free place (4.2), which only the window knows. `fitting.attempt` now returns that pose beside the final answer, and takes a ready hit and a stamp; `fitting.where` answers as before. `POST /api/place/pick {ray, ground?}` answers the placement and point under a scene ray on real triangles, for the window to pick through the engine when its own scene is not enough. Checked against an engine on 8344: a 3001 previewed over empty ground seated on the lattice at scene (0, 24, 0) with 8 marks. +The ghost under the pointer (`SPEC.md` 4.2) asks the engine on every pointer move: `POST /api/place/preview {part, colour, ray: {origin, dir}, rotation?, held?, ids?, snap?}` in the window's scene axes answers `{position, rotation, snapped, blocked, on}` in the same axes, with the LDraw pose, the marks of the connectors it would join (scene axes), how many it joins, the overlapping pairs and the revision it was worked out on. It is a read: it takes the document's lock, never changes the model and makes no undo step; it is a POST only because a ray and a rotation do not fit a query string, and like every route it needs the window key. +The ray is met on real triangles (`picking.pick`), then the connection lane's `fit` runs from that hit with the snap and overlap switches and grid step of the settings, `held` naming the connector the part is gripped by (the raw pose's anchor), and `ids` the placements being dragged, which neither take part in the pick nor seat or block (`SPEC.md` 5.1). `on` is the placement the seat joins most, `ground` for a seat on the lattice or a rest on the ground, the placement under the pointer for a grid rest on it, and null when the ray points at the sky, where position is null too and the window keeps the ghost where it was (4.4). `blocked` is true when the overlap check refuses the place; the answer then still carries the place that was refused, so the window can draw the warning there while it keeps the ghost at its own last free place (4.2), which only the window knows. +`fitting.attempt` now returns that pose beside the final answer, and takes a ready hit and a stamp; `fitting.where` answers as before. `POST /api/place/pick {ray, ground?}` answers the placement and point under a scene ray on real triangles, for the window to pick through the engine when its own scene is not enough. Checked against an engine on 8344: a 3001 previewed over empty ground seated on the lattice at scene (0, 24, 0) with 8 marks. ## Picking through the engine against real triangles · 0.3.0 (app/services/picking.py, app/connect/__init__.py) -`pick(model, key, origin, direction)` answers the first placement of a submodel a scene ray meets on its real triangles, with the point, the normal turned to face the ray and the distance, in scene axes; or the ground plane (`on` is then `ground`); or nothing for a ray at the sky. The broad phase is one numpy pass over every placement's box in scene axes (`box_entries`), kept per submodel and stamp beside the spatial hash it is made from; placements are then tested in the order the ray enters their boxes and the search stops once the next box starts beyond the nearest hit, so a ray over a large model tests the triangles of a handful of parts. Each part's triangles are kept once per library and quality, the 512 most recently used, because the mesh cache on disk is fast but reshaping its arrays is not free. `Picked.ldraw()` gives the same hit as the connection lane's `Hit` in LDraw axes through the mesh package's conversion, so the snap's raw pose starts from the face the person sees rather than a box face 4 LDU above the studs. A use of a submodel has no part triangles in 0.3.0 and is not picked; the window's own pick covers it. `placed_box` joins the connection package's surface, since picking needs a placement's box in model axes. Checked in process on a 2,000-placement model: the first pick, which reads the meshes, 348 ms; then 1,000 random rays from above, median 0.42 ms, 95th percentile 0.76 ms, worst 2.3 ms. +`pick(model, key, origin, direction)` answers the first placement of a submodel a scene ray meets on its real triangles, with the point, the normal turned to face the ray and the distance, in scene axes; or the ground plane (`on` is then `ground`); or nothing for a ray at the sky. The broad phase is one numpy pass over every placement's box in scene axes (`box_entries`), kept per submodel and stamp beside the spatial hash it is made from; placements are then tested in the order the ray enters their boxes and the search stops once the next box starts beyond the nearest hit, so a ray over a large model tests the triangles of a handful of parts. Each part's triangles are kept once per library and quality, the 512 most recently used, because the mesh cache on disk is fast but reshaping its arrays is not free. +`Picked.ldraw()` gives the same hit as the connection lane's `Hit` in LDraw axes through the mesh package's conversion, so the snap's raw pose starts from the face the person sees rather than a box face 4 LDU above the studs. A use of a submodel has no part triangles in 0.3.0 and is not picked; the window's own pick covers it. `placed_box` joins the connection package's surface, since picking needs a placement's box in model axes. Checked in process on a 2,000-placement model: the first pick, which reads the meshes, 348 ms; then 1,000 random rays from above, median 0.42 ms, 95th percentile 0.76 ms, worst 2.3 ms. ## A read with a stamp skips the walk over the placements · 0.3.0 (app/services/connect_host.py) @@ -297,11 +378,13 @@ The ghost under the pointer (`SPEC.md` 4.2) asks the engine on every pointer mov ## A saved project names the library it was saved with · 0.3.0 (app/services/library_host.py, app/doc/convert.py, app/cmd/commands/model.py) -`spec/LDRAW.md` has `0 !FORMBLOCKS LIBRARY ` hold the release the model was last saved with, but the writer only carried back whatever line the file had been read with, so every new model said `unknown`. `library_host.update_name()` answers the release of the library in use: the fetched archive's release when the manifest belongs to the folder in use, else the parts index's newest `UPDATE`, loading the saved index or building it once when it is not ready yet (a save may then wait for the index, which the parts palette needs anyway). With no library at all it answers none and the line read from the file stays, so opening and saving an old project on a machine with no library does not erase what it was built with; only then is `unknown` written. An LDraw export carries no project lines and does not ask. Checked against an engine on the 2026-10 library: a new model saved as `.fblk` wrote `0 !FORMBLOCKS LIBRARY 2026-10`, reopened without a complaint, and an `.ldr` export wrote no `!FORMBLOCKS` line. +`spec/LDRAW.md` has `0 !FORMBLOCKS LIBRARY ` hold the release the model was last saved with, but the writer only carried back whatever line the file had been read with, so every new model said `unknown`. `library_host.update_name()` answers the release of the library in use: the fetched archive's release when the manifest belongs to the folder in use, else the parts index's newest `UPDATE`, loading the saved index or building it once when it is not ready yet (a save may then wait for the index, which the parts palette needs anyway). With no library at all it answers none and the line read from the file stays, so opening and saving an old project on a machine with no library does not erase what it was built with; only then is `unknown` written. An LDraw export carries no project lines and does not ask. +Checked against an engine on the 2026-10 library: a new model saved as `.fblk` wrote `0 !FORMBLOCKS LIBRARY 2026-10`, reopened without a complaint, and an `.ldr` export wrote no `!FORMBLOCKS` line. ## Writing a file outside the open model's folder asks every time · 0.2.0 (app/automation/mcp.py, app/services/consent.py) -Reviewed what an outside agent can reach through the file commands. `model.open`, `model.save`, `model.save_as` and `model.insert` are of kind `file` or `change`, so each call from an outside agent waits for the person in the window, and the paths are limited to full paths ending in `.fblk`, `.ldr`, `.mpd` (and `.dat` to open), at most 64 MB to read, written through a part file moved into place. But once the person answered "always" for an agent, or set outside agents to allowed, `model.save_as` could write such a file anywhere without a question, against `SPEC.md` 14.7: "MCP tools that write a file outside the folder of the open model ask the person first, every time". `consent.ask` now takes `every_time`, which skips the standing allowance (a block still refuses at once), and the server passes it for a `model.save_as` whose path is not in the open model's folder or below it, or when the model has no file yet. A headless server, with no window to ask, refuses such a write even for an allowed agent. Agent tabs of the dock are still trusted as the person's own and are not asked, as the template has it. Checked in process with outside agents set to allowed: headless `save_as` with no model file and into another folder were refused, into the model's own folder ran, and an ordinary change ran without a question. +Reviewed what an outside agent can reach through the file commands. `model.open`, `model.save`, `model.save_as` and `model.insert` are of kind `file` or `change`, so each call from an outside agent waits for the person in the window, and the paths are limited to full paths ending in `.fblk`, `.ldr`, `.mpd` (and `.dat` to open), at most 64 MB to read, written through a part file moved into place. But once the person answered "always" for an agent, or set outside agents to allowed, `model.save_as` could write such a file anywhere without a question, against `SPEC.md` 14.7: "MCP tools that write a file outside the folder of the open model ask the person first, every time". +`consent.ask` now takes `every_time`, which skips the standing allowance (a block still refuses at once), and the server passes it for a `model.save_as` whose path is not in the open model's folder or below it, or when the model has no file yet. A headless server, with no window to ask, refuses such a write even for an allowed agent. Agent tabs of the dock are still trusted as the person's own and are not asked, as the template has it. Checked in process with outside agents set to allowed: headless `save_as` with no model file and into another folder were refused, into the model's own folder ran, and an ordinary change ran without a question. ## The dock's agents are told they work on a model · 0.2.0 (app/services/agent_programs.py, app/services/chat.py) @@ -309,19 +392,23 @@ The system prompts given to an agent program started in a dock tab and to the Ch ## The library as read commands · 0.2.0 (app/cmd/commands/library.py) -`parts.search`, `parts.show`, `library.status` and `colours.list` were reachable only through the routes and the command line's own subcommands, so an agent on MCP could not find a part number before placing it. They are now read commands answering exactly what `GET /api/parts/search`, `GET /api/parts/{name}`, `GET /api/library/status` and `GET /api/colours` answer, by calling the same functions, so each gets its `cmd_*` tool. Reads are never gated. There is no fetch command: `SPEC.md` 17.5 lets only the person consent, so the fetch stays a route that refuses agents and a command line flag. `parts.search` returns 20 hits unless asked, as the command line does. The functions live in the routers, which import the web framework; the command line already imports them the same way, so the MCP server and the command line pay nothing new. Checked in process on the scratch library: `brick 2 x 4` gave 3001 first of 157, `3023` followed to `3023b`, the status found the environment's 2026-10 library, `dark blue` gave six colours, an unknown part was refused. +`parts.search`, `parts.show`, `library.status` and `colours.list` were reachable only through the routes and the command line's own subcommands, so an agent on MCP could not find a part number before placing it. They are now read commands answering exactly what `GET /api/parts/search`, `GET /api/parts/{name}`, `GET /api/library/status` and `GET /api/colours` answer, by calling the same functions, so each gets its `cmd_*` tool. Reads are never gated. There is no fetch command: `SPEC.md` 17.5 lets only the person consent, so the fetch stays a route that refuses agents and a command line flag. `parts.search` returns 20 hits unless asked, as the command line does. The functions live in the routers, which import the web framework; the command line already imports them the same way, so the MCP server and the command line pay nothing new. +Checked in process on the scratch library: `brick 2 x 4` gave 3001 first of 157, `3023` followed to `3023b`, the status found the environment's 2026-10 library, `dark blue` gave six colours, an unknown part was refused. ## part.place seats, refuses what is not in the library, and honours the overlap switch · 0.2.0 (app/cmd/commands/part.py) -The part commands were written to take final transforms until the connection lane and the library's "is this part there" test could stand in front of them; they now do, for `part.place`. A library part must resolve in the library in use, else the command is refused with the part named (`SPEC.md` 4.4), and with no library at all it says how to get one. `position` is the raw pose: with snapping on (the setting, or `snap` for this call, 7.6) the part seats on free compatible connectors within reach, the ground's lattice included, or moves to the grid step; with snapping off it goes exactly where it was told. `on` with no position seats the part on that placement's first free compatible connectors (4.5), and a target with none is refused. With the overlap check on, a place that would overlap is refused with the placements and depths named and nothing changes, the command's form of "the part stays at the last free place" (8.2). The answer adds `seated`, the `joined` pairs and the `marks` (4.5). A use of a submodel is placed exactly as before: submodels have no connectors in 0.x. `part.move`, `part.set_transform` and `part.duplicate` still put placements exactly where they are told, which is what nudges and the details panel ask for (7.4, 7.5). Checked in process: 3001 at (3, -26, 4) seats on the ground at (0, -24, 0) with 8 pairs; a second with `on: p1` at (0, -48, 0) with 8 pairs; one given half over `p1` at (50, -30, 1), where `p1`'s studs would stand under its walls, was not seated and went to the grid at (40, -32, 0); `nope999` refused; with the overlap switch on a brick into another was refused naming `p1` and 23 LDU. +The part commands were written to take final transforms until the connection lane and the library's "is this part there" test could stand in front of them; they now do, for `part.place`. A library part must resolve in the library in use, else the command is refused with the part named (`SPEC.md` 4.4), and with no library at all it says how to get one. `position` is the raw pose: with snapping on (the setting, or `snap` for this call, 7.6) the part seats on free compatible connectors within reach, the ground's lattice included, or moves to the grid step; with snapping off it goes exactly where it was told. `on` with no position seats the part on that placement's first free compatible connectors (4.5), and a target with none is refused. +With the overlap check on, a place that would overlap is refused with the placements and depths named and nothing changes, the command's form of "the part stays at the last free place" (8.2). The answer adds `seated`, the `joined` pairs and the `marks` (4.5). A use of a submodel is placed exactly as before: submodels have no connectors in 0.x. `part.move`, `part.set_transform` and `part.duplicate` still put placements exactly where they are told, which is what nudges and the details panel ask for (7.4, 7.5). Checked in process: 3001 at (3, -26, 4) seats on the ground at (0, -24, 0) with 8 pairs; a second with `on: p1` at (0, -48, 0) with 8 pairs; one given half over `p1` at (50, -30, 1), where `p1`'s studs would stand under its walls, was not seated and went to the grid at (40, -32, 0); `nope999` refused; with the overlap switch on a brick into another was refused naming `p1` and 23 LDU. ## part.connectors, part.fit and overlap.check · 0.2.0 (app/cmd/commands/connect.py, app/cmd/fitting.py) -The connection lane's log names the read-only tool that prints a part's connectors; `part.connectors {part}` answers the connectors as records, their counts, the part's measures and the lane's own `table` text, so an override's author and an agent read the same thing. `part.fit` is `SPEC.md` 4.5's read: from a raw position, from `on` (a placement to seat on, the lane's `seat_on`) or from a pointer ray (`origin` and `direction`, the lane's `first_hit` and `fit`), it answers the position, rotation, whether the part is seated, the pairs and marks it would join, and whether the overlap check blocks it. `ids` are the placements being moved, which the part neither seats on nor is blocked by (`SPEC.md` 5.1). Hidden placements are left out of the seat and of the ray (`SPEC.md` 4.4, 7.5) but stay in the overlap check (8.3), so `fitting.where` runs the lane's `settle` with the check off and then the check itself against every neighbour. With snapping off a raw position is kept exactly: a command's coordinates are the agent's final ones, and the grid step is for the pointer and for nudges (7.4). `overlap.check {ids?}` runs the lane's `check_model` over each submodel's hash, or only the named placements against their neighbours, and answers each pair with its submodel and depth; it checks whatever the switch says, because a caller that asks wants the answer (8.4). Every one of them is a read: none moves the revision. Checked in process on the scratch library: 3001 has 8 studs and 11 anti-studs; a ray straight down onto a brick at y 0 seats a 3001 at y -24 joining 8 pairs; a brick sunk into another is reported 15 LDU deep. +The connection lane's log names the read-only tool that prints a part's connectors; `part.connectors {part}` answers the connectors as records, their counts, the part's measures and the lane's own `table` text, so an override's author and an agent read the same thing. `part.fit` is `SPEC.md` 4.5's read: from a raw position, from `on` (a placement to seat on, the lane's `seat_on`) or from a pointer ray (`origin` and `direction`, the lane's `first_hit` and `fit`), it answers the position, rotation, whether the part is seated, the pairs and marks it would join, and whether the overlap check blocks it. `ids` are the placements being moved, which the part neither seats on nor is blocked by (`SPEC.md` 5.1). +Hidden placements are left out of the seat and of the ray (`SPEC.md` 4.4, 7.5) but stay in the overlap check (8.3), so `fitting.where` runs the lane's `settle` with the check off and then the check itself against every neighbour. With snapping off a raw position is kept exactly: a command's coordinates are the agent's final ones, and the grid step is for the pointer and for nudges (7.4). `overlap.check {ids?}` runs the lane's `check_model` over each submodel's hash, or only the named placements against their neighbours, and answers each pair with its submodel and depth; it checks whatever the switch says, because a caller that asks wants the answer (8.4). Every one of them is a read: none moves the revision. Checked in process on the scratch library: 3001 has 8 studs and 11 anti-studs; a ray straight down onto a brick at y 0 seats a 3001 at y -24 joining 8 pairs; a brick sunk into another is reported 15 LDU deep. ## One connection service beside the library host, and a spatial hash per submodel · 0.2.0 (app/services/connect_host.py) -The connection lane built `ConnectService(library, data_dir)` and left holding it to the engine. `connect_host.service()` makes one for the `LibraryService` that `library_host` holds and makes a new one when that object changes (another data folder), so the window's routes, the command line and the MCP server share one connector cache. `options(snap)` reads the snap and overlap switches and the grid step from the person's settings, with a per-call snap override (`SPEC.md` 7.6). `hash_of(model, key)` keeps one `SpatialHash` per submodel and brings it up to date before every use by comparing each placement's order, part, position and rotation with what it last put, putting only the placements that changed and removing the ones that are gone, so a drag over a large model touches only the moved parts; it starts again when the library or its key changes, and drops the hash of a submodel that no longer exists. The hash follows the model rather than being told of each change, because the document has several ways in (commands, undo, redo, open) and a missed notice would leave a stale neighbour. Hidden placements stay in the hash, since they take part in the overlap check (`SPEC.md` 8.3); the fit leaves them out of the snap (`hidden`). +The connection lane built `ConnectService(library, data_dir)` and left holding it to the engine. `connect_host.service()` makes one for the `LibraryService` that `library_host` holds and makes a new one when that object changes (another data folder), so the window's routes, the command line and the MCP server share one connector cache. `options(snap)` reads the snap and overlap switches and the grid step from the person's settings, with a per-call snap override (`SPEC.md` 7.6). +`hash_of(model, key)` keeps one `SpatialHash` per submodel and brings it up to date before every use by comparing each placement's order, part, position and rotation with what it last put, putting only the placements that changed and removing the ones that are gone, so a drag over a large model touches only the moved parts; it starts again when the library or its key changes, and drops the hash of a submodel that no longer exists. The hash follows the model rather than being told of each change, because the document has several ways in (commands, undo, redo, open) and a missed notice would leave a stale neighbour. Hidden placements stay in the hash, since they take part in the overlap check (`SPEC.md` 8.3); the fit leaves them out of the snap (`hidden`). ## A relative path at the command line is the person's · 0.2.0 (app/automation/cli.py) @@ -353,7 +440,8 @@ Every `cmd_*` tool that was not read-only ended "Changes the notes; one undo ste ## Insert LDraw model · 0.2.0 (app/cmd/commands/model.py, app/cmd/args.py, app/cmd/commands/submodel.py) -`model.insert {path, position?, submodel?}` is `SPEC.md` 14.3's "Insert LDraw model" (`file.insert_ldraw` in 14.7): every model block of another `.ldr`, `.mpd` or `.fblk` comes in as a submodel, and one use of its main model is placed at `position` in the step shown, as one undo step; the window then picks the use up as a ghost. A block whose name the open model already uses is given the next free numbered name and every reference to it inside the inserted blocks follows, so inserting the same file twice gives `car.ldr` and `car 2.ldr`, each complete. Placements get new ids from the open model's counter. `!DATA` blocks come along unless their name is taken, in which case they are listed as skipped rather than renamed, since a texture is found by its name and renaming it would break the line that uses it. A `.dat` is refused: a part is placed with `part.place`. `free_name` and `taken` moved from the submodel commands to `args.py` so make independent and insert number names the same way, data blocks included. +`model.insert {path, position?, submodel?}` is `SPEC.md` 14.3's "Insert LDraw model" (`file.insert_ldraw` in 14.7): every model block of another `.ldr`, `.mpd` or `.fblk` comes in as a submodel, and one use of its main model is placed at `position` in the step shown, as one undo step; the window then picks the use up as a ghost. A block whose name the open model already uses is given the next free numbered name and every reference to it inside the inserted blocks follows, so inserting the same file twice gives `car.ldr` and `car 2.ldr`, each complete. Placements get new ids from the open model's counter. `!DATA` blocks come along unless their name is taken, in which case they are listed as skipped rather than renamed, since a texture is found by its name and renaming it would break the line that uses it. A `.dat` is refused: a part is placed with `part.place`. +`free_name` and `taken` moved from the submodel commands to `args.py` so make independent and insert number names the same way, data blocks included. ## Make independent · 0.2.0 (app/cmd/commands/submodel.py) @@ -413,11 +501,13 @@ The command line reads each `key=value` as JSON when it is JSON, so `part=3001`, ## cli library fetch and --i-consent · 0.2.0 (app/automation/cli.py) -`spec/SPEC.md` 17.5 lets the person give the fetch consent at the command line with an explicit argument naming the address and the licence. Here that is one flag, `--i-consent "

"`: the address has no spaces, so the first space divides the two, and the person types (or pastes) exactly what the card shows, `--i-consent "https://library.ldraw.org/library/updates/complete.zip CC BY 2.0 and CC BY 4.0"`. Without the flag nothing is sent: the command prints the consent sentence with the size the server reports and the exact line to run, and exits 1. With the flag the consent goes to the engine's fetch route, which checks it word for word, or to the library host when no engine runs; progress is printed on standard error at most twice a second, Ctrl+C cancels and waits for the fetch to stop, and the answer is the finished job, or exit 1 with the reason. A command line started inside an agent tab (it has `FORMBLOCKS_TAB_TOKEN` in its environment) is refused before anything else, since that is an agent typing, not the person; a determined agent with a shell could still forge the flag, which is why the window remains the place the specification puts the question, and why this is recorded as a limit rather than a guarantee. Checked: no flag (here and with the engine on 8330) printed the sentence with "about 147 MB" and the line to run; a wrong licence, an address alone and a wrong address were refused; the agent-tab variable refused; the follow loop, run in process against a stand-in download, printed four progress lines and the finished job. No real download was run. +`spec/SPEC.md` 17.5 lets the person give the fetch consent at the command line with an explicit argument naming the address and the licence. Here that is one flag, `--i-consent "
"`: the address has no spaces, so the first space divides the two, and the person types (or pastes) exactly what the card shows, `--i-consent "https://library.ldraw.org/library/updates/complete.zip CC BY 2.0 and CC BY 4.0"`. Without the flag nothing is sent: the command prints the consent sentence with the size the server reports and the exact line to run, and exits 1. With the flag the consent goes to the engine's fetch route, which checks it word for word, or to the library host when no engine runs; progress is printed on standard error at most twice a second, Ctrl+C cancels and waits for the fetch to stop, and the answer is the finished job, or exit 1 with the reason. +A command line started inside an agent tab (it has `FORMBLOCKS_TAB_TOKEN` in its environment) is refused before anything else, since that is an agent typing, not the person; a determined agent with a shell could still forge the flag, which is why the window remains the place the specification puts the question, and why this is recorded as a limit rather than a guarantee. Checked: no flag (here and with the engine on 8330) printed the sentence with "about 147 MB" and the line to run; a wrong licence, an address alone and a wrong address were refused; the agent-tab variable refused; the follow loop, run in process against a stand-in download, printed four progress lines and the finished job. No real download was run. ## The model routes: the whole document and what changed · 0.2.0 (app/routers/doc.py) -`GET /api/doc` now answers the model instead of the notes: `{"model": {"main", "submodels", "data"}, "selection", "step", "steps", "submodel", "editing", "path", "kind", "dirty", "revision"}`, where `main` and each of `submodels` is a submodel with its steps and its placements (id, part, colour, position, rotation, hidden, open, whether it is a use, its submodel and step), `step` is the step shown in the submodel being edited and `editing` the path of submodels from the main model. `GET /api/doc/changes?since=n` answers the same view state with `added` and `changed` placements in full, `removed` placement ids, the `submodels` whose steps changed (without their placements) and `removedSubmodels`, or `reset: true` with the whole document under `doc` when the feed cannot answer from `n`; so a window that hears a new revision on the live channel patches the placements it shows by id instead of reading every placement again. `GET /api/history` answers the labels from the document's own history, which is no longer a method called `history`. Undo and redo keep their routes and now also answer `dirty`. +`GET /api/doc` now answers the model instead of the notes: `{"model": {"main", "submodels", "data"}, "selection", "step", "steps", "submodel", "editing", "path", "kind", "dirty", "revision"}`, where `main` and each of `submodels` is a submodel with its steps and its placements (id, part, colour, position, rotation, hidden, open, whether it is a use, its submodel and step), `step` is the step shown in the submodel being edited and `editing` the path of submodels from the main model. +`GET /api/doc/changes?since=n` answers the same view state with `added` and `changed` placements in full, `removed` placement ids, the `submodels` whose steps changed (without their placements) and `removedSubmodels`, or `reset: true` with the whole document under `doc` when the feed cannot answer from `n`; so a window that hears a new revision on the live channel patches the placements it shows by id instead of reading every placement again. `GET /api/history` answers the labels from the document's own history, which is no longer a method called `history`. Undo and redo keep their routes and now also answer `dirty`. ## Entering and leaving a submodel · 0.2.0 (app/cmd/commands/submodel.py) @@ -433,7 +523,8 @@ Packing adds `.ldr` to a name given without one, so the person who typed "Front" ## Packing and unpacking keep every part where it was · 0.2.0 (app/cmd/commands/submodel.py) -`submodel.create {ids, name}` (the task's name for `SPEC.md` 10.1's pack, `submodel.pack` in 21.2) moves placements of one submodel into a new submodel and puts one use of it, colour 16 and unturned, where the first of them stood in the earliest of their steps. The parts keep their ids, so an agent's references survive a pack, and their steps' order, one step for each step they came from. The origin is the centre of the box around their origins, moved to the 20 LDU stud grid across and at the lowest origin (the largest Y) upright: the rule of `SPEC.md` 10.1 measured on origins, because part shapes are not in this lane; for ordinary bricks, whose origin is the top centre, the difference is the height of the lowest part. `submodel.dissolve {id}` is unpack: each part of the submodel goes back into the use's step at the use's place, turned and moved by the use, and a part in colour 16 takes the use's colour (`SPEC.md` 10.5). When that was the last use, the submodel is removed and its parts keep their ids; otherwise they are copies with new ids and the submodel stays for its other uses. Checked by flattening the model to world placements before and after a pack: the same parts, colours, positions and rotations. +`submodel.create {ids, name}` (the task's name for `SPEC.md` 10.1's pack, `submodel.pack` in 21.2) moves placements of one submodel into a new submodel and puts one use of it, colour 16 and unturned, where the first of them stood in the earliest of their steps. The parts keep their ids, so an agent's references survive a pack, and their steps' order, one step for each step they came from. The origin is the centre of the box around their origins, moved to the 20 LDU stud grid across and at the lowest origin (the largest Y) upright: the rule of `SPEC.md` 10.1 measured on origins, because part shapes are not in this lane; for ordinary bricks, whose origin is the top centre, the difference is the height of the lowest part. +`submodel.dissolve {id}` is unpack: each part of the submodel goes back into the use's step at the use's place, turned and moved by the use, and a part in colour 16 takes the use's colour (`SPEC.md` 10.5). When that was the last use, the submodel is removed and its parts keep their ids; otherwise they are copies with new ids and the submodel stays for its other uses. Checked by flattening the model to world placements before and after a pack: the same parts, colours, positions and rotations. ## A new submodel gets the header FormBlocks writes on every model · 0.2.0 (app/doc/model.py) @@ -445,7 +536,8 @@ Packing adds `.ldr` to a name given without one, so the person who typed "Front" ## cli library use · 0.2.0 (app/automation/cli.py) -`./formblocks cli library use FOLDER` points FormBlocks at a library the person already has and `library use --clear` forgets that choice, through the engine's `POST /api/library/use` when it runs or the same `library_host.use` here; a folder that is not a library exits 1 with what it lacks. A relative folder is a problem: `setup/cli` changes into `backend/` before starting Python, so the person's own working folder is gone by the time this runs. The folder is therefore joined to `FORMBLOCKS_CALLER_DIR` when the launcher sets it, and to the current folder otherwise; until `setup/cli` exports that variable before its `cd`, a relative folder given through `./formblocks cli` is read from `backend/`, and the answer names the full path it tried, so the mistake is visible. Absolute paths and `~` work either way. Checked without an engine on a fresh data folder and through the engine on 8330: the full library's parent accepted as its `ldraw` folder with the source `setting`, `/tmp` refused, `use` with neither or both a folder and `--clear` exit 2, `--clear` back to the environment's folder; with `FORMBLOCKS_CALLER_DIR=/tmp` the relative `fb-lib` was found. +`./formblocks cli library use FOLDER` points FormBlocks at a library the person already has and `library use --clear` forgets that choice, through the engine's `POST /api/library/use` when it runs or the same `library_host.use` here; a folder that is not a library exits 1 with what it lacks. A relative folder is a problem: `setup/cli` changes into `backend/` before starting Python, so the person's own working folder is gone by the time this runs. The folder is therefore joined to `FORMBLOCKS_CALLER_DIR` when the launcher sets it, and to the current folder otherwise; until `setup/cli` exports that variable before its `cd`, a relative folder given through `./formblocks cli` is read from `backend/`, and the answer names the full path it tried, so the mistake is visible. Absolute paths and `~` work either way. +Checked without an engine on a fresh data folder and through the engine on 8330: the full library's parent accepted as its `ldraw` folder with the source `setting`, `/tmp` refused, `use` with neither or both a folder and `--clear` exit 2, `--clear` back to the environment's folder; with `FORMBLOCKS_CALLER_DIR=/tmp` the relative `fb-lib` was found. ## Breaking a step and showing one · 0.2.0 (app/cmd/commands/step.py) @@ -457,23 +549,28 @@ Packing adds `.ldr` to a name given without one, so the person who typed "Front" ## Selection commands change the view, not the model · 0.2.0 (app/cmd/commands/select.py) -`select.set`, `select.add`, `select.clear`, `select.all`, `select.invert`, `select.by_colour` and `select.by_part` (the task's `select` area; `SPEC.md` 6.5 calls it `selection`) are view commands: they move the revision so the window redraws the outline, make no undo step and ask no approval of an outside agent, as `SPEC.md` 6.4 and 6.5 say, while undoing a model change brings its selection back. Only visible placements of the submodel being edited can be selected (`SPEC.md` 6.4); naming a hidden one or one in another submodel is refused with the id named rather than dropped quietly, so a script learns why. The kinds work on visible placements of the submodel being edited and, given nothing, copy the colours or parts of the selection, the "same colour as selected" of the Select menu. `select.all` is added beside the task's list because `select.invert` and Ctrl+A are a pair in `SPEC.md` 6.1. Part names compare as the resolver compares them, so `3024` and `3024.DAT` select the same placements. +`select.set`, `select.add`, `select.clear`, `select.all`, `select.invert`, `select.by_colour` and `select.by_part` (the task's `select` area; `SPEC.md` 6.5 calls it `selection`) are view commands: they move the revision so the window redraws the outline, make no undo step and ask no approval of an outside agent, as `SPEC.md` 6.4 and 6.5 say, while undoing a model change brings its selection back. Only visible placements of the submodel being edited can be selected (`SPEC.md` 6.4); naming a hidden one or one in another submodel is refused with the id named rather than dropped quietly, so a script learns why. The kinds work on visible placements of the submodel being edited and, given nothing, copy the colours or parts of the selection, the "same colour as selected" of the Select menu. +`select.all` is added beside the task's list because `select.invert` and Ctrl+A are a pair in `SPEC.md` 6.1. Part names compare as the resolver compares them, so `3024` and `3024.DAT` select the same placements. ## cli part-mesh · 0.2.0 (app/automation/cli.py) -`./formblocks cli part-mesh NAME [--quality standard|low|high]` prints the triangle and edge counts, the bounds in LDU, whether the mesh came from the cache, how long the call took and the size of its bytes: what Phase 2's exit criterion asks to see (a second call answering from the cache in under a tenth of the first's time). It always runs in this process, on the same data folder and so the same mesh cache as the engine, because the engine's route returns only the bytes and the counts would have to be decoded again. The mesh lane's `PartMesh` does not say whether it was read from the cache, so the command looks for the cache file before the call through the lane's own `MeshCache`, `library_key` and `part_file`; if those names change, `from_cache` is null rather than an error. A missing `app.mesh` is a sentence, not a trace. Checked on the full library with a fresh data folder: 3001 gave 700 triangles and 472 edges, bounds -40 -24 -20 to 40 4 20, 34.4 ms not from the cache, then 0.68 ms from the cache; 3023 drew through its move (172 triangles); `--quality high` 2,044 triangles; an unknown part exit 1, an unknown quality exit 2. +`./formblocks cli part-mesh NAME [--quality standard|low|high]` prints the triangle and edge counts, the bounds in LDU, whether the mesh came from the cache, how long the call took and the size of its bytes: what Phase 2's exit criterion asks to see (a second call answering from the cache in under a tenth of the first's time). It always runs in this process, on the same data folder and so the same mesh cache as the engine, because the engine's route returns only the bytes and the counts would have to be decoded again. The mesh lane's `PartMesh` does not say whether it was read from the cache, so the command looks for the cache file before the call through the lane's own `MeshCache`, `library_key` and `part_file`; if those names change, `from_cache` is null rather than an error. A missing `app.mesh` is a sentence, not a trace. +Checked on the full library with a fresh data folder: 3001 gave 700 triangles and 472 edges, bounds -40 -24 -20 to 40 4 20, 34.4 ms not from the cache, then 0.68 ms from the cache; 3023 drew through its move (172 triangles); `--quality high` 2,044 triangles; an unknown part exit 1, an unknown quality exit 2. ## The part commands take final transforms · 0.2.0 (app/cmd/commands/part.py) -`part.place`, `part.move`, `part.set_transform`, `part.rotate`, `part.recolour`, `part.duplicate`, `part.delete`, `part.hide` and `part.show`, each one undo step however many placements it touches (`SPEC.md` 5.6), each answering what it changed and a label such as "Move 3 parts". They put placements exactly where they are told: snapping, the overlap check and the library's "is this part there" test are other lanes and will stand in front of these commands, so the engine stays usable from the command line before they land. The task's names (`part.move`, `part.rotate`, `part.duplicate`, `part.delete`) differ from `SPEC.md` 21.2, which puts them under `selection` and calls the exact setter `placement.set`; the lead's are used, and every one of them takes `ids` or acts on the selection, so both readings are served. A new placement goes into the submodel being edited at the step shown, or into the last step of another submodel (`SPEC.md` 4.3), and becomes the selection when it is in the submodel being edited. `step` one past the last starts a new step, the `--step new` of `SPEC.md` 11.6. A use of a submodel is placed by naming the submodel, and refused when the submodel holds, however deep, the one it would go into (`SPEC.md` 10.4). Rotation is by quarter turns about an LDraw axis through `about`, by default the centre of the placements' origins, so a group turns as one piece; fine angles are left to a later version, since a quarter turn is exact and a fine one would put irrational numbers into the file. A duplicate is visible even when its original is hidden, because the person asked for something to see. `part.show` with no ids is Show all (`SPEC.md` 9.1). Hiding is undoable and saved only in the project file (`SPEC.md` 9.3), through the NEXT lines. +`part.place`, `part.move`, `part.set_transform`, `part.rotate`, `part.recolour`, `part.duplicate`, `part.delete`, `part.hide` and `part.show`, each one undo step however many placements it touches (`SPEC.md` 5.6), each answering what it changed and a label such as "Move 3 parts". They put placements exactly where they are told: snapping, the overlap check and the library's "is this part there" test are other lanes and will stand in front of these commands, so the engine stays usable from the command line before they land. The task's names (`part.move`, `part.rotate`, `part.duplicate`, `part.delete`) differ from `SPEC.md` 21.2, which puts them under `selection` and calls the exact setter `placement.set`; the lead's are used, and every one of them takes `ids` or acts on the selection, so both readings are served. +A new placement goes into the submodel being edited at the step shown, or into the last step of another submodel (`SPEC.md` 4.3), and becomes the selection when it is in the submodel being edited. `step` one past the last starts a new step, the `--step new` of `SPEC.md` 11.6. A use of a submodel is placed by naming the submodel, and refused when the submodel holds, however deep, the one it would go into (`SPEC.md` 10.4). Rotation is by quarter turns about an LDraw axis through `about`, by default the centre of the placements' origins, so a group turns as one piece; fine angles are left to a later version, since a quarter turn is exact and a fine one would put irrational numbers into the file. A duplicate is visible even when its original is hidden, because the person asked for something to see. `part.show` with no ids is Show all (`SPEC.md` 9.1). Hiding is undoable and saved only in the project file (`SPEC.md` 9.3), through the NEXT lines. ## cli parts search and parts show · 0.2.0 (app/automation/cli.py) -`./formblocks cli parts search WORDS` prints the same JSON as `GET /api/parts/search`, with `--category`, `--list favourites|recent|hidden`, `--printed`, `--limit` (20 unless given, at most 500) and `--offset`; the words need no quotes, so `parts search brick 2 x 4` works. `spec/SPEC.md` 2.8 asks for one line per part by default and JSON with `--json`; the task for this lane asked every new subcommand to print JSON, so JSON is the default here, `--json` is accepted and does nothing, and `--lines` prints the specification's line (number, description, category, separated by tabs, with "(moved to ...)" for a moved number). Which one is the default is for the owner to settle. `parts show NAME` prints the one entry, following a move. Both go through the running engine when there is one and run here otherwise, on the same data folder. Checked through the engine on 8330 and with no engine: `brick 2 x 4` lists 3001 first (157 hits), `--lines` prints 3001 first, `show 3023` follows to `3023b`, an unknown part and a data folder with no library each exit 1 with a sentence, `--limit 0` and `parts` alone exit 2. +`./formblocks cli parts search WORDS` prints the same JSON as `GET /api/parts/search`, with `--category`, `--list favourites|recent|hidden`, `--printed`, `--limit` (20 unless given, at most 500) and `--offset`; the words need no quotes, so `parts search brick 2 x 4` works. `spec/SPEC.md` 2.8 asks for one line per part by default and JSON with `--json`; the task for this lane asked every new subcommand to print JSON, so JSON is the default here, `--json` is accepted and does nothing, and `--lines` prints the specification's line (number, description, category, separated by tabs, with "(moved to ...)" for a moved number). Which one is the default is for the owner to settle. `parts show NAME` prints the one entry, following a move. Both go through the running engine when there is one and run here otherwise, on the same data folder. +Checked through the engine on 8330 and with no engine: `brick 2 x 4` lists 3001 first (157 hits), `--lines` prints 3001 first, `show 3023` follows to `3023b`, an unknown part and a data folder with no library each exit 1 with a sentence, `--limit 0` and `parts` alone exit 2. ## New, open, save and save as · 0.2.0 (app/cmd/commands/model.py) -The task named these `model.new`, `model.open`, `model.save` and `model.save_as`; `SPEC.md` 21.2 names the area `file` (`file.new`, `file.open`, `file.save`, `file.export_ldraw`), and the lead's names are used here, to be settled in the catalogue table. They are file commands, not undo steps: `SPEC.md` 16.2 says opening a model or starting a new one starts a new history and saving does not change the model. New and open refuse while the open model has unsaved changes unless `discard` is true, which is the engine's half of the save, discard or cancel question of `SPEC.md` 14.2; the window asks and sends the answer. `model.save` writes only to a `.fblk` the model came from or was saved as; anything else is refused with a sentence pointing at `model.save_as`, which is where the window asks where to save. `model.save_as` with `.fblk` writes the project file and makes it the model's file; with `.ldr` or `.mpd` it is "Export LDraw" (`SPEC.md` 14.3): FormBlocks' own state is left out, and the model's file and its unsaved mark do not change, because what was written is not the project. A library part file opens as one placement of the part, with no file behind the model, so saving it asks for a path. The answer of each says the path, the kind, the main model, the counts, the unsaved mark, and for open the first twenty lines that could not be read and the encoding. +The task named these `model.new`, `model.open`, `model.save` and `model.save_as`; `SPEC.md` 21.2 names the area `file` (`file.new`, `file.open`, `file.save`, `file.export_ldraw`), and the lead's names are used here, to be settled in the catalogue table. They are file commands, not undo steps: `SPEC.md` 16.2 says opening a model or starting a new one starts a new history and saving does not change the model. New and open refuse while the open model has unsaved changes unless `discard` is true, which is the engine's half of the save, discard or cancel question of `SPEC.md` 14.2; the window asks and sends the answer. `model.save` writes only to a `.fblk` the model came from or was saved as; anything else is refused with a sentence pointing at `model.save_as`, which is where the window asks where to save. +`model.save_as` with `.fblk` writes the project file and makes it the model's file; with `.ldr` or `.mpd` it is "Export LDraw" (`SPEC.md` 14.3): FormBlocks' own state is left out, and the model's file and its unsaved mark do not change, because what was written is not the project. A library part file opens as one placement of the part, with no file behind the model, so saving it asks for a path. The answer of each says the path, the kind, the main model, the counts, the unsaved mark, and for open the first twenty lines that could not be read and the encoding. ## The command line names itself and takes options per command · 0.2.0 (app/automation/cli.py) @@ -481,11 +578,13 @@ Every request the command line sends to the engine now carries `X-FormBlocks-Cli ## Shared parameter checks for the model commands · 0.2.0 (app/cmd/args.py) -The commands share their parameters' shapes and checks here, so a position, a rotation, a colour or a list of ids is described and refused the same way everywhere, and every refusal starts with or names the parameter. `ids` left out or empty means the selection (`SPEC.md` 6.5: every command that acts on the selection also takes placement ids, so a script never needs to select first), and the refusal for neither says so. A position must stay within the million LDU of `SPEC.md` 5.6; a rotation whose determinant is within the flattener's threshold of zero is refused, because it would flatten the part; a mirrored rotation is kept, since files carry them. A part name without an extension gets `.dat`, unless it names a submodel, which `part.place` takes in a part's place (`SPEC.md` 10.6); a submodel name without one gets `.ldr`, as `SPEC.md` 10.4 names blocks, and may not be the name of another block or carry `& # | ?`, the characters the format advises against in a type 1 line's file name. The module sits beside the registry and not in `commands/`, so the registry's loader does not import it as a command module. +The commands share their parameters' shapes and checks here, so a position, a rotation, a colour or a list of ids is described and refused the same way everywhere, and every refusal starts with or names the parameter. `ids` left out or empty means the selection (`SPEC.md` 6.5: every command that acts on the selection also takes placement ids, so a script never needs to select first), and the refusal for neither says so. A position must stay within the million LDU of `SPEC.md` 5.6; a rotation whose determinant is within the flattener's threshold of zero is refused, because it would flatten the part; a mirrored rotation is kept, since files carry them. +A part name without an extension gets `.dat`, unless it names a submodel, which `part.place` takes in a part's place (`SPEC.md` 10.6); a submodel name without one gets `.ldr`, as `SPEC.md` 10.4 names blocks, and may not be the name of another block or carry `& # | ?`, the characters the format advises against in a type 1 line's file name. The module sits beside the registry and not in `commands/`, so the registry's loader does not import it as a command module. ## POST /api/library/check_update · 0.2.0 (app/routers/library.py, app/services/library_host.py) -"Check for an update" (`spec/SPEC.md` 17.2, 17.5) is a POST because it is the person's request to use the network, and it needs the window key like every route; it asks the server for the archive's headers once and downloads nothing. The answer is the library lane's (`available`, `reason`, `server`, `installed` from the fetch record) plus `in_use`, the folder, source and update of the library actually in use, because the lane compares only with a fetched archive: a person who uses their own folder is told an update is "available" with the reason "no library has been fetched", and the window needs `in_use` to say that plainly. The reported size is kept for the library card's consent sentence, and the answer carries the card. A server that does not answer is 502 with the sentence. Fetching the update goes through `POST /api/library/fetch` with consent, as the first fetch does. Checked on 8330 with curl: 401 without the key; with it the server's size 146,853,687, its date and `etag`, `available` true for the environment's folder, and the card's size "147 MB". +"Check for an update" (`spec/SPEC.md` 17.2, 17.5) is a POST because it is the person's request to use the network, and it needs the window key like every route; it asks the server for the archive's headers once and downloads nothing. The answer is the library lane's (`available`, `reason`, `server`, `installed` from the fetch record) plus `in_use`, the folder, source and update of the library actually in use, because the lane compares only with a fetched archive: a person who uses their own folder is told an update is "available" with the reason "no library has been fetched", and the window needs `in_use` to say that plainly. The reported size is kept for the library card's consent sentence, and the answer carries the card. A server that does not answer is 502 with the sentence. Fetching the update goes through `POST /api/library/fetch` with consent, as the first fetch does. +Checked on 8330 with curl: 401 without the key; with it the server's size 146,853,687, its date and `etag`, `available` true for the environment's folder, and the card's size "147 MB". ## POST /api/library/use · 0.2.0 (app/routers/library.py) @@ -497,9 +596,11 @@ The colour palette and the renderer both read the library's own colour table (`s ## The parts routes: categories, search, one part, its mesh · 0.2.0 (app/routers/parts.py, app/main.py) -`GET /api/parts/categories` lists the palette's categories with their counts in the person's order: starred first, then the order dragged into settings, then the rest alphabetically, as the library lane's log asks the engine to pass from settings (`spec/SPEC.md` 2.2). `?include_printed=true` counts printed parts too. `GET /api/parts/search?q=&category=&list=&printed=&limit=&offset=` gives `{query, category, list, total, offset, limit, hits}`, each hit `{name, description, category, keywords}` with the description's runs of spaces made one, plus `moved_to` and `target_description` for a moved number so the palette can show the pointer. `list` is `favourites`, `recent` or `hidden` (2.3: typing while a list is shown searches only that list), read from settings, and hidden parts are left out of every other list (2.4). The search runs over the whole ranked list and the page is cut from it, so `total` is exact; the library lane's word index keeps that within tens of milliseconds. `GET /api/parts/{name}` is the one entry with its author and licence, `follows` and `target_entry` when the number was moved (so `3023` answers with `3023b`), and whether the person starred or hid it; 404 with a sentence for a number the library does not have. Every route answers 409 with the spec's sentence when no library is installed (1.3). +`GET /api/parts/categories` lists the palette's categories with their counts in the person's order: starred first, then the order dragged into settings, then the rest alphabetically, as the library lane's log asks the engine to pass from settings (`spec/SPEC.md` 2.2). `?include_printed=true` counts printed parts too. `GET /api/parts/search?q=&category=&list=&printed=&limit=&offset=` gives `{query, category, list, total, offset, limit, hits}`, each hit `{name, description, category, keywords}` with the description's runs of spaces made one, plus `moved_to` and `target_description` for a moved number so the palette can show the pointer. `list` is `favourites`, `recent` or `hidden` (2.3: typing while a list is shown searches only that list), read from settings, and hidden parts are left out of every other list (2.4). +The search runs over the whole ranked list and the page is cut from it, so `total` is exact; the library lane's word index keeps that within tens of milliseconds. `GET /api/parts/{name}` is the one entry with its author and licence, `follows` and `target_entry` when the number was moved (so `3023` answers with `3023b`), and whether the person starred or hid it; 404 with a sentence for a number the library does not have. Every route answers 409 with the spec's sentence when no library is installed (1.3). -`GET /api/parts/{name}/mesh?quality=standard|low|high` returns the mesh lane's `part_mesh(service, name, quality).to_bytes()` as `application/octet-stream`. The module is imported inside the route, so the engine boots and every other route works before the mesh lane lands, and a missing `app.mesh` (or one without `part_mesh`) is 503 with a sentence; a broken import inside `app.mesh` still fails loudly. The `ETag` is the library update followed by a hash of the index's fingerprint, the quality and the name, so it changes with every library update and with any change to the person's own folder, and `If-None-Match` with it answers 304 without building anything; the window can keep meshes in its own cache across reloads. A part the mesh lane cannot flatten is 422 with its `MeshError` sentence. Checked on 8330 with curl on the full library: 401 without the key on each route; `brick 2 x 4` gave 3001 first of 157; a limit of 0 and an unknown list 422; `3023` followed to `3023b`; an unknown part 404; the mesh of 3001 200 with 78,848 bytes and the content type, a second call 200 again in 20 ms, the ETag 304, a quality of `ultra` 422; with `app.mesh` blocked in process the route's import answered 503. +`GET /api/parts/{name}/mesh?quality=standard|low|high` returns the mesh lane's `part_mesh(service, name, quality).to_bytes()` as `application/octet-stream`. The module is imported inside the route, so the engine boots and every other route works before the mesh lane lands, and a missing `app.mesh` (or one without `part_mesh`) is 503 with a sentence; a broken import inside `app.mesh` still fails loudly. The `ETag` is the library update followed by a hash of the index's fingerprint, the quality and the name, so it changes with every library update and with any change to the person's own folder, and `If-None-Match` with it answers 304 without building anything; the window can keep meshes in its own cache across reloads. A part the mesh lane cannot flatten is 422 with its `MeshError` sentence. +Checked on 8330 with curl on the full library: 401 without the key on each route; `brick 2 x 4` gave 3001 first of 157; a limit of 0 and an unknown list 422; `3023` followed to `3023b`; an unknown part 404; the mesh of 3001 200 with 78,848 bytes and the content type, a second call 200 again in 20 ms, the ETag 304, a quality of `ultra` 422; with `app.mesh` blocked in process the route's import answered 503. ## The runner sends each command the way its kind says · 0.2.0 (app/cmd/runner.py) @@ -507,11 +608,14 @@ A `change` command runs inside `Document.change` and its answer carries `undo`, ## The document: one open model, its view, its file and its history · 0.2.0 (app/doc/document.py) -Replaces the starter's notes document at the same module path, so `document()` still answers the routes, the live channel, the MCP server and the command line. It holds the model table, the view (the selection, the path of submodels being edited from the main model down, the step shown in each submodel, by default its last, `SPEC.md` 11.2), the file the model came from and its kind, the open report (lines that could not be read, the encoding), the history and the revision. Four ways in, one per command kind: `change` runs a command against the table, takes the difference, makes one undo step under the command's label (or the label the command set, such as "Move 3 parts") and moves the revision; `look` runs a selection or view command, which moves the revision when the view changed and makes no undo step; `replace` puts a newly opened or new model in place and starts a new history (`SPEC.md` 16.2); `mark_saved` records a save. A command that raises leaves the table and the view as they were. After every change the view is settled: a selection keeps only visible placements of the submodel being edited (`SPEC.md` 6.4), a path loses submodels that no longer exist, and a step shown past the last step comes back to it. The open model is kept in `open-model.json` and its history in `open-history.json` in the data folder after every change, as the starter kept its notes, so the command line without a running engine sees one model across runs and its undo works; these are the engine's working files, never the person's model file, which is written only by save. The revision and the serials are saved too, so a revision never repeats after a restart; the change feed is not, so a window asking after a restart is told to read the whole document. +Replaces the starter's notes document at the same module path, so `document()` still answers the routes, the live channel, the MCP server and the command line. It holds the model table, the view (the selection, the path of submodels being edited from the main model down, the step shown in each submodel, by default its last, `SPEC.md` 11.2), the file the model came from and its kind, the open report (lines that could not be read, the encoding), the history and the revision. +Four ways in, one per command kind: `change` runs a command against the table, takes the difference, makes one undo step under the command's label (or the label the command set, such as "Move 3 parts") and moves the revision; `look` runs a selection or view command, which moves the revision when the view changed and makes no undo step; `replace` puts a newly opened or new model in place and starts a new history (`SPEC.md` 16.2); `mark_saved` records a save. A command that raises leaves the table and the view as they were. After every change the view is settled: a selection keeps only visible placements of the submodel being edited (`SPEC.md` 6.4), a path loses submodels that no longer exist, and a step shown past the last step comes back to it. +The open model is kept in `open-model.json` and its history in `open-history.json` in the data folder after every change, as the starter kept its notes, so the command line without a running engine sees one model across runs and its undo works; these are the engine's working files, never the person's model file, which is written only by save. The revision and the serials are saved too, so a revision never repeats after a restart; the change feed is not, so a window asking after a restart is told to read the whole document. ## Reading and writing the person's files · 0.2.0 (app/doc/files.py) -A path must be a full path (a leading `~` is the home folder): the engine's working folder is nobody's idea of "here", and a relative path from an agent would land somewhere the person did not mean. The kind comes from the extension: `.fblk`, `.ldr`, `.mpd` and `.dat`, case ignored. A `.dat` opens as a new model holding one placement of the part, by reference, through `app.ldraw.part_model_file` (`SPEC.md` 14.2), when its header names an official part type or it sits under a library's `parts` or `p` folder (one with `LDConfig.ldr` beside it); its name in the placement is the library name, so `parts/s/x.dat` is placed as `s\x.dat`. A `.dat` that is neither is a model, the rule `spec/LDRAW.md` gives under "Model files". A file over 64 MB is refused before it is read. Writing goes to a hidden part file beside the target and is moved into place, so a failed save leaves the old file as it was (`SPEC.md` 14.5 and 14.6), and every failure is one sentence that names the parameter. Which paths an outside agent may give is decided before a command runs, by the approval the MCP server asks for; this module reads only what it is handed. +A path must be a full path (a leading `~` is the home folder): the engine's working folder is nobody's idea of "here", and a relative path from an agent would land somewhere the person did not mean. The kind comes from the extension: `.fblk`, `.ldr`, `.mpd` and `.dat`, case ignored. A `.dat` opens as a new model holding one placement of the part, by reference, through `app.ldraw.part_model_file` (`SPEC.md` 14.2), when its header names an official part type or it sits under a library's `parts` or `p` folder (one with `LDConfig.ldr` beside it); its name in the placement is the library name, so `parts/s/x.dat` is placed as `s\x.dat`. A `.dat` that is neither is a model, the rule `spec/LDRAW.md` gives under "Model files". A file over 64 MB is refused before it is read. +Writing goes to a hidden part file beside the target and is moved into place, so a failed save leaves the old file as it was (`SPEC.md` 14.5 and 14.6), and every failure is one sentence that names the parameter. Which paths an outside agent may give is decided before a command runs, by the approval the MCP server asks for; this module reads only what it is handed. ## The change feed: what each revision touched · 0.2.0 (app/doc/changes.py, app/doc/views.py) @@ -523,19 +627,23 @@ An undo step is the command's label, the keys of the model table it changed with ## From model file records to the model and back · 0.2.0 (app/doc/convert.py) -`from_model_file` takes what `app.ldraw.read_model_file` gives and fills the model table; `to_model_file` and `write` give it back to `write_model_file`. Every type 1 line becomes a placement; every other line in a step (comments, unknown META lines, loose edges, triangles and quads, blank lines) is kept as its text at its place among the placements, which is what `SPEC.md` 14.3 asks. A `0 BFC INVERTNEXT` directly before a type 1 line belongs to that placement (`invert`), so moving the placement to another step or deleting it never leaves the statement behind to flip whatever line comes next; it is written back directly before its line. Hidden and open marks come from the step's NEXT lines and go back the same way, and `!DATA` blocks and `NOFILE` trailers are carried as text. The main model's project state (library update, camera, snap and grid, current colour) is kept as read and written back on a `.fblk` save, with `SHOW` written from the step and submodel shown, so this lane never invents the camera another lane owns. A main model with no name (a plain `.ldr`) is named from its `Name:` line, else the file name, so it can always be written as a `0 FILE` block. A second block with a name already taken keeps its name and gets a key with `#2`, so a file that breaks the uniqueness rule still opens and saves without losing a block; references find the first, as the resolver does. Writing `ldr` gives a single-file text when there is one model and no data, else the multi-part form inside the `.ldr`, which `SPEC.md` 14.1 allows. Checked: the sample `car.ldr` read and written as `ldr` came back byte for byte, and as `mpd` and `fblk` reread to the same 61 placements. +`from_model_file` takes what `app.ldraw.read_model_file` gives and fills the model table; `to_model_file` and `write` give it back to `write_model_file`. Every type 1 line becomes a placement; every other line in a step (comments, unknown META lines, loose edges, triangles and quads, blank lines) is kept as its text at its place among the placements, which is what `SPEC.md` 14.3 asks. A `0 BFC INVERTNEXT` directly before a type 1 line belongs to that placement (`invert`), so moving the placement to another step or deleting it never leaves the statement behind to flip whatever line comes next; it is written back directly before its line. Hidden and open marks come from the step's NEXT lines and go back the same way, and `!DATA` blocks and `NOFILE` trailers are carried as text. +The main model's project state (library update, camera, snap and grid, current colour) is kept as read and written back on a `.fblk` save, with `SHOW` written from the step and submodel shown, so this lane never invents the camera another lane owns. A main model with no name (a plain `.ldr`) is named from its `Name:` line, else the file name, so it can always be written as a `0 FILE` block. A second block with a name already taken keeps its name and gets a key with `#2`, so a file that breaks the uniqueness rule still opens and saves without losing a block; references find the first, as the resolver does. Writing `ldr` gives a single-file text when there is one model and no data, else the multi-part form inside the `.ldr`, which `SPEC.md` 14.1 allows. Checked: the sample `car.ldr` read and written as `ldr` came back byte for byte, and as `mpd` and `fblk` reread to the same 61 placements. ## The model as a flat table of keys, copied on write · 0.2.0 (app/doc/model.py) -`SPEC.md` 0.1 makes a model a tree of submodels, each holding placements in steps. The document keeps it as one flat table: `meta` (the main model's key, the order of the file's blocks with any `!DATA` block kept as its lines, the project state lines, whether the file was a plain single model), `s:` for each submodel (its name as written after `0 FILE`, its header lines, its `NOFILE` trailer, and its steps, each a name, whether a `0 STEP` closed it, and items that are either a placement id or a line FormBlocks does not use, kept as text in place) and `p:` for each placement (part, colour, position, rotation, hidden, the tree row's open mark, and whether a `0 BFC INVERTNEXT` stood before it). The key of a submodel is its name compared as the resolver compares names, case folded with `\` read as `/`. Everything in it is plain JSON, so it can be compared, saved beside the engine and sent to the window as it is. Commands never change a value in place: `writable` copies a value the first time a command touches it, so the table taken before the command still holds the old values and the difference is found by identity first and equality second. That difference is what the undo history and the change feed keep, so an undo step of a move holds the moved placements only, not the whole model. Placement ids come from a counter outside the table that never goes back, so an id taken back by undo is never given to another placement (`SPEC.md` 21.1). `reaches` walks uses of submodels with a seen set and answers whether one submodel contains another however deep, which is the test `SPEC.md` 10.4 needs before a use is placed or packed. +`SPEC.md` 0.1 makes a model a tree of submodels, each holding placements in steps. The document keeps it as one flat table: `meta` (the main model's key, the order of the file's blocks with any `!DATA` block kept as its lines, the project state lines, whether the file was a plain single model), `s:` for each submodel (its name as written after `0 FILE`, its header lines, its `NOFILE` trailer, and its steps, each a name, whether a `0 STEP` closed it, and items that are either a placement id or a line FormBlocks does not use, kept as text in place) and `p:` for each placement (part, colour, position, rotation, hidden, the tree row's open mark, and whether a `0 BFC INVERTNEXT` stood before it). The key of a submodel is its name compared as the resolver compares names, case folded with `\` read as `/`. +Everything in it is plain JSON, so it can be compared, saved beside the engine and sent to the window as it is. Commands never change a value in place: `writable` copies a value the first time a command touches it, so the table taken before the command still holds the old values and the difference is found by identity first and equality second. That difference is what the undo history and the change feed keep, so an undo step of a move holds the moved placements only, not the whole model. Placement ids come from a counter outside the table that never goes back, so an id taken back by undo is never given to another placement (`SPEC.md` 21.1). `reaches` walks uses of submodels with a seen set and answers whether one submodel contains another however deep, which is the test `SPEC.md` 10.4 needs before a use is placed or packed. ## POST /api/library/fetch and /cancel: consent only from the person · 0.2.0 (app/routers/library.py) -`spec/SPEC.md` 17.5 lets only the person give the consent to fetch, in the window or at the command line, and the library lane leaves deciding who is asking to the engine. The route decides it in three ways. An agent tab's token never reaches `/api` (the guard answers 403), and a caller the guard marked as a tab, or one that names itself with `X-FormBlocks-Agent` (the stdio bridge's header), is refused with 403 even with a consent in the body. A request with no `consent` is 428 with a sentence that says how to give it: the Fetch button for the window, or `--i-consent "
"` when the request carries `X-FormBlocks-Client: cli`, which the command line sends. A consent whose address or licence is not exactly the card's is 428 with the library lane's sentence; 428 (precondition required) rather than 422 because the body is well formed and only the person's agreement is missing. A fetch while one runs is 409. The answer is the job, and progress follows on the live channel. The window key cannot tell the window from the command line, since both hold it; the header is a label for the right sentence, not a gate, and the gate is the exact consent. `POST /api/library/cancel` answers whether a fetch was running and the job. Checked on 8330 with curl: 401 without the key; 428 for no body, an empty body and the command line's header without a consent; 403 for an agent's header with a correct consent; 428 for a wrong licence and a wrong address; cancel with nothing running. The one consented fetch was not run, because this lane is an agent. +`spec/SPEC.md` 17.5 lets only the person give the consent to fetch, in the window or at the command line, and the library lane leaves deciding who is asking to the engine. The route decides it in three ways. An agent tab's token never reaches `/api` (the guard answers 403), and a caller the guard marked as a tab, or one that names itself with `X-FormBlocks-Agent` (the stdio bridge's header), is refused with 403 even with a consent in the body. A request with no `consent` is 428 with a sentence that says how to give it: the Fetch button for the window, or `--i-consent "
"` when the request carries `X-FormBlocks-Client: cli`, which the command line sends. +A consent whose address or licence is not exactly the card's is 428 with the library lane's sentence; 428 (precondition required) rather than 422 because the body is well formed and only the person's agreement is missing. A fetch while one runs is 409. The answer is the job, and progress follows on the live channel. The window key cannot tell the window from the command line, since both hold it; the header is a label for the right sentence, not a gate, and the gate is the exact consent. `POST /api/library/cancel` answers whether a fetch was running and the job. Checked on 8330 with curl: 401 without the key; 428 for no body, an empty body and the command line's header without a consent; 403 for an agent's header with a correct consent; 428 for a wrong licence and a wrong address; cancel with nothing running. The one consented fetch was not run, because this lane is an agent. ## GET /api/library/status · 0.2.0 (app/routers/library.py, app/main.py) -The library card, the Library page and the status bar read one route: `found`, `folder`, `source` (`setting`, `environment`, `fetched` or `usual place`), `update`, `quality`, `index_ready`, `indexing`, `parts`, the check of the folder and every place tried, the fetch record, the fetch job, and `card`, `consent` and `attribution` as data so the window never writes its own wording. `?ask_server=true` asks the server for the archive's size with one `HEAD` (the card shows the size reported at that moment, `spec/SPEC.md` 1.3) and is the only way this route touches the network; a server that does not answer is 502 with the sentence. The route runs in a worker thread because locating a library and reading the record touch the disk. Checked on 8330 with curl against the full library through `FORMBLOCKS_LDRAW_DIR`: 401 without the key; with it found from the environment, the update `unknown` until the background index finished, then `2026-10` and 20,342 parts; with `ask_server` the size 146,853,687 and "about 147 MB" in the consent sentence. +The library card, the Library page and the status bar read one route: `found`, `folder`, `source` (`setting`, `environment`, `fetched` or `usual place`), `update`, `quality`, `index_ready`, `indexing`, `parts`, the check of the folder and every place tried, the fetch record, the fetch job, and `card`, `consent` and `attribution` as data so the window never writes its own wording. `?ask_server=true` asks the server for the archive's size with one `HEAD` (the card shows the size reported at that moment, `spec/SPEC.md` 1.3) and is the only way this route touches the network; a server that does not answer is 502 with the sentence. The route runs in a worker thread because locating a library and reading the record touch the disk. +Checked on 8330 with curl against the full library through `FORMBLOCKS_LDRAW_DIR`: 401 without the key; with it found from the environment, the update `unknown` until the background index finished, then `2026-10` and 20,342 parts; with `ask_server` the size 146,853,687 and "about 147 MB" in the consent sentence. ## GET and PUT /api/settings · 0.2.0 (app/routers/settings.py, app/main.py) @@ -547,19 +655,23 @@ A placement's rotation is the nine numbers of its type 1 line in the line's orde ## The fetch runs as one job in the engine · 0.2.0 (app/services/library_host.py) -A fetch takes minutes, so `library_host.fetch` checks the consent at once (the library lane's `require_consent`, so a wrong address or licence is refused before any thread starts), then runs the service's fetch in a background thread and answers with the job: running, the step (`download`, `unpack`, `release`, `done`), how far, and at the end `done`, `cancelled` or `failed` with the sentence. The live channel carries `{"type": "library", "stage": "fetch", step, done, total}` (at most four a second, and every change of step) and `{"stage": "fetched", outcome, error}` at the end; `status` carries the same job so a window that reloads mid-fetch sees it. A second fetch while one runs is refused as busy. `cancel` sets the event the download and unpack check between blocks; what is left is the library lane's to keep for resuming. After a good fetch the service has already dropped the folder setting, and the library lane's log asks the engine to write that back: the settings file's `library_folder` is set to null here, so the next start uses the fetched library too. The index is then built in the background. `wait=True` runs the same job in the caller's thread for the command line with no engine running. Checked in process with a stand-in for the download: missing and wrong consent refused, a job run to `done` cleared the folder setting, a cancelled one ended `cancelled`. A real download was not run here: this lane is an agent, and an agent may not give the consent. +A fetch takes minutes, so `library_host.fetch` checks the consent at once (the library lane's `require_consent`, so a wrong address or licence is refused before any thread starts), then runs the service's fetch in a background thread and answers with the job: running, the step (`download`, `unpack`, `release`, `done`), how far, and at the end `done`, `cancelled` or `failed` with the sentence. The live channel carries `{"type": "library", "stage": "fetch", step, done, total}` (at most four a second, and every change of step) and `{"stage": "fetched", outcome, error}` at the end; `status` carries the same job so a window that reloads mid-fetch sees it. A second fetch while one runs is refused as busy. `cancel` sets the event the download and unpack check between blocks; what is left is the library lane's to keep for resuming. +After a good fetch the service has already dropped the folder setting, and the library lane's log asks the engine to write that back: the settings file's `library_folder` is set to null here, so the next start uses the fetched library too. The index is then built in the background. `wait=True` runs the same job in the caller's thread for the command line with no engine running. Checked in process with a stand-in for the download: missing and wrong consent refused, a job run to `done` cleared the folder setting, a cancelled one ended `cancelled`. A real download was not run here: this lane is an agent, and an agent may not give the consent. ## The registry takes arrays and a kind for each command · 0.2.0 (app/cmd/registry.py) -FormBlocks' commands take lists (placement ids) and fixed-length vectors (a position is three numbers, a rotation nine), so a parameter can now be an `array` with an item type and a length range (`items`, `min_items`, and `max_length` as the most items); the catalogue entry and the JSON schema carry them, and `clean` checks each item and names the parameter and the item that is wrong. Numbers must be finite, since a NaN position would be written into a model file. A parameter that is optional may be sent as null, which reads as left out, so a window form can send every field. Each command also has a `kind`, one of the four the specification's ground rules name: `read` (reads only), `view` (selection, the step shown, the submodel being edited: changes no model and is no undo step, `SPEC.md` 6.4 and 16.2), `change` (one undo step) and `file` (new, open and save, which start a history or write a file but are never undone). `read_only` stays, true for `read` and `view`, because the MCP server gates by it and the specification says selection and view commands are not approval-gated for agents. +FormBlocks' commands take lists (placement ids) and fixed-length vectors (a position is three numbers, a rotation nine), so a parameter can now be an `array` with an item type and a length range (`items`, `min_items`, and `max_length` as the most items); the catalogue entry and the JSON schema carry them, and `clean` checks each item and names the parameter and the item that is wrong. Numbers must be finite, since a NaN position would be written into a model file. A parameter that is optional may be sent as null, which reads as left out, so a window form can send every field. +Each command also has a `kind`, one of the four the specification's ground rules name: `read` (reads only), `view` (selection, the step shown, the submodel being edited: changes no model and is no undo step, `SPEC.md` 6.4 and 16.2), `change` (one undo step) and `file` (new, open and save, which start a history or write a file but are never undone). `read_only` stays, true for `read` and `view`, because the MCP server gates by it and the specification says selection and view commands are not approval-gated for agents. ## The one LibraryService, held in services/library_host.py · 0.2.0 (app/services/library_host.py) -The library lane built `LibraryService` with no knowledge of the web framework or of settings; the engine needs exactly one of it per data folder, so `library_host.service()` makes it from `config.data_dir()` and the person's settings (folder, quality) and hands the same object to every router and to the command line. A different data folder (the command line's `--settings-dir`) gets a fresh one. `status()` is the shape the library card and the Library page read: found or not, where and how it was found, the update name, whether the index is ready or being built, every place tried, the fetch record, and the card itself (address, size, licence, consent sentence, attribution) as data. It asks the server for the size only when called with `ask_server`, because `spec/SPEC.md` 17.3 allows no network use the person did not ask for; otherwise the size is the last one the server reported in this run, or the fetched archive's. A status that finds a library with no index yet starts the index build in a background thread (`warm`), which reports progress on the live channel as `{"type": "library", "stage": "index", done, total}` at most four times a second and ends with `ready` and the update name, so the window's status bar can show long work (0.4). `use(folder)` checks the folder before anything changes: the service's own `locate(folder)` forgets the library in use when handed an incomplete folder, so an incomplete folder is refused with what it lacks and the library in use stays. A good folder is written to settings as the folder itself (the inner `ldraw` when the person picked its parent). +The library lane built `LibraryService` with no knowledge of the web framework or of settings; the engine needs exactly one of it per data folder, so `library_host.service()` makes it from `config.data_dir()` and the person's settings (folder, quality) and hands the same object to every router and to the command line. A different data folder (the command line's `--settings-dir`) gets a fresh one. `status()` is the shape the library card and the Library page read: found or not, where and how it was found, the update name, whether the index is ready or being built, every place tried, the fetch record, and the card itself (address, size, licence, consent sentence, attribution) as data. +It asks the server for the size only when called with `ask_server`, because `spec/SPEC.md` 17.3 allows no network use the person did not ask for; otherwise the size is the last one the server reported in this run, or the fetched archive's. A status that finds a library with no index yet starts the index build in a background thread (`warm`), which reports progress on the live channel as `{"type": "library", "stage": "index", done, total}` at most four times a second and ends with `ready` and the update name, so the window's status bar can show long work (0.4). `use(folder)` checks the folder before anything changes: the service's own `locate(folder)` forgets the library in use when handed an incomplete folder, so an incomplete folder is refused with what it lacks and the library in use stays. A good folder is written to settings as the folder itself (the inner `ldraw` when the person picked its parent). ## The person's settings file · 0.2.0 (app/core/settings.py) -`spec/SPEC.md` 17.3 keeps preferences in FormBlocks' own settings file, never in a model, so they live in `settings.json` in the data folder: the library folder, the primitive quality, the palette's category order and starred categories, favourite, hidden and recent parts, favourite colours, the grid step and the snap and overlap switches, with the first values of 17.2 and 7.2 (Stud, snap on, overlap off). Every key has one check that both the file reader and a change go through, so a value the window could not send is never read from disk either: a bad value in the file falls back to its first value, an unknown key is kept and written back untouched so a later version's settings survive an earlier one. Lists drop repeats without regard to case, recent parts keep at most thirty (2.4). A file that cannot be read at all is set aside as `settings.unreadable-