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

Operaciones de BadBit CAD

cad.annotate.dim_linear

Cota lineal (DIMLINEAR) entre dos orígenes.

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

Crea la cota lineal de DIMLINEAR de first_origin a second_origin, con la línea de cota pasando por dim_line_point, en el estilo de cota actual (y sus modificaciones). orientation horizontal o vertical, o dim_rotation en grados (la opción Girada); sin ellas, horizontal o vertical por la posición, como el cursor en el comando. dim_text cambia el texto (<> es la medida) y text_angle gira el texto (grados). En la capa actual. Con DIMASSOC 2, cada origen dado exactamente en el extremo, el punto medio, el centro o la intersección de un objeto vincula la cota a él (la cota lo sigue). Devuelve el identificador, el texto que muestra la cota y los vínculos (links). En el papel (una presentación a la vista, fuera de las ventanas gráficas), las coordenadas y las medidas son en mm; los ángulos y los factores de escala no cambian.

Parámetros

NombreTipoObligatorioDescripción
dim_line_pointarray<number>SíUn punto [x, y] por donde pasa la línea (o el arco) de cota; en las de radio y por coordenadas, donde queda el texto.
dim_rotationnumber | nullNoLa rotación de la línea de cota, en grados (la opción Girada).
dim_textstring | nullNoEl texto de la cota (<> es la medida; sin él, la medida).
first_originarray<number>SíEl primer origen [x, y] de la línea de referencia.
orientationOrientation | nullNoLa orientación: en la cota lineal, horizontal o vertical (en el SCP actual); en la hoja, portrait (vertical) o landscape (horizontal).
second_originarray<number>SíEl segundo origen [x, y] de la línea de referencia.
text_anglenumber | nullNoEl ángulo del texto de la cota, en grados.

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": {
        "dim_line_point": [
          5,
          -2
        ],
        "first_origin": [
          0,
          0
        ],
        "second_origin": [
          10,
          0
        ]
      },
      "operation": "cad.annotate.dim_linear"
    },
    "name": "badbit_call_operation"
  }
}

Python

Python
import badbit

result = badbit.cad.annotate.dim_linear(dim_line_point=[5, -2], first_origin=[0, 0], second_origin=[10, 0])

LISP

LISP
(badbit-call "cad.annotate.dim_linear" '(("dim_line_point" . (5 -2)) ("first_origin" . (0 0)) ("second_origin" . (10 0))))

JSON-RPC

JSON
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "badbit/call",
  "params": {
    "arguments": {
      "dim_line_point": [
        5,
        -2
      ],
      "first_origin": [
        0,
        0
      ],
      "second_origin": [
        10,
        0
      ]
    },
    "operation": "cad.annotate.dim_linear"
  }
}

Comandos que hacen lo mismo

DIMDIMLINEAR

Esquema completo

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

Parámetros (entrada)
JSON
{
  "$defs": {
    "Orientation": {
      "oneOf": [
        {
          "const": "horizontal",
          "type": "string"
        },
        {
          "const": "vertical",
          "type": "string"
        }
      ]
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "dim_line_point": {
      "description": "A point [x, y] the dimension line (or arc) passes through; in radial and ordinate dimensions, where the text goes.",
      "items": {
        "format": "double",
        "type": "number"
      },
      "maxItems": 2,
      "minItems": 2,
      "type": "array"
    },
    "dim_rotation": {
      "default": null,
      "description": "The rotation of the dimension line, in degrees (the Rotated option).",
      "format": "double",
      "type": [
        "number",
        "null"
      ]
    },
    "dim_text": {
      "default": null,
      "description": "The dimension text (<> is the measurement; without it, the measurement).",
      "maxLength": 10000,
      "type": [
        "string",
        "null"
      ]
    },
    "first_origin": {
      "description": "The first extension line origin [x, y].",
      "items": {
        "format": "double",
        "type": "number"
      },
      "maxItems": 2,
      "minItems": 2,
      "type": "array"
    },
    "orientation": {
      "anyOf": [
        {
          "$ref": "#/$defs/Orientation"
        },
        {
          "type": "null"
        }
      ],
      "description": "The orientation: on a linear dimension, horizontal or vertical (in the current UCS); on a sheet, portrait or landscape."
    },
    "second_origin": {
      "description": "The second extension line origin [x, y].",
      "items": {
        "format": "double",
        "type": "number"
      },
      "maxItems": 2,
      "minItems": 2,
      "type": "array"
    },
    "text_angle": {
      "default": null,
      "description": "The angle of the dimension text, in degrees.",
      "format": "double",
      "type": [
        "number",
        "null"
      ]
    }
  },
  "required": [
    "first_origin",
    "second_origin",
    "dim_line_point"
  ],
  "type": "object"
}
Resultado (salida)
JSON
{
  "$defs": {
    "DimLinkOut": {
      "properties": {
        "definition_point": {
          "description": "The linked definition point (the index in definition_points).",
          "format": "uint",
          "minimum": 0,
          "type": "integer"
        },
        "link_type": {
          "description": "Where the point is on the object: endpoint, midpoint, center, quadrant, node, insertion, on_curve, intersection, lines_meet or nearest (any point on the object, from the Nearest snap, which follows the object in the same proportion).",
          "type": "string"
        },
        "object_ids": {
          "description": "The objects the point is linked to (at an intersection, both).",
          "items": {
            "type": "string"
          },
          "type": "array"
        }
      },
      "required": [
        "definition_point",
        "object_ids",
        "link_type"
      ],
      "type": "object"
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "dim_texts": {
      "description": "The text each dimension shows.",
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "ids": {
      "description": "Object identifiers (32 hexadecimal digits each).",
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "links": {
      "description": "The definition points linked to objects (DIMASSOC 2): when the object changes, the dimension follows. Empty: the dimension is not associative.",
      "items": {
        "items": {
          "$ref": "#/$defs/DimLinkOut"
        },
        "type": "array"
      },
      "type": "array"
    }
  },
  "required": [
    "ids",
    "dim_texts",
    "links"
  ],
  "type": "object"
}
Buscar en la documentación