Pular para o conteúdo
BadBit Documentação
Entrar Baixar o beta

Operações da suíte

suite.view.capture

Imagem (PNG) da vista, da extensão ou de uma janela, para conferir o resultado.

  • Programa: Todos os programas
  • Tipo de ação: Lê o desenho
  • Só leitura
  • Desde a versão 2027.0.0-beta.6

Desenha a área escolhida numa imagem PNG (até 2048 pixels de largura) com o mesmo desenho da plotagem, sem placa de vídeo, e devolve em Base64. Use para olhar o que foi desenhado. A altura segue o formato da área. Com um layout à vista, a imagem é a folha dele com as janelas de vista (as medidas de window e de area em mm do papel); layout escolhe outro layout ou "Model" (fora da tela, a área view vira a extensão). As janelas de vista de cada layout saem em cad.layout.list. Dentro de uma janela de vista (MSPACE), a área view é a parte da folha que ela ocupa, com o que ela mostra do modelo agora; viewport (o identificador) captura assim uma janela de vista de qualquer layout. Nesses dois casos a resposta traz viewport com a parte do modelo que ela mostra (model_area, em unidades do desenho) e a escala. Os tipos de linha seguem o LTSCALE na hora; um tracejado que se repetiria mais de 4000 vezes num trecho sai contínuo (denso demais para se ver): aumente o LTSCALE.

Ferramenta MCP
badbit_view_capture

Parâmetros

NomeTipoObrigatórioDescrição
areaCaptureAreaNãoA área: numa medida, o valor (em unidade² do desenho); na captura, o que vira imagem: view (o que está na tela, o padrão), extents (tudo o que está desenhado) ou window.
layoutstring | nullNãoO layout (pelo nome; "Model" é o modelo).
viewportstring | nullNãoO identificador da janela de vista do layout.
widthinteger | nullNãoA largura: da imagem, em pixels (64 a 2048, padrão 1024); da vista nomeada, em unidades do desenho.
windowarray<number> | nullNãoJanela [xmin, ymin, xmax, ymax] em unidades do desenho (no papel de um layout, em mm).

Erros

CódigoJSON-RPCO que significa
invalid_params-32602Os parâmetros não seguem o esquema ou uma regra da operação.
not_found-32001O objeto, a operação, o arquivo ou o nome não existe.
failed-32005A operação falhou.

Exemplo

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 fazem o mesmo

PREVIEW

Esquema completo

JSON Schema 2020-12, com as descrições em 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 (saída)
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 na documentação