BadBit CAD operations
cad.landxml.import
Imports a LandXML file into the drawing (LANDXMLIN).
- Program: BadBit CAD
- Type of action: Acts outside the drawing
- Changes the drawing
- Since version 2027.0.0-beta.8
Reads the LandXML path (.xml or .landxml) and puts in the drawing, in its unit, what include asks for (without it, everything: points and labels, surfaces, triangles, contours, alignments, parcels, feature lines, stations, profiles, sections, watersheds, networks and roadways), with contour_interval, major_every and text_height, like LANDXMLIN. In a single undo step. Returns how many entities came in and what changed.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
contour_interval | number | null | No | The contour interval, in drawing units (default 1). |
include | array<LandXmlPart> | null | No | What to import: points, point_labels, surfaces, triangles, contours, alignments, parcels, features, stations, profiles, sections, watersheds, networks, roadways (without it, everything). |
major_every | integer | null | No | Every how many contours, a major one (default 5). |
path | string | Yes | The absolute path of the file (of the drawing, or the one the operation reads or writes). |
text_height | number | null | No | The text height. |
Errors
| Code | JSON-RPC | Meaning |
|---|---|---|
invalid_params | -32602 | The parameters do not follow the schema or a rule of the operation. |
not_found | -32001 | The object, operation, file or name does not exist. |
permission_denied | -32002 | The request is not accepted (the detail says why). |
conflict | -32004 | The current state does not allow this now. |
busy | -32006 | BadBit is busy opening or saving a file; try again shortly. |
unsupported | -32008 | Not supported yet. |
failed | -32005 | The operation failed. |
Example
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"
}
}Commands that do the same
Full schema
JSON Schema 2020-12.
Parameters (input)
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"
}Result (output)
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"
}