Shapes: addon.shapes commands refuse values outside their ranges

addon.shapes.polygon and addon.shapes.star rounded a fractional side or
point count and clamped it to 3..1000, so 2.5, 2 or 5000 drew a shape
with a different count than asked for. addon.shapes.configure read
sides only as an unsigned integer, ignored a fraction and cut a large
value to 32 bits before clamping it, so 4294967299 gave a triangle.

The commands now refuse a supplied value outside its range with an
error that names the parameter and the range, and draw or change
nothing; an omitted or null value still takes its default:

- sides and points: a whole number from 3 to 1000
- rounded and randomized: -10 to 10; spokeRatio: 0.01 to 1
- turns: 0.01 to 1024; divergence: 0 to 1000; innerRadius: 0 to 0.999
- width, height, radius and radius1: 0 or more (a negative size was
  made positive before, and a negative corner radius became 0)
- radius2: 0.01 to 1 times radius1 (the ratio was clamped before)
- radii: four numbers, each 0 or more (a malformed array was ignored)
- arcMode: whole, pie (slice), chord or arc (open); any other value
  drew a whole shape before

addon.shapes.configure checks every value before it changes any of the
selected shapes, keeps fitting a corner radius to half each rectangle's
shorter side, and records no undo step when no shape changes.

Docs: docs/mcp.md (3D Box and shapes add-on), docs/target-app-parity.md.
This commit is contained in:
dotCooCoo
2026-11-13 14:29:23 -08:00
parent 4558196e16
commit 12bc3a653d
27 changed files with 403 additions and 79 deletions
+26
View File
@@ -10872,6 +10872,32 @@ whole points and Escape cancels. A drag keeps a Contour's own corners and miter
options `corners` and `miterLimit` (`tool.setOption`). A border with a gap is two Contours of one shape (the gap first, so
it ends up in front), baked with `effect.expandAppearance`, then `object.pathfinder.minusFront`.
## 3D Box and shapes add-on
The `addon.shapes.*` commands draw rotatable 3D boxes (`addon.shapes.box3d`) and rectangles, ellipses, polygons, stars and
spirals that keep their settings (`addon.shapes.rectangle`, `ellipse`, `polygon`, `star`, `spiral`), and
`addon.shapes.configure` changes those settings on the selected shapes (or `ids`). An omitted or null value takes its
default. A value outside its range is an error that names the parameter and the range, and the command then draws or
changes nothing. The ranges are VectorCraft's own:
| Parameter | Commands | Range (default) |
|---|---|---|
| `width`, `height` | `rectangle`, `ellipse`, `box3d` | pt, 0 or more |
| `radius` | `polygon`, `spiral` | pt, 0 or more |
| `radius` (corners) | `rectangle`, `configure` | pt, 0 or more (0); `configure` fits a larger radius to half each rectangle's shorter side |
| `radii` | `rectangle`, `configure` | four numbers, 0 or more: `[tl, tr, br, bl]` |
| `radius1` | `star` | pt, 0 or more |
| `radius2` | `star` | 0.01 to 1 times `radius1` (half of it) |
| `sides`, `points` | `polygon`, `star`, `configure` (`sides`) | a whole number from 3 to 1000 (6 sides, 5 points) |
| `rounded`, `randomized` | `polygon`, `star`, `configure` | −10 to 10 (0) |
| `spokeRatio` | `configure` | 0.01 to 1 |
| `turns` | `spiral`, `configure` | 0.01 to 1024 (3) |
| `divergence` | `spiral`, `configure` | 0 to 1000 (1) |
| `innerRadius` | `spiral`, `configure` | 0 to 0.999 of the radius (0) |
| `arcMode` | `rectangle`, `ellipse`, `polygon`, `star`, `configure` | `whole`, `pie` (or `slice`), `chord`, `arc` (or `open`) (`whole`) |
A `configure` call that changes no shape records no undo step and returns `{updated: 0}`.
## Cutting Tools add-on
Cutting Tools is a built-in add-on that prepares art for cutting. Its commands are `addon.cutting.bridges` and
+9
View File
@@ -2031,6 +2031,15 @@ stored data), `cmd::addons::pathtools::tests` in `vectorcraft-engine` (each comm
anchor edits and transforms, the SVG export filter, the tool's gestures), `addons::pathtools::tests` in
`vectorcraft-ui-egui` (submenu and panel) and `command_sweep`.
The 3D Box and shapes add-on's commands (`addon.shapes.*`, 2026-11-13) refuse a value outside its range with an error
that names the parameter and the range, and draw or change nothing: polygon sides and star points are whole numbers
from 3 to 1,000 ([the help page](https://helpx.adobe.com/illustrator/desktop/draw-shapes-and-paths/modify-live-shapes/live-shape-properties.html)),
sizes and corner radii are not negative, a star's inner radius is 0.01 to 1 times its outer radius, and rounding,
randomizing, spoke ratio, spiral turns, divergence and inner radius keep VectorCraft's own ranges; `arcMode` takes
only the names it lists. `addon.shapes.configure` checks every value before it changes any selected shape and records
no undo step when nothing changes. Tests: `cmd::addons::shapes::tests` in `vectorcraft-engine`. Commands:
`docs/mcp.md` › 3D Box and shapes add-on.
The add-on's Corner Tool (2026-10-31) edits the Live Corners every path already keeps (no second corner store): hover
shows an anchor that can take a corner, a click cuts one with the tool's radius and kind (round, inverted, chamfer), a
drag sizes it (Shift: whole values), a cut corner's marker selects it and loads its values, resizes it, and removes it