Merge pull request #7387 from dotCooCoo/feat/arrange-nest

Cutting Tools: Nest Shapes packs the selected objects onto a sheet or roll
This commit is contained in:
BFlat
2026-11-15 04:22:37 +07:00
committed by GitHub
38 changed files with 1037 additions and 6 deletions
+35 -2
View File
@@ -11361,8 +11361,8 @@ A `configure` call that changes no shape records no undo step and returns `{upda
## Cutting Tools add-on
Cutting Tools is a built-in add-on that prepares art for cutting. Its commands are `addon.cutting.bridges`,
`addon.cutting.weed` and `addon.cutting.banner`; in the desktop app they are Object › Plug-ins › Cutting Tools › Stencil
Bridges…, Weed Box and Lines… and Banner Hems and Grommets….
`addon.cutting.weed`, `addon.cutting.banner` and `addon.cutting.nest`; in the desktop app they are Object › Plug-ins ›
Cutting Tools › Stencil Bridges…, Weed Box and Lines…, Banner Hems and Grommets… and Nest Shapes….
### Stencil Bridges
@@ -11483,6 +11483,39 @@ Banner Hems and Grommets… opens the command dialog with Preview.
{"name":"run_command","arguments":{"command":"addon.cutting.banner","params":{"hem":"1 in","grommetInset":"0.5 in","spacing":"2 ft"}}}
```
### Nest Shapes
`addon.cutting.nest {roll?, width?, height?, margin?, spacing?, rotate?, usePreviewBounds?, artboard?, patterns?}` moves
the selected objects close together onto a sheet or a roll of material
([packing problems](https://en.wikipedia.org/wiki/Packing_problems)). The ranges, defaults and rules below are
VectorCraft's own. The sheet starts at the top-left corner of artboard `artboard` (0-based; by default the artboard
under the center of the selection, else the first). It is `width` × `height` points (0 to 1000000 each; 0, the default,
takes the artboard's width or height). With `roll` true it is a roll `width` wide with no end, and `height` is not used.
`margin` (0 to 100000, default 18) is kept clear inside each edge of the sheet; on a roll, inside the sides and the
start. `spacing` (0 to 100000, default 9) is kept between two objects.
Each selected object is packed by its bounding box: with its strokes and effects, including the reach of shadows, glows
and blurs, when `usePreviewBounds` is true (the default), else by its geometry. A group is one object. The tallest
objects go first, each where its bottom edge is highest and then furthest left. With `rotate` true (false by default),
an object may turn 90° clockwise where that puts its bottom edge higher, or where only the turned object fits; the
longest side then decides the order, and a turned object is measured as it is after the turn. A path of a
pixel-aligned compound path is not turned. Objects are moved, and turned with `rotate`, never resized. An object on the
pixel grid moves by whole points and takes 1 pt more room across and down. Objects that do not fit go in a column to
the right of the sheet, from its top, `spacing` from its edge and from each other, in stacking order (back to front).
Objects without bounds, such as an empty group, are not moved. `patterns` moves pattern fills and strokes with the art
(default: General › Transform Pattern Tiles).
All of it is one undo step, and nothing changes when no object moves. The command fails when nothing selected can be
measured, when the margin leaves no room on the sheet, when no selected object fits, with more than 10000 objects
selected, and with bad params. Result: `{placed, unplaced, rotated, skipped, length}`: the number of objects placed,
the ids of the objects put beside the sheet, the ids of the objects turned, the ids of the objects without bounds, and
the length of material used in points, from the sheet's top edge to the margin below the lowest object placed. Nest
Shapes… opens the command dialog with Preview.
```json
{"name":"run_command","arguments":{"command":"addon.cutting.nest","params":{"roll":true,"width":"24 in","margin":"0.25 in","spacing":"0.125 in","rotate":true}}}
```
## Color Effects add-on
Color Effects is a built-in add-on: its effects are colour adjustments in Effect › Color Effects, its command is
+4
View File
@@ -2325,6 +2325,10 @@ A VectorCraft addition, not a feature of the reference app, so no area score mov
A VectorCraft addition, so no area score moves. Object › Plug-ins › Cutting Tools › Banner Hems and Grommets… (`addon.cutting.banner`) marks where a printed banner is hemmed ([hem](https://en.wikipedia.org/wiki/Hem)) and where its grommets go ([grommet](https://en.wikipedia.org/wiki/Grommet)). The rest is VectorCraft's own: the banner is the selected art's bounds or each artboard; each chosen side gets a hem line at a set depth inside its edge (1 in by default) and grommet marks at a set inset (0.5 in), one at each end of the side and the rest spread evenly at most a set spacing apart (24 in), with one grommet at a shared corner. Each grommet mark is a circle with a cross through its center. The marks are stroked in a chosen swatch ([Registration] by default), in one group named Banner Marks per banner on top of the current layer, added as one undo step. The dialog has Preview. Tests: `cmd::addons::cutting::banner::tests` in `vectorcraft-engine`, `banner_hems_and_grommets_previews_cancels_and_runs_on_ok` in `vectorcraft-ui-egui` and `command_sweep`. Commands: `docs/mcp.md` › Cutting Tools add-on › Banner Hems and Grommets.
## Cutting Tools add-on: Nest Shapes (2026-11-14)
A VectorCraft addition, so no area score moves. Object › Plug-ins › Cutting Tools › Nest Shapes… (`addon.cutting.nest`) moves the selected objects close together onto a sheet or a roll of material ([packing problems](https://en.wikipedia.org/wiki/Packing_problems)). The rest is VectorCraft's own: the sheet is an artboard, or a set width and height from its top-left corner, and a roll is a set width with no end; a margin is kept inside the edges and a spacing between objects. Objects are packed by their bounding boxes, with or without strokes and effects (shadows, glows and blurs included), the tallest first, each where its bottom edge is highest and then furthest left; with Rotate an object may turn 90° where that places it higher or where only the turned object fits. Objects that do not fit go in a column to the right of the sheet, in stacking order. The command is one undo step, and its result gives the length of material used. The dialog has Preview. Tests: `cmd::addons::cutting::nest::tests` in `vectorcraft-engine`, `nest_shapes_previews_cancels_and_runs_on_ok` in `vectorcraft-ui-egui` and `command_sweep`. Commands: `docs/mcp.md` › Cutting Tools add-on › Nest Shapes.
## Path Precision Tools add-on: Divide into Dashes (2026-11-01)
A VectorCraft addition, not a feature of the reference app, so no area score moves. Object › Plug-ins › Path Precision Tools › Divide into Dashes… cuts the selected paths into separate open paths along the curve (arc length, not straight distance): each `dash` long (0.01 to 1000000 pt, 10 by default) with `gap` between them (0 by default: the pieces touch); the gap pieces are left out unless Remove Gaps is off. With direct-selected segments (or anchors) only those runs are divided, the pattern running on across segments that follow one another, and the rest of such a path stays as pieces of its own. Fit to Corners and Ends gives every run between corners and ends a whole number of dashes, all stretched or squeezed alike so it starts and ends on a dash (a closed path without corners holds whole periods); otherwise the lengths are exact and each run's last piece is what is left. Every piece keeps the path's appearance and is selected; one undo step; at most 100000 pieces (more is refused). The dialog takes lengths in any unit and previews on the canvas. Tests: `dashes::tests` in `vectorcraft-pathops` (exact and fitted lengths, curves measured along them, picked segments on open and closed paths, the piece cap and bad patterns), `divide_into_dashes_*` in `cmd::addons::pathtools::tests` in `vectorcraft-engine` (gaps removed or kept, fitted lengths, the stroke kept, one undo step, selected segments only, bad params and too many pieces refused), `divide_into_dashes_opens_its_dialog_previews_and_runs_on_ok` in `vectorcraft-ui-egui` and `command_sweep`. Commands: `docs/mcp.md` › Path Precision Tools add-on.