Pular para o conteúdo
BadBit Documentação
Entrar Baixar o beta

Operações do BadBit CAD

cad.landxml.import

Importa um arquivo LandXML para o desenho (LANDXMLIN).

  • Programa: BadBit CAD
  • Tipo de ação: Age fora do desenho
  • Altera o desenho
  • Desde a versão 2027.0.0-beta.8

Lê o LandXML path (.xml ou .landxml) e põe no desenho, na unidade dele, o que include pedir (sem ele, tudo: pontos e rótulos, superfícies, triângulos, curvas de nível, alinhamentos, lotes, linhas características, estacas, perfis, seções, bacias, redes e estradas), com contour_interval, major_every e text_height, como o LANDXMLIN. Num passo só do desfazer. Devolve quantas entidades entraram e o que mudou.

Parâmetros

NomeTipoObrigatórioDescrição
contour_intervalnumber | nullNãoO intervalo das curvas de nível, em unidades do desenho (padrão 1).
includearray<LandXmlPart> | nullNãoO que importar: points, point_labels, surfaces, triangles, contours, alignments, parcels, features, stations, profiles, sections, watersheds, networks, roadways (sem ele, tudo).
major_everyinteger | nullNãoA cada quantas curvas de nível, uma mestra (padrão 5).
pathstringSimO caminho absoluto do arquivo (do desenho, ou o que a operação lê ou grava).
text_heightnumber | nullNãoA altura do texto.

Erros

CódigoJSON-RPCO que significa
invalid_params-32602Os parâmetros não seguem o esquema ou uma regra da operação.
not_found-32001O objeto, a operação, o arquivo ou o nome não existe.
permission_denied-32002O pedido não é aceito (o detalhe diz por quê).
conflict-32004O estado atual não permite isso agora.
busy-32006O BadBit está abrindo ou salvando um arquivo; tente de novo daqui a pouco.
unsupported-32008Ainda não suportado.
failed-32005A operação falhou.

Exemplo

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 fazem o mesmo

LANDXMLIN

Esquema completo

JSON Schema 2020-12, com as descrições em 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 (saída)
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 na documentação