Operações do BadBit CAD
cad.annotate.dim_linear
Cota linear (DIMLINEAR) entre duas origens.
- Programa: BadBit CAD
- Tipo de ação: Altera o desenho
- Altera o desenho
- Desde a versão 2027.0.0-beta.8
Cria a cota linear do DIMLINEAR de first_origin a second_origin, com a linha de cota passando por dim_line_point, no estilo de cota atual (e as sobreposições dele). orientation horizontal ou vertical, ou dim_rotation em graus (a opção Girada); sem elas, horizontal ou vertical pela posição, como o cursor no comando. dim_text troca o texto (<> é a medida) e text_angle gira o texto (graus). Na camada atual. Com DIMASSOC 2, cada origem dada exatamente na ponta, no meio, no centro ou na interseção de um objeto liga a cota a ele (ela acompanha o objeto). Devolve o identificador, o texto que a cota mostra e as ligações (links). No papel (um layout à vista, fora das janelas de vista), as coordenadas e as medidas são em mm; os ângulos e os fatores de escala não mudam.
Parâmetros
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
dim_line_point | array<number> | Sim | Um ponto [x, y] por onde passa a linha (ou o arco) de cota; nas de raio e na ordenada, onde fica o texto. |
dim_rotation | number | null | Não | A rotação da linha de cota, em graus (a opção Girada). |
dim_text | string | null | Não | O texto da cota (<> é a medida; sem ele, a medida). |
first_origin | array<number> | Sim | A primeira origem [x, y] da linha de chamada. |
orientation | Orientation | null | Não | A orientação: na cota linear, horizontal ou vertical (no UCS atual); na folha, portrait (em pé) ou landscape (deitada). |
second_origin | array<number> | Sim | A segunda origem [x, y] da linha de chamada. |
text_angle | number | null | Não | O ângulo do texto da cota, em graus. |
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": {
"dim_line_point": [
5,
-2
],
"first_origin": [
0,
0
],
"second_origin": [
10,
0
]
},
"operation": "cad.annotate.dim_linear"
},
"name": "badbit_call_operation"
}
}Python
import badbit
result = badbit.cad.annotate.dim_linear(dim_line_point=[5, -2], first_origin=[0, 0], second_origin=[10, 0])LISP
(badbit-call "cad.annotate.dim_linear" '(("dim_line_point" . (5 -2)) ("first_origin" . (0 0)) ("second_origin" . (10 0))))JSON-RPC
{
"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 fazem o mesmo
Esquema completo
JSON Schema 2020-12, com as descrições em inglês.
Parâmetros (entrada)
{
"$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 (saída)
{
"$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"
}