Board kit command
connector.getRoute
Connector route
Answers how connectors would be drawn, without changing the board: new ones between two ends, or stored ones with other ends, fields or elements moved; each with its route's corners, path, arrowheads, resolved ends, label place and the engine's SVG.
- Kit
- Board 0.1.0 (.kboard)
- Changes the document
- no
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
connectors | object[] | yes | The connectors to draw, at most 500: each a stored one (id) with what replaces its fields, or a new one between from and to |
move | object | no | Draw as if these elements (and what is inside them) were moved by delta, as element.move would move them |
Call through board_run
text
board_run {
"path": "<file>.kboard",
"steps": [{ "command": "connector.getRoute", "params": { "connectors": <object[]> } }]
}The required parameters, with placeholders for their types: not a tested example. Optional: move. board_run answers the step’s result in completed[i].result.
Result
| Name | Type | Required | Description |
|---|---|---|---|
connectors | object[] | yes | One answer per entry, in the order given |
Result JSON Schema
json
{
"additionalProperties": false,
"properties": {
"connectors": {
"description": "One answer per entry, in the order given",
"items": {
"additionalProperties": false,
"properties": {
"box": {
"description": "[x0, y0, x1, y1] the drawing covers",
"items": {
"type": "number"
},
"type": "array"
},
"end": {
"additionalProperties": false,
"properties": {
"binding": {
"additionalProperties": false,
"description": "The element the end is attached to and where on its box, absent for a free end",
"properties": {
"anchor": {
"items": {
"type": "number"
},
"type": "array"
},
"target": {
"type": "string"
}
},
"required": [
"anchor",
"target"
],
"type": "object"
},
"point": {
"description": "[x, y] where the end is drawn",
"items": {
"type": "number"
},
"type": "array"
}
},
"required": [
"point"
],
"type": "object"
},
"heads": {
"description": "The arrowheads drawn",
"items": {
"additionalProperties": false,
"properties": {
"direction": {
"description": "The unit direction the line arrives in, toward the tip",
"items": {
"type": "number"
},
"type": "array"
},
"end": {
"enum": [
"start",
"end"
],
"type": "string"
},
"halfWidth": {
"type": "number"
},
"kind": {
"type": "string"
},
"length": {
"type": "number"
},
"tip": {
"items": {
"type": "number"
},
"type": "array"
}
},
"required": [
"direction",
"end",
"halfWidth",
"kind",
"length",
"tip"
],
"type": "object"
},
"type": "array"
},
"id": {
"description": "The stored connector the entry named",
"type": "string"
},
"path": {
"description": "The SVG path data of the line through its route, arrowheads not trimmed off; empty when it has no length",
"type": "string"
},
"points": {
"description": "The corners the route turns at, start and end included ([x, y] each)",
"items": {
"items": {
"type": "number"
},
"type": "array"
},
"type": "array"
},
"start": {
"additionalProperties": false,
"properties": {
"binding": {
"additionalProperties": false,
"description": "The element the end is attached to and where on its box, absent for a free end",
"properties": {
"anchor": {
"items": {
"type": "number"
},
"type": "array"
},
"target": {
"type": "string"
}
},
"required": [
"anchor",
"target"
],
"type": "object"
},
"point": {
"description": "[x, y] where the end is drawn",
"items": {
"type": "number"
},
"type": "array"
}
},
"required": [
"point"
],
"type": "object"
},
"svg": {
"description": "The connector drawn as the board draws it, in world coordinates",
"type": "string"
},
"text": {
"description": "Where its label is laid out (elementSvg's text frame)"
}
},
"required": [
"box",
"heads",
"path",
"points",
"svg"
],
"type": "object"
},
"type": "array"
}
},
"required": [
"connectors"
],
"type": "object"
}Parameter schema
json
{
"additionalProperties": false,
"properties": {
"connectors": {
"description": "The connectors to draw, at most 500: each a stored one (id) with what replaces its fields, or a new one between from and to",
"items": {
"additionalProperties": false,
"properties": {
"endArrowhead": {
"description": "Arrowhead at the end",
"enum": [
"none",
"arrow",
"dot",
"triangle",
"triangle-open",
"diamond",
"diamond-open",
"circle-open",
"bar"
],
"type": "string"
},
"from": {
"additionalProperties": false,
"description": "The start (required without id): { element, anchor? } to attach to an element (anchor [0..1, 0..1] on its box, the nearest edge when absent), or { point: [x, y] }",
"properties": {
"anchor": {
"description": "[x, y] on the element's box, clamped to 0 to 1",
"oneOf": [
{
"items": {
"description": "One component",
"maximum": 1000000,
"minimum": -1000000,
"type": "number"
},
"type": "array"
},
{
"additionalProperties": false,
"properties": {
"x": {
"description": "One component",
"maximum": 1000000,
"minimum": -1000000,
"type": "number"
},
"y": {
"description": "One component",
"maximum": 1000000,
"minimum": -1000000,
"type": "number"
}
},
"required": [
"x",
"y"
],
"type": "object"
}
]
},
"element": {
"description": "The element to attach to",
"type": "string",
"x-khp-role": "object",
"x-khp-types": [
"Element"
]
},
"point": {
"description": "A free end at [x, y]",
"oneOf": [
{
"items": {
"description": "One component",
"maximum": 1000000,
"minimum": -1000000,
"type": "number"
},
"type": "array"
},
{
"additionalProperties": false,
"properties": {
"x": {
"description": "One component",
"maximum": 1000000,
"minimum": -1000000,
"type": "number"
},
"y": {
"description": "One component",
"maximum": 1000000,
"minimum": -1000000,
"type": "number"
}
},
"required": [
"x",
"y"
],
"type": "object"
}
]
}
},
"type": "object"
},
"id": {
"description": "A connector to start from: its stored ends, fields and label, each replaced by what the entry gives (from or to alone moves that end, as connector.bind)",
"type": "string",
"x-khp-role": "object",
"x-khp-types": [
"Element"
]
},
"label": {
"description": "The label",
"type": "string"
},
"labelPosition": {
"description": "Where the label sits along the route, 0 to 1",
"maximum": 1,
"minimum": 0,
"type": "number"
},
"startArrowhead": {
"description": "Arrowhead at the start",
"enum": [
"none",
"arrow",
"dot",
"triangle",
"triangle-open",
"diamond",
"diamond-open",
"circle-open",
"bar"
],
"type": "string"
},
"style": {
"additionalProperties": false,
"description": "The connector's style",
"properties": {
"connectorType": {
"description": "Connector route",
"enum": [
"straight",
"elbow",
"curved"
],
"type": "string"
},
"dashStyle": {
"description": "Line dashes",
"enum": [
"solid",
"dashed",
"dotted"
],
"type": "string"
},
"endArrowhead": {
"description": "Arrowhead at the end",
"enum": [
"none",
"arrow",
"dot",
"triangle",
"triangle-open",
"diamond",
"diamond-open",
"circle-open",
"bar"
],
"type": "string"
},
"opacity": {
"description": "0 to 1",
"maximum": 1,
"minimum": 0,
"type": "number"
},
"startArrowhead": {
"description": "Arrowhead at the start",
"enum": [
"none",
"arrow",
"dot",
"triangle",
"triangle-open",
"diamond",
"diamond-open",
"circle-open",
"bar"
],
"type": "string"
},
"strokeColor": {
"description": "Line or text colour: one of ink, gray, purple, green, orange, red, yellow, blue, white or #rrggbb",
"type": "string"
},
"strokeSize": {
"description": "Line weight",
"enum": [
"s",
"m",
"l",
"xl"
],
"type": "string"
}
},
"type": "object"
},
"to": {
"additionalProperties": false,
"description": "The end (required without id): { element, anchor? } to attach to an element (anchor [0..1, 0..1] on its box, the nearest edge when absent), or { point: [x, y] }",
"properties": {
"anchor": {
"description": "[x, y] on the element's box, clamped to 0 to 1",
"oneOf": [
{
"items": {
"description": "One component",
"maximum": 1000000,
"minimum": -1000000,
"type": "number"
},
"type": "array"
},
{
"additionalProperties": false,
"properties": {
"x": {
"description": "One component",
"maximum": 1000000,
"minimum": -1000000,
"type": "number"
},
"y": {
"description": "One component",
"maximum": 1000000,
"minimum": -1000000,
"type": "number"
}
},
"required": [
"x",
"y"
],
"type": "object"
}
]
},
"element": {
"description": "The element to attach to",
"type": "string",
"x-khp-role": "object",
"x-khp-types": [
"Element"
]
},
"point": {
"description": "A free end at [x, y]",
"oneOf": [
{
"items": {
"description": "One component",
"maximum": 1000000,
"minimum": -1000000,
"type": "number"
},
"type": "array"
},
{
"additionalProperties": false,
"properties": {
"x": {
"description": "One component",
"maximum": 1000000,
"minimum": -1000000,
"type": "number"
},
"y": {
"description": "One component",
"maximum": 1000000,
"minimum": -1000000,
"type": "number"
}
},
"required": [
"x",
"y"
],
"type": "object"
}
]
}
},
"type": "object"
},
"type": {
"description": "The route",
"enum": [
"straight",
"elbow",
"curved"
],
"type": "string"
},
"waypoints": {
"description": "Bends in path order",
"items": {
"items": {
"description": "Coordinate",
"maximum": 1000000,
"minimum": -1000000,
"type": "number"
},
"type": "array"
},
"type": "array"
}
},
"type": "object"
},
"type": "array"
},
"move": {
"additionalProperties": false,
"description": "Draw as if these elements (and what is inside them) were moved by delta, as element.move would move them",
"properties": {
"delta": {
"description": "[dx, dy] they are moved by",
"oneOf": [
{
"items": {
"description": "One component",
"maximum": 1000000,
"minimum": -1000000,
"type": "number"
},
"type": "array"
},
{
"additionalProperties": false,
"properties": {
"x": {
"description": "One component",
"maximum": 1000000,
"minimum": -1000000,
"type": "number"
},
"y": {
"description": "One component",
"maximum": 1000000,
"minimum": -1000000,
"type": "number"
}
},
"required": [
"x",
"y"
],
"type": "object"
}
]
},
"ids": {
"description": "The elements taken as moved",
"items": {
"type": "string"
},
"type": "array",
"x-khp-role": "object",
"x-khp-types": [
"Element"
]
}
},
"required": [
"delta",
"ids"
],
"type": "object"
}
},
"required": [
"connectors"
],
"type": "object"
}Generated from the command list of @kition/[email protected] and the kit itself (board_commands through @kition/[email protected], built from KitionAI/kition-board@e78c190). As data: commands.jsonl.