Design kit command

node.add

Create layer

Creates a layer of a type (rectangle, ellipse, polygon, star, line, arrow, vector, text, frame, section, component, slice) at x, y in a parent with properties; answers its id.

Kit
Design 0.1.0 (.kdesign)
Changes the document
yes

Parameters

Parameters of node.add
NameTypeRequiredDescription
charactersstringno
closedbooleannovector points: a closed shape
heightnumberno
indexintegernoa position counted from 0 (the first is 0)
namestringno
parentinteger | stringnoan id (a number, or its digits as text)
pathstringnoSVG path data for vector
pointsnumber[][]novector: instead of path
propsobjectno
selectbooleanno
textstringnofor text
type"rectangle" | "ellipse" | "polygon" | "star" | "line" | "arrow" | "vector" | "text" | "frame" | "section" | "component" | "slice"no
widthnumberno
xnumberno
ynumbernorelative to the parent frame; groups don't count

Call through design_run

text
design_run {
  "path": "<file>.kdesign",
  "steps": [{ "command": "node.add" }]
}

The required parameters, with placeholders for their types: not a tested example. Optional: characters, closed, height, index, name, parent, path, points, props, select, text, type, width, x, y. design_run answers the step’s result in completed[i].result.

Result

The kit gives no result schema for this command.

Parameter schema

json
{
  "additionalProperties": false,
  "properties": {
    "characters": {
      "type": "string"
    },
    "closed": {
      "description": "vector points: a closed shape",
      "type": "boolean"
    },
    "height": {
      "type": "number"
    },
    "index": {
      "description": "a position counted from 0 (the first is 0)",
      "type": "integer"
    },
    "name": {
      "type": "string"
    },
    "parent": {
      "description": "an id (a number, or its digits as text)",
      "oneOf": [
        {
          "type": "integer"
        },
        {
          "type": "string"
        }
      ],
      "x-khp-types": [
        "Node"
      ]
    },
    "path": {
      "description": "SVG path data for vector",
      "type": "string"
    },
    "points": {
      "description": "vector: instead of path",
      "items": {
        "items": {
          "type": "number"
        },
        "type": "array"
      },
      "type": "array"
    },
    "props": {
      "additionalProperties": true,
      "type": "object"
    },
    "select": {
      "type": "boolean"
    },
    "text": {
      "description": "for text",
      "type": "string"
    },
    "type": {
      "enum": [
        "rectangle",
        "ellipse",
        "polygon",
        "star",
        "line",
        "arrow",
        "vector",
        "text",
        "frame",
        "section",
        "component",
        "slice"
      ],
      "type": "string"
    },
    "width": {
      "type": "number"
    },
    "x": {
      "type": "number"
    },
    "y": {
      "description": "relative to the parent frame; groups don't count",
      "type": "number"
    }
  },
  "type": "object"
}

Generated from the command list of @kition/[email protected] and the kit itself (design_commands through @kition/[email protected], built from KitionAI/kition-design@abc7e16). As data: commands.jsonl.