Operações do BadBit CAD
cad.annotate.scale_text
Muda a altura de textos sem mover (SCALETEXT e TSCALE).
- Programa: BadBit CAD
- Tipo de ação: Altera o desenho
- Altera o desenho
- Desde a versão 2027.0.0-beta.8
Muda o tamanho dos textos ids com o ponto anchor parado (existing: o ponto de justificação de cada um, o padrão; ou um dos pontos da caixa). Dê um só: height (a altura no modelo; só os não anotativos mudam), paper_height (a altura no papel; só os anotativos), scale_factor (todos), final_height (a altura final de todos, como o TSCALE) ou match_text (a altura de outro texto, a opção Combinar objeto). Devolve o que mudou. Com objetos do papel, as coordenadas e as medidas são em mm (objetos do modelo e do papel no mesmo pedido são recusados); os ângulos e os fatores de escala não mudam.
Parâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
anchor | BaseSpec | Não | O ponto que fica parado em cada texto: existing (o de justificação) ou left, center, middle, right, top_left, top_center, top_right, middle_left, middle_center, middle_right, bottom_left, bottom_center, bottom_right. |
final_height | number | null | Não | A altura final de todos os textos. |
height | number | null | Não | A altura do texto; no zoom, a altura visível; nas imagens, a altura em pixels; na vista nomeada, em unidades do desenho; na janela de vista, a altura do modelo que ela mostra, em unidades do desenho. |
ids | array<string> | Sim | Identificadores de objetos (32 dígitos hexadecimais cada). |
match_text | string | null | Não | O identificador do texto cuja altura os outros copiam. |
paper_height | number | null | Não | A altura no papel (só os objetos anotativos mudam). |
scale_factor | number | null | Não | Fator de escala, maior que zero (2 dobra, 0.5 reduz à metade). |
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
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"arguments": {
"height": 0.25,
"ids": [
"0190f3a2b4c5d6e7f8091a2b3c4d5e6f"
]
},
"operation": "cad.annotate.scale_text"
},
"name": "badbit_call_operation"
}
}Python
import badbit
result = badbit.cad.annotate.scale_text(height=0.25, ids=["0190f3a2b4c5d6e7f8091a2b3c4d5e6f"])LISP
(badbit-call "cad.annotate.scale_text" '(("height" . 0.25) ("ids" . ("0190f3a2b4c5d6e7f8091a2b3c4d5e6f"))))JSON-RPC
{
"id": 1,
"jsonrpc": "2.0",
"method": "badbit/call",
"params": {
"arguments": {
"height": 0.25,
"ids": [
"0190f3a2b4c5d6e7f8091a2b3c4d5e6f"
]
},
"operation": "cad.annotate.scale_text"
}
}Comandos que fazem o mesmo
Esquema completo
JSON Schema 2020-12, com as descrições em inglês.
Parâmetros (entrada)
{
"$defs": {
"BaseSpec": {
"oneOf": [
{
"const": "existing",
"type": "string"
},
{
"const": "left",
"type": "string"
},
{
"const": "center",
"type": "string"
},
{
"const": "middle",
"type": "string"
},
{
"const": "right",
"type": "string"
},
{
"const": "top_left",
"type": "string"
},
{
"const": "top_center",
"type": "string"
},
{
"const": "top_right",
"type": "string"
},
{
"const": "middle_left",
"type": "string"
},
{
"const": "middle_center",
"type": "string"
},
{
"const": "middle_right",
"type": "string"
},
{
"const": "bottom_left",
"type": "string"
},
{
"const": "bottom_center",
"type": "string"
},
{
"const": "bottom_right",
"type": "string"
}
]
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"properties": {
"anchor": {
"$ref": "#/$defs/BaseSpec",
"description": "The point that stays fixed on each text: existing (the justification point) or left, center, middle, right, top_left, top_center, top_right, middle_left, middle_center, middle_right, bottom_left, bottom_center, bottom_right."
},
"final_height": {
"default": null,
"description": "The final height of all texts.",
"format": "double",
"type": [
"number",
"null"
]
},
"height": {
"default": null,
"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": "double",
"type": [
"number",
"null"
]
},
"ids": {
"description": "Object identifiers (32 hexadecimal digits each).",
"items": {
"type": "string"
},
"maxItems": 200000,
"minItems": 1,
"type": "array"
},
"match_text": {
"default": null,
"description": "The identifier of the text whose height the others copy.",
"type": [
"string",
"null"
]
},
"paper_height": {
"default": null,
"description": "The paper height (only annotative objects change).",
"format": "double",
"type": [
"number",
"null"
]
},
"scale_factor": {
"default": null,
"description": "Scale factor, greater than zero (2 doubles, 0.5 halves).",
"format": "double",
"type": [
"number",
"null"
]
}
},
"required": [
"ids"
],
"type": "object"
}Resultado (saída)
{
"$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"
},
"skipped_locked": {
"description": "Objects left as they were because they are on locked layers.",
"format": "uint",
"minimum": 0,
"type": "integer"
},
"truncated": {
"description": "The lists were cut at the limit.",
"type": "boolean"
}
},
"required": [
"created",
"modified",
"deleted",
"document_changed",
"truncated"
],
"type": "object"
}