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

Operaciones de BadBit CAD

cad.landxml.import

Importa un archivo LandXML al dibujo (LANDXMLIN).

  • Programa: BadBit CAD
  • Tipo de acción: Actúa fuera del dibujo
  • Modifica el dibujo
  • Desde la versión 2027.0.0-beta.8

Lee el LandXML path (.xml o .landxml) y pone en el dibujo, en su unidad, lo que pida include (sin él, todo: puntos y rótulos, superficies, triángulos, curvas de nivel, alineaciones, parcelas, líneas características, estaciones, perfiles, secciones, cuencas, redes y carreteras), con contour_interval, major_every y text_height, como LANDXMLIN. En un solo paso del deshacer. Devuelve cuántas entidades entraron y lo que cambió.

Parámetros

NombreTipoObligatorioDescripción
contour_intervalnumber | nullNoEl intervalo de las curvas de nivel, en unidades del dibujo (predeterminado 1).
includearray<LandXmlPart> | nullNoQué importar: points, point_labels, surfaces, triangles, contours, alignments, parcels, features, stations, profiles, sections, watersheds, networks, roadways (sin él, todo).
major_everyinteger | nullNoCada cuántas curvas de nivel, una maestra (predeterminado 5).
pathstringSíLa ruta absoluta del archivo (del dibujo, o el que la operación lee o graba).
text_heightnumber | nullNoLa altura del texto.

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.
permission_denied-32002La petición no se acepta (el detalle dice por qué).
conflict-32004El estado actual no lo permite ahora.
busy-32006BadBit está abriendo o guardando un archivo; inténtelo de nuevo en un momento.
unsupported-32008Todavía no soportado.
failed-32005La operación falló.

Ejemplo

MCP

JSON
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "arguments": {
        "path": "/Users/ana/Documents/BadBit/terreno.xml"
      },
      "operation": "cad.landxml.import"
    },
    "name": "badbit_call_operation"
  }
}

Python

Python
import badbit

result = badbit.cad.landxml.import_(path="/Users/ana/Documents/BadBit/terreno.xml")

LISP

LISP
(badbit-call "cad.landxml.import" '(("path" . "/Users/ana/Documents/BadBit/terreno.xml")))

JSON-RPC

JSON
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "badbit/call",
  "params": {
    "arguments": {
      "path": "/Users/ana/Documents/BadBit/terreno.xml"
    },
    "operation": "cad.landxml.import"
  }
}

Comandos que hacen lo mismo

LANDXMLIN

Esquema completo

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

Parámetros (entrada)
JSON
{
  "$defs": {
    "LandXmlPart": {
      "oneOf": [
        {
          "const": "points",
          "type": "string"
        },
        {
          "const": "point_labels",
          "type": "string"
        },
        {
          "const": "surfaces",
          "type": "string"
        },
        {
          "const": "triangles",
          "type": "string"
        },
        {
          "const": "contours",
          "type": "string"
        },
        {
          "const": "alignments",
          "type": "string"
        },
        {
          "const": "parcels",
          "type": "string"
        },
        {
          "const": "features",
          "type": "string"
        },
        {
          "const": "stations",
          "type": "string"
        },
        {
          "const": "profiles",
          "type": "string"
        },
        {
          "const": "sections",
          "type": "string"
        },
        {
          "const": "watersheds",
          "type": "string"
        },
        {
          "const": "networks",
          "type": "string"
        },
        {
          "const": "roadways",
          "type": "string"
        }
      ]
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "contour_interval": {
      "default": null,
      "description": "The contour interval, in drawing units (default 1).",
      "format": "double",
      "type": [
        "number",
        "null"
      ]
    },
    "include": {
      "description": "What to import: points, point_labels, surfaces, triangles, contours, alignments, parcels, features, stations, profiles, sections, watersheds, networks, roadways (without it, everything).",
      "items": {
        "$ref": "#/$defs/LandXmlPart"
      },
      "maxItems": 14,
      "minItems": 1,
      "type": [
        "array",
        "null"
      ]
    },
    "major_every": {
      "default": null,
      "description": "Every how many contours, a major one (default 5).",
      "format": "uint32",
      "maximum": 1000,
      "minimum": 1,
      "type": [
        "integer",
        "null"
      ]
    },
    "path": {
      "description": "The absolute path of the file (of the drawing, or the one the operation reads or writes).",
      "maxLength": 4096,
      "minLength": 1,
      "type": "string"
    },
    "text_height": {
      "default": null,
      "description": "The text height.",
      "format": "double",
      "type": [
        "number",
        "null"
      ]
    }
  },
  "required": [
    "path"
  ],
  "type": "object"
}
Resultado (salida)
JSON
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "properties": {
    "count": {
      "description": "The number: of items (the original included) or of objects that changed.",
      "format": "uint",
      "minimum": 0,
      "type": "integer"
    },
    "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"
    },
    "truncated": {
      "description": "The lists were cut at the limit.",
      "type": "boolean"
    }
  },
  "required": [
    "count",
    "created",
    "modified",
    "deleted",
    "document_changed",
    "truncated"
  ],
  "type": "object"
}
Buscar en la documentación