CAD kit command

viewport.set

Viewport Properties

Sets layout viewport properties: scale, view height and centre, lock, layer freeze and thaw, and per-layer colour overrides.

Kit
CAD 0.1.0 (.dxf)
Changes the document
yes
Acts on
handles (a list of ids), which a run step’s on fills

Parameters

Parameters of viewport.set
NameTypeRequiredDescription
aperturenumbernoPick reach in drawing units; default 0.5% of the space extents.
centernumber[]no
colorsobjectno{layer: color | null}
freezeany[]no[layer]
handlestringno
handlesstring[]no
lockedbooleanno
picknumber[]noInstead of handles: a drawing-space point [x,y], picked by the engine in the call's layout. With basis, holds what was at that point.
scalenumber | string | number[]no
thawany[]no[layer]
viewHeightnumberno

Call through cad_run

text
cad_run {
  "path": "<file>.dxf",
  "steps": [{ "command": "viewport.set" }]
}

The required parameters, with placeholders for their types: not a tested example. Optional: aperture, center, colors, freeze, handle, handles, locked, pick, scale, thaw, viewHeight. cad_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": {
    "aperture": {
      "description": "Pick reach in drawing units; default 0.5% of the space extents.",
      "type": "number"
    },
    "center": {
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "colors": {
      "additionalProperties": true,
      "description": "{layer: color | null}",
      "properties": {
        "layer": {
          "description": "color | null"
        }
      },
      "type": "object"
    },
    "freeze": {
      "description": "[layer]",
      "items": {
        "x-khp-name": "name",
        "x-khp-role": "object",
        "x-khp-types": [
          "Layer"
        ]
      },
      "type": "array"
    },
    "handle": {
      "type": "string",
      "x-khp-types": [
        "Entity"
      ]
    },
    "handles": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "x-khp-types": [
        "Entity"
      ]
    },
    "locked": {
      "type": "boolean"
    },
    "pick": {
      "description": "Instead of handles: a drawing-space point [x,y], picked by the engine in the call's layout. With basis, holds what was at that point.",
      "items": {
        "type": "number"
      },
      "type": "array"
    },
    "scale": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "string"
        },
        {
          "items": {
            "type": "number"
          },
          "type": "array"
        }
      ]
    },
    "thaw": {
      "description": "[layer]",
      "items": {
        "x-khp-name": "name",
        "x-khp-role": "object",
        "x-khp-types": [
          "Layer"
        ]
      },
      "type": "array"
    },
    "viewHeight": {
      "type": "number"
    }
  },
  "type": "object"
}

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