Saltar al contenido
BadBit Documentación
Iniciar sesión Descargar la beta

Operaciones de BadBit CAD

cad.draw.ray

Dibuja semirrectas (RAY) desde un punto.

  • Programa: BadBit CAD
  • Tipo de acción: Cambia el dibujo
  • Modifica el dibujo
  • Desde la versión 2027.0.0-beta.8

Crea una semirrecta (infinita hacia un lado) de start pasando por cada punto de through, como RAY. Devuelve los identificadores en orden. En el papel (una presentación a la vista, fuera de las ventanas gráficas), las coordenadas y las medidas son en mm; los ángulos y los factores de escala no cambian.

Parámetros

NombreTipoObligatorioDescripción
layerstring | nullNoNombre de la capa.
startarray<number>SíPunto inicial [x, y] de una línea.
througharray<array<number>>SíLos puntos [[x, y], …] por donde pasa cada línea.

Errores

CódigoJSON-RPCQué significa
invalid_params-32602Los parámetros no siguen el esquema o una regla de la operación.
not_found-32001El objeto, la operación, el archivo o el nombre no existe.
conflict-32004El estado actual no lo permite ahora.
failed-32005La operación falló.

Ejemplo

MCP

JSON
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "arguments": {
        "start": [
          0,
          0
        ],
        "through": [
          [
            10,
            10
          ]
        ]
      },
      "operation": "cad.draw.ray"
    },
    "name": "badbit_call_operation"
  }
}

Python

Python
import badbit

result = badbit.cad.draw.ray(start=[0, 0], through=[[10, 10]])

LISP

LISP
(badbit-call "cad.draw.ray" '(("start" . (0 0)) ("through" . ((10 10)))))

JSON-RPC

JSON
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "badbit/call",
  "params": {
    "arguments": {
      "start": [
        0,
        0
      ],
      "through": [
        [
          10,
          10
        ]
      ]
    },
    "operation": "cad.draw.ray"
  }
}

Comandos que hacen lo mismo

RAY

Esquema completo

JSON Schema 2020-12, con las descripciones en inglés.

Parámetros (entrada)
JSON
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "layer": {
      "default": null,
      "description": "Layer name.",
      "type": [
        "string",
        "null"
      ]
    },
    "start": {
      "description": "Start point [x, y] of a line.",
      "items": {
        "format": "double",
        "type": "number"
      },
      "maxItems": 2,
      "minItems": 2,
      "type": "array"
    },
    "through": {
      "description": "The points [[x, y], …] each line passes through.",
      "items": {
        "items": {
          "format": "double",
          "type": "number"
        },
        "maxItems": 2,
        "minItems": 2,
        "type": "array"
      },
      "maxItems": 10000,
      "minItems": 1,
      "type": "array"
    }
  },
  "required": [
    "start",
    "through"
  ],
  "type": "object"
}
Resultado (salida)
JSON
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "ids": {
      "description": "Object identifiers (32 hexadecimal digits each).",
      "items": {
        "type": "string"
      },
      "type": "array"
    }
  },
  "required": [
    "ids"
  ],
  "type": "object"
}
Buscar en la documentación