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

Operaciones de BadBit CAD

cad.format.text_style

Crea o cambia un estilo de texto (STYLE).

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

Crea el estilo de texto name (a partir del actual) o cambia el que existe, como la ventana de STYLE: font (el archivo SHX o TrueType), height (0: TEXT pregunta), width_factor, oblique_angle (grados) y annotative. Los textos que usan el estilo se redibujan. set_current lo vuelve el actual. Devuelve si se creó y cuántos objetos cambiaron.

Parámetros

NombreTipoObligatorioDescripción
annotativeboolean | nullNoEl estilo es anotativo.
fontstring | nullNoLa fuente.
heightnumber | nullNoLa altura del texto; en el zoom, la altura visible; en las imágenes, la altura en píxeles; en la vista guardada, en unidades del dibujo; en la ventana gráfica, la altura del modelo que muestra, en unidades del dibujo.
namestringSíNombre (de la capa, de la variable de sistema o del comando, según la operación).
oblique_anglenumber | nullNoLa inclinación de las letras, en grados (-85 a 85).
set_currentbooleanNoVuelve el estilo el actual.
width_factornumber | nullNoEl factor de anchura de las letras (1 es la fuente tal como es).

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": {
        "font": "arial.ttf",
        "height": 0,
        "name": "Notas",
        "width_factor": 0.9
      },
      "operation": "cad.format.text_style"
    },
    "name": "badbit_call_operation"
  }
}

Python

Python
import badbit

result = badbit.cad.format.text_style(font="arial.ttf", height=0, name="Notas", width_factor=0.9)

LISP

LISP
(badbit-call "cad.format.text_style" '(("font" . "arial.ttf") ("height" . 0) ("name" . "Notas") ("width_factor" . 0.9)))

JSON-RPC

JSON
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "badbit/call",
  "params": {
    "arguments": {
      "font": "arial.ttf",
      "height": 0,
      "name": "Notas",
      "width_factor": 0.9
    },
    "operation": "cad.format.text_style"
  }
}

Comandos que hacen lo mismo

-STYLESTYLE

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": {
    "annotative": {
      "default": null,
      "description": "The style is annotative.",
      "type": [
        "boolean",
        "null"
      ]
    },
    "font": {
      "default": null,
      "description": "The font.",
      "type": [
        "string",
        "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"
      ]
    },
    "name": {
      "description": "Name (of the layer, of the system variable or of the command, depending on the operation).",
      "maxLength": 255,
      "minLength": 1,
      "type": "string"
    },
    "oblique_angle": {
      "default": null,
      "description": "The obliquing angle of the letters, in degrees (-85 to 85).",
      "format": "double",
      "type": [
        "number",
        "null"
      ]
    },
    "set_current": {
      "default": false,
      "description": "Makes the style the current one.",
      "type": "boolean"
    },
    "width_factor": {
      "default": null,
      "description": "The width factor of the letters (1 is the font as it is).",
      "format": "double",
      "type": [
        "number",
        "null"
      ]
    }
  },
  "required": [
    "name"
  ],
  "type": "object"
}
Resultado (salida)
JSON
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "is_current": {
      "description": "It is (or became) the current one.",
      "type": "boolean"
    },
    "style_created": {
      "description": "The style was created now (otherwise it already existed and changed).",
      "type": "boolean"
    },
    "updated_objects": {
      "description": "How many objects using the style were redrawn.",
      "format": "uint",
      "minimum": 0,
      "type": "integer"
    }
  },
  "required": [
    "style_created",
    "updated_objects",
    "is_current"
  ],
  "type": "object"
}
Buscar en la documentación