sketch_add_rectangle
Add a rectangle to a FreeCAD sketch from bottom-left and top-right XY coordinates, creating four coincident, horizontal/vertical-constrained lines and returning their geometry indices.
Instructions
Add a rectangle to a sketch (4 lines with coincident + H/V constraints).
(x1,y1) is bottom-left, (x2,y2) is top-right corner.
Returns geometry indices of the 4 lines.Contract: explicit internal names recommended. Length mm, area mm^2, volume mm^3; field units override defaults. Errors: invalid_arguments, document_not_found, object_not_found, transaction_conflict, operation_failed, execution_timeout; transport failures are possible. Timeout is not cancellation: never blindly retry mutations. Legacy return shape preserved.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"sketch_name": "<sketch_name>",
"x1": "<x1>",
"y1": "<y1>",
"x2": "<x2>",
"y2": "<y2>"
},
"name": "sketch_add_rectangle"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x1 | Yes | x1: mm, sketch_local_xy. | |
| x2 | Yes | x2: mm, sketch_local_xy. | |
| y1 | Yes | y1: mm, sketch_local_xy. | |
| y2 | Yes | y2: mm, sketch_local_xy. | |
| doc_name | No | Internal document Name, never Label/path. Omitted/null uses active document (legacy); pass explicitly. | |
| sketch_name | Yes | Internal object Name in the selected document, never Label; must have the type required by this tool. | |
| construction | No | True creates sketch construction geometry; false creates profile geometry. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |