Operações do BadBit CAD
cad.modify.pedit
Edita polilinhas (PEDIT).
- Programa: BadBit CAD
- Tipo de ação: Altera o desenho
- Apaga
- Desde a versão 2027.0.0-beta.8
Faz uma opção do PEDIT nas polilinhas ids, num passo do desfazer: action close, open, join (join_ids, fuzz), width (polyline_width), fit, spline, decurve, reverse, linetype_gen (linetype_generation) ou, numa polilinha só, move_vertex e insert_vertex (vertex, point), straighten e break (vertex, to_vertex) e vertex_width (vertex, start_width, end_width). Os vértices contam de 0. convert transforma antes linhas, arcos e splines em polilinha. 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 |
|---|---|---|---|
action | PeditAction | Sim | O que fazer (a opção do comando). |
convert | boolean | Não | Transforma em polilinha as linhas, arcos e splines antes (a resposta Sim do PEDIT). |
end_width | number | null | Não | A largura no fim do trecho. |
fuzz | number | null | Não | A distância de junção: pontas até essa distância se juntam. |
ids | array<string> | Sim | Identificadores de objetos (32 dígitos hexadecimais cada). |
join_ids | array<string> | Não | Os objetos que se juntam à polilinha. |
linetype_generation | boolean | null | Não | A geração contínua do tipo de linha pelos vértices (ligada ou não). |
point | array<number> | null | Não | Ponto [x, y]. Nas respostas do suite.command.run vale como o clique: o snap ao objeto ligado (OSMODE) vale no ponto exato e a cota associativa liga ao objeto; sem snap ali, como a coordenada digitada. |
polyline_width | number | null | Não | Largura da polilinha. |
start_width | number | null | Não | A largura no começo do trecho. |
to_vertex | integer | null | Não | O outro vértice do trecho (0 é o primeiro). |
vertex | integer | null | Não | O vértice (0 é o primeiro). |
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": {
"action": "close",
"ids": [
"0190f3a2b4c5d6e7f8091a2b3c4d5e6f"
]
},
"operation": "cad.modify.pedit"
},
"name": "badbit_call_operation"
}
}Python
import badbit
result = badbit.cad.modify.pedit(action="close", ids=["0190f3a2b4c5d6e7f8091a2b3c4d5e6f"])LISP
(badbit-call "cad.modify.pedit" '(("action" . "close") ("ids" . ("0190f3a2b4c5d6e7f8091a2b3c4d5e6f"))))JSON-RPC
{
"id": 1,
"jsonrpc": "2.0",
"method": "badbit/call",
"params": {
"arguments": {
"action": "close",
"ids": [
"0190f3a2b4c5d6e7f8091a2b3c4d5e6f"
]
},
"operation": "cad.modify.pedit"
}
}Comandos que fazem o mesmo
Esquema completo
JSON Schema 2020-12, com as descrições em inglês.
Parâmetros (entrada)
{
"$defs": {
"PeditAction": {
"oneOf": [
{
"const": "close",
"type": "string"
},
{
"const": "open",
"type": "string"
},
{
"const": "join",
"type": "string"
},
{
"const": "width",
"type": "string"
},
{
"const": "fit",
"type": "string"
},
{
"const": "spline",
"type": "string"
},
{
"const": "decurve",
"type": "string"
},
{
"const": "reverse",
"type": "string"
},
{
"const": "linetype_gen",
"type": "string"
},
{
"const": "move_vertex",
"type": "string"
},
{
"const": "insert_vertex",
"type": "string"
},
{
"const": "straighten",
"type": "string"
},
{
"const": "break",
"type": "string"
},
{
"const": "vertex_width",
"type": "string"
}
]
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"properties": {
"action": {
"$ref": "#/$defs/PeditAction",
"description": "What to do (the command option)."
},
"convert": {
"default": false,
"description": "First turns lines, arcs and splines into polylines (the Yes answer of PEDIT).",
"type": "boolean"
},
"end_width": {
"default": null,
"description": "The width at the end of the segment.",
"format": "double",
"type": [
"number",
"null"
]
},
"fuzz": {
"default": null,
"description": "The fuzz distance: ends within it are joined.",
"format": "double",
"type": [
"number",
"null"
]
},
"ids": {
"description": "Object identifiers (32 hexadecimal digits each).",
"items": {
"type": "string"
},
"maxItems": 200000,
"minItems": 1,
"type": "array"
},
"join_ids": {
"default": [],
"description": "The objects joined to the polyline.",
"items": {
"type": "string"
},
"maxItems": 200000,
"type": "array"
},
"linetype_generation": {
"default": null,
"description": "Continuous linetype generation through the vertices (on or off).",
"type": [
"boolean",
"null"
]
},
"point": {
"default": null,
"description": "Point [x, y]. In the answers of suite.command.run it works like a click: the running object snap (OSMODE) applies at the exact point and an associative dimension links to the object; with no snap there, like typed coordinates.",
"items": {
"format": "double",
"type": "number"
},
"maxItems": 2,
"minItems": 2,
"type": [
"array",
"null"
]
},
"polyline_width": {
"default": null,
"description": "Width of the polyline.",
"format": "double",
"type": [
"number",
"null"
]
},
"start_width": {
"default": null,
"description": "The width at the start of the segment.",
"format": "double",
"type": [
"number",
"null"
]
},
"to_vertex": {
"default": null,
"description": "The other vertex of the stretch (0 is the first).",
"format": "uint32",
"minimum": 0,
"type": [
"integer",
"null"
]
},
"vertex": {
"default": null,
"description": "The vertex (0 is the first).",
"format": "uint32",
"minimum": 0,
"type": [
"integer",
"null"
]
}
},
"required": [
"ids",
"action"
],
"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"
}