Create polygon
create_polygonConstruct a closed polygon from a set of points. Optionally set fill, stroke, and stroke width. Returns the new polygon's ID and bounding box.
Instructions
Create a closed <polygon> from points (≥ 1 (x, y) pairs).
When to use: a closed many-sided shape (triangle, hexagon, ...). For an OPEN run use
create_polyline; for curves use create_path.
Key params: points ≥ 1 (x, y) pairs; inserted into parent_id (must exist) or the document
default parent; object_id to pin the id. Optional fill / stroke / stroke_width
paint it in this call (validated like set_fill / set_stroke; default None = unpainted).
Return shape: CreateResult — object_id (new id), analytic bbox (extent of the points),
plus the pipeline fields (operation_id, snapshot_id, changed, preview).
Example: create_polygon(doc_id, [(0, 0), (50, 0), (25, 40)], fill="#fc0")
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 |
|---|---|---|---|
| fill | No | ||
| doc_id | Yes | ||
| points | 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 |