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

Operaciones de BadBit CAD

cad.modify.pedit

Edita polilíneas (PEDIT).

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

Hace una opción de PEDIT en las polilíneas ids, en un paso de deshacer: action close, open, join (join_ids, fuzz), width (polyline_width), fit, spline, decurve, reverse, linetype_gen (linetype_generation) o, en una sola polilínea, move_vertex e insert_vertex (vertex, point), straighten y break (vertex, to_vertex) y vertex_width (vertex, start_width, end_width). Los vértices cuentan desde 0. convert transforma antes líneas, arcos y splines en polilínea. Devuelve lo que cambió. Con objetos del papel, las coordenadas y las medidas son en mm (los objetos del modelo y del papel en la misma petición se rechazan); los ángulos y los factores de escala no cambian.

Parámetros

NombreTipoObligatorioDescripción
actionPeditActionSíQué hacer (la opción del comando).
convertbooleanNoTransforma antes en polilínea las líneas, arcos y splines (la respuesta Sí de PEDIT).
end_widthnumber | nullNoEl grosor al final del tramo.
fuzznumber | nullNoLa distancia de unión: los extremos a esa distancia se unen.
idsarray<string>SíIdentificadores de objetos (32 dígitos hexadecimales cada uno).
join_idsarray<string>NoLos objetos que se unen a la polilínea.
linetype_generationboolean | nullNoLa generación continua del tipo de línea por los vértices (activada o no).
pointarray<number> | nullNoPunto [x, y]. En las respuestas de suite.command.run vale como el clic: la referencia a objetos activa (OSMODE) vale en el punto exacto y la cota asociativa se vincula al objeto; sin referencia ahí, como la coordenada escrita.
polyline_widthnumber | nullNoGrosor de la polilínea.
start_widthnumber | nullNoEl grosor al inicio del tramo.
to_vertexinteger | nullNoEl otro vértice del tramo (0 es el primero).
vertexinteger | nullNoEl vértice (0 es el primero).

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": {
        "action": "close",
        "ids": [
          "0190f3a2b4c5d6e7f8091a2b3c4d5e6f"
        ]
      },
      "operation": "cad.modify.pedit"
    },
    "name": "badbit_call_operation"
  }
}

Python

Python
import badbit

result = badbit.cad.modify.pedit(action="close", ids=["0190f3a2b4c5d6e7f8091a2b3c4d5e6f"])

LISP

LISP
(badbit-call "cad.modify.pedit" '(("action" . "close") ("ids" . ("0190f3a2b4c5d6e7f8091a2b3c4d5e6f"))))

JSON-RPC

JSON
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "badbit/call",
  "params": {
    "arguments": {
      "action": "close",
      "ids": [
        "0190f3a2b4c5d6e7f8091a2b3c4d5e6f"
      ]
    },
    "operation": "cad.modify.pedit"
  }
}

Comandos que hacen lo mismo

PEDIT

Esquema completo

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

Parámetros (entrada)
JSON
{
  "$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 (salida)
JSON
{
  "$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"
}
Buscar en la documentación