OpenCalque

v2.8.1
io.github.laurent512/opencalque Checked 1 hour ago Published 2 hours ago

Draw 2D floor plans as JSON: walls, doors, rooms, furniture.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

read_guide

Explains how drawings are stored and edited: the types of node, the parametric objects there are, the operations, and what is not obvious from the schema. Read it once before your first edit. With "type", returns the JSON Schema of that type of node instead.

ParameterTypeDescription
typestringA type of node, such as wall or room, to get its JSON Schema.

open_drawing

Chooses the drawing the other tools work on: a .opencalque file. It is created, empty, when it does not exist and "create" is true. Use an absolute path.

ParameterTypeDescription
file *stringPath of the drawing.
createbooleanCreate it when it does not exist.

apply_operations

Changes the drawing. Takes a list of operations and applies them in order as a single edit. The list is all-or-nothing: if any operation is invalid nothing changes and the error is returned so you can correct it. Returns the ids of the nodes that were added, lists any property you wrote that the format does not know (usually a misspelling), which was kept but has no effect, and under "problems" what the edit left wrong: a room that does not close and the wall end that may be why, walls drawn over each other, a door outside its wall.

read_document

Returns the current drawing as JSON: its layers, shared colours, materials, dimension styles and nodes. Pass "ids" to get only those nodes, with everything inside the groups among them, or "container" (a page, component or group id) to get what it holds. Use it when the drawing was too large to include with the request, or to check the result of an edit.

ParameterTypeDescription
containerstringId of a page, component or group.
idsarrayIds of the nodes to read.

describe_drawing

Returns a short summary of the drawing: its name, layers, pages and components with what each holds, and what is being worked on and selected. Start here when you do not know the drawing: it is much smaller than read_document.

view_image

Shows you a picture placed in the drawing, such as an imported floor plan, together with where it sits so you can convert positions in the picture to drawing coordinates.

ParameterTypeDescription
node *stringId of the image node.

view_drawing

Shows you the drawing as it is printed: a picture of a page or component, or of part of it, and which coordinates it covers. Use it to check what you drew, and "area" to look closer at a corner or a room.

ParameterTypeDescription
areaobjectThe part to show, in drawing millimetres. Leave it out for everything on the page.
pagestringId of a page or component. Leave it out for the one being worked on.

measure_drawing

Returns what a page holds, measured from what is drawn: each room with its floor area and perimeter, each wall with its length, doors and windows by size, floors and walls by material, and objects placed. Areas are in m², lengths in m, volumes in m³, thicknesses and the sizes of doors and windows in mm. A room whose walls do not close has an area of 0.

ParameterTypeDescription
ofarrayWhich parts to return. Leave it out for all of them.
pagestringId of a page or component. Leave it out for the one being worked on.

check_drawing

Lists what is wrong with a page, whoever did it: rooms that have no floor, with the wall ends that may be why, rooms that share one, walls drawn over each other, doors and windows outside a wall, past its end or over one another. Each problem says what to do about it.

ParameterTypeDescription
pagestringId of a page or component. Leave it out for the whole drawing.

read_controls

Says what controls what on a page, from its control links: each switch, dimmer or push button with the lights and sockets it controls, and through which of its ports; the objects that need control and have none (lights no switch turns on), under "uncontrolled"; and those that control nothing, under "idle". It describes the plan, it does not check an installation against any rule.

ParameterTypeDescription
pagestringId of a page or component. Leave it out for the one being worked on.