Operações do BadBit CAD
cad.layout.viewport
Muda a escala, o centro, a trava ou o ligar de janelas de vista.
- Programa: BadBit CAD
- Tipo de ação: Altera o desenho
- Altera o desenho
- Desde a versão 2027.0.0-beta.8
Nas janelas de vista ids: scale (o denominador: 50 é 1:50), view_center (o ponto do modelo no centro), locked (MVIEW Travar) e on (MVIEW Ligada ou Desligada). Um passo do desfazer. Devolve o que mudou. Uma janela só, com a escala em texto ou pela altura: cad.viewport.modify.
Parâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
ids | array<string> | Sim | Identificadores de objetos (32 dígitos hexadecimais cada). |
locked | boolean | null | Não | Travada: na camada, mostrada mas sem mudar os objetos; na janela de vista, a escala e a vista não mudam. |
on | boolean | null | Não | Ligada: a camada (desligada, os objetos não aparecem) ou a janela de vista (desligada, não mostra o modelo). |
scale | number | null | Não | A escala: de uma inserção, a mesma em X e Y; de uma janela de vista, o denominador (50 é 1:50) ou, no cad.viewport.modify, também o texto ("1:50", "2:1"). |
view_center | array<number> | null | Não | O ponto do modelo no centro da janela de vista. |
Erros
| Código | JSON-RPC | O que significa |
|---|---|---|
invalid_params | -32602 | Os parâmetros não seguem o esquema ou uma regra da operação. |
not_found | -32001 | O objeto, a operação, o arquivo ou o nome não existe. |
conflict | -32004 | O estado atual não permite isso agora. |
failed | -32005 | A operação falhou. |
Exemplo
MCP
JSON
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"arguments": {
"ids": [
"0190f3a2b4c5d6e7f8091a2b3c4d5e6f"
],
"scale": 100,
"view_center": [
5000,
3000
]
},
"operation": "cad.layout.viewport"
},
"name": "badbit_call_operation"
}
}Python
Python
import badbit
result = badbit.cad.layout.viewport(ids=["0190f3a2b4c5d6e7f8091a2b3c4d5e6f"], scale=100, view_center=[5000, 3000])LISP
LISP
(badbit-call "cad.layout.viewport" '(("ids" . ("0190f3a2b4c5d6e7f8091a2b3c4d5e6f")) ("scale" . 100) ("view_center" . (5000 3000))))JSON-RPC
JSON
{
"id": 1,
"jsonrpc": "2.0",
"method": "badbit/call",
"params": {
"arguments": {
"ids": [
"0190f3a2b4c5d6e7f8091a2b3c4d5e6f"
],
"scale": 100,
"view_center": [
5000,
3000
]
},
"operation": "cad.layout.viewport"
}
}Esquema completo
JSON Schema 2020-12, com as descrições em inglês.
Parâmetros (entrada)
JSON
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"properties": {
"ids": {
"description": "Object identifiers (32 hexadecimal digits each).",
"items": {
"type": "string"
},
"maxItems": 10000,
"minItems": 1,
"type": "array"
},
"locked": {
"default": null,
"description": "Locked: for a layer, shown but its objects cannot be changed; for a layout viewport, its scale and view cannot change.",
"type": [
"boolean",
"null"
]
},
"on": {
"default": null,
"description": "Turned on: the layer (off: its objects are not shown) or the layout viewport (off: it does not show the model).",
"type": [
"boolean",
"null"
]
},
"scale": {
"default": null,
"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",
"null"
]
},
"view_center": {
"default": null,
"description": "The model point at the center of the layout viewport.",
"items": {
"format": "double",
"type": "number"
},
"maxItems": 2,
"minItems": 2,
"type": [
"array",
"null"
]
}
},
"required": [
"ids"
],
"type": "object"
}Resultado (saída)
JSON
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"created": {
"description": "Identifiers of the objects created.",
"items": {
"type": "string"
},
"type": "array"
},
"deleted": {
"description": "The identifiers of what was deleted.",
"items": {
"type": "string"
},
"type": "array"
},
"document_changed": {
"description": "The drawing on screen is another one (opened, closed or changed tab): the lists of changes do not apply.",
"type": "boolean"
},
"modified": {
"description": "Whether there are unsaved changes; in results of changes, the identifiers of the objects changed.",
"items": {
"type": "string"
},
"type": "array"
},
"truncated": {
"description": "The lists were cut at the limit.",
"type": "boolean"
}
},
"required": [
"created",
"modified",
"deleted",
"document_changed",
"truncated"
],
"type": "object"
}