Create rectangle
create_rectInsert a rectangle into the document at specified x, y coordinates with width, height, and optional corner radii. Supports fill and stroke styling in one step.
Instructions
Create a <rect> at (x, y) sized width / height (> 0), with optional corner radii.
When to use: drawing a rectangle / square / box. For an ellipse use create_circle /
create_ellipse; for a freeform shape use create_path.
Key params: width / height > 0; rx / ry optional corner radii; inserted into parent_id
(must exist) or the document default parent (first layer, else root); object_id to pin the id.
Optional fill / stroke / stroke_width paint the shape IN THIS CALL — validated
exactly like set_fill / set_stroke (colour or url(#id); CSS length) — so no mandatory
second styling call (default None = unpainted, prior behaviour).
Return shape: CreateResult — object_id (new id), analytic bbox, plus the pipeline fields
(operation_id, snapshot_id, changed, before/after preview).
Example: create_rect(doc_id, 10, 10, 100, 60, rx=8, fill="#3366cc")
Render and look before you trust this edit: render with render_preview (or live_render_view)
and inspect the result before relying on it; restore_snapshot reverts it if it is wrong.
Risk class: medium (reversible write-new on the working copy; original untouched).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | ||
| y | Yes | ||
| rx | No | ||
| ry | No | ||
| fill | No | ||
| width | Yes | ||
| doc_id | Yes | ||
| height | Yes | ||
| stroke | No | ||
| object_id | No | ||
| parent_id | No | ||
| stroke_width | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bbox | No | ||
| doc_id | Yes | ||
| changed | Yes | ||
| summary | No | ||
| object_id | Yes | ||
| snapshot_id | Yes | ||
| operation_id | Yes | ||
| preview_after | No | ||
| preview_before | No |