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

Operaciones de la suite

suite.view.capture

Imagen (PNG) de la vista, de la extensión o de una ventana, para comprobar el resultado.

  • Programa: Todos los programas
  • Tipo de acción: Lee el dibujo
  • Solo lectura
  • Desde la versión 2027.0.0-beta.6

Dibuja el área elegida en una imagen PNG (hasta 2048 píxeles de anchura) con el mismo dibujo del trazado, sin tarjeta gráfica, y la devuelve en Base64. Úsela para mirar lo dibujado. La altura sigue la forma del área. Con una presentación a la vista, la imagen es su hoja con las ventanas gráficas (window y area en mm del papel); layout elige otra presentación o "Model" (fuera de la pantalla, el área view pasa a ser la extensión). Las ventanas gráficas de cada presentación salen en cad.layout.list. Dentro de una ventana gráfica (MSPACE), el área view es la parte de la hoja que ocupa, con lo que muestra del modelo ahora; viewport (el identificador) captura así una ventana gráfica de cualquier presentación. En esos dos casos la respuesta trae viewport con la parte del modelo que muestra (model_area, en unidades del dibujo) y la escala. Los tipos de línea siguen el LTSCALE al instante; un trazo discontinuo que se repetiría más de 4000 veces en un tramo sale continuo (demasiado denso para verse): aumente el LTSCALE.

Herramienta MCP
badbit_view_capture

Parámetros

NombreTipoObligatorioDescripción
areaCaptureAreaNoEl área: en una medida, el valor (en unidades² del dibujo); en una captura, lo que se convierte en imagen: view (lo que está en pantalla, por defecto), extents (todo lo dibujado) o window.
layoutstring | nullNoLa presentación (por nombre; "Model" es el modelo).
viewportstring | nullNoEl identificador de la ventana gráfica de la presentación.
widthinteger | nullNoEl ancho: de la imagen, en píxeles (64 a 2048, por defecto 1024); de la vista guardada, en unidades del dibujo.
windowarray<number> | nullNoVentana [xmin, ymin, xmax, ymax] en unidades del dibujo (en el papel de una presentación, en mm).

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.
failed-32005La operación falló.

Ejemplo

MCP

JSON
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "area": "extents",
      "width": 800
    },
    "name": "badbit_view_capture"
  }
}

Python

Python
import badbit

result = badbit.suite.view.capture(area="extents", width=800)

LISP

LISP
(badbit-call "suite.view.capture" '(("area" . "extents") ("width" . 800)))

JSON-RPC

JSON
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "badbit/call",
  "params": {
    "arguments": {
      "area": "extents",
      "width": 800
    },
    "operation": "suite.view.capture"
  }
}

Comandos que hacen lo mismo

PREVIEW

Esquema completo

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

Parámetros (entrada)
JSON
{
  "$defs": {
    "CaptureArea": {
      "oneOf": [
        {
          "const": "view",
          "type": "string"
        },
        {
          "const": "extents",
          "type": "string"
        },
        {
          "const": "window",
          "type": "string"
        }
      ]
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "area": {
      "$ref": "#/$defs/CaptureArea",
      "description": "The area: in a measurement, the value (in square drawing units); in a capture, what becomes the image: view (what is on screen, the default), extents (everything drawn) or window."
    },
    "layout": {
      "default": null,
      "description": "The layout (by name; \"Model\" is model space).",
      "maxLength": 256,
      "minLength": 1,
      "type": [
        "string",
        "null"
      ]
    },
    "viewport": {
      "default": null,
      "description": "The identifier of the layout viewport.",
      "type": [
        "string",
        "null"
      ]
    },
    "width": {
      "default": null,
      "description": "The width: of an image, in pixels (64 to 2048, default 1024); of a named view, in drawing units.",
      "format": "uint32",
      "maximum": 2048,
      "minimum": 64,
      "type": [
        "integer",
        "null"
      ]
    },
    "window": {
      "default": null,
      "description": "Window [xmin, ymin, xmax, ymax] in drawing units (in the paper space of a layout, in mm).",
      "items": {
        "format": "double",
        "type": "number"
      },
      "maxItems": 4,
      "minItems": 4,
      "type": [
        "array",
        "null"
      ]
    }
  },
  "type": "object"
}
Resultado (salida)
JSON
{
  "$defs": {
    "CapturedViewport": {
      "properties": {
        "id": {
          "description": "Object identifier (32 hexadecimal digits), or command identifier in the command list.",
          "type": "string"
        },
        "model_area": {
          "description": "The part of the model the viewport shows [xmin, ymin, xmax, ymax], in drawing units.",
          "items": {
            "format": "double",
            "type": "number"
          },
          "maxItems": 4,
          "minItems": 4,
          "type": "array"
        },
        "scale": {
          "description": "The scale: of an insertion, the same in X and Y; of a layout viewport, the denominator (50 is 1:50) or, in cad.viewport.modify, also the text (\"1:50\", \"2:1\").",
          "format": "double",
          "type": "number"
        }
      },
      "required": [
        "id",
        "model_area",
        "scale"
      ],
      "type": "object"
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "area": {
      "description": "The area: in a measurement, the value (in square drawing units); in a capture, what becomes the image: view (what is on screen, the default), extents (everything drawn) or window.",
      "items": {
        "format": "double",
        "type": "number"
      },
      "maxItems": 4,
      "minItems": 4,
      "type": "array"
    },
    "data": {
      "description": "The PNG image in Base64.",
      "type": "string"
    },
    "height": {
      "description": "Text height; in zoom, the visible height; in images, the height in pixels; in a named view, in drawing units; in a layout viewport, the height of the model it shows, in drawing units.",
      "format": "uint32",
      "minimum": 0,
      "type": "integer"
    },
    "mime": {
      "description": "Type of the image (image/png).",
      "type": "string"
    },
    "viewport": {
      "anyOf": [
        {
          "$ref": "#/$defs/CapturedViewport"
        },
        {
          "type": "null"
        }
      ],
      "description": "The identifier of the layout viewport."
    },
    "width": {
      "description": "The width: of an image, in pixels (64 to 2048, default 1024); of a named view, in drawing units.",
      "format": "uint32",
      "minimum": 0,
      "type": "integer"
    }
  },
  "required": [
    "mime",
    "width",
    "height",
    "area",
    "data"
  ],
  "type": "object"
}
Buscar en la documentación