BadBit CAD operations
cad.attributes.import
Brings back attribute values from a tab-separated text (ATTIN).
- Program: BadBit CAD
- Type of action: Acts outside the drawing
- Changes the drawing
- Since version 2027.0.0-beta.8
Reads, like ATTIN, the ATTOUT text (edited in a spreadsheet) from the file path (absolute path of a .txt) or from attributes_text and replaces the attribute values of each insert by the HANDLE of the row (<> leaves it alone; inserts on locked layers stay as they are). One undo step. Returns how many inserts and values changed and how many rows found no insert.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
attributes_text | string | null | No | The tab-separated ATTOUT text (the header HANDLE, BLOCKNAME and the tags; one row per insert). |
path | string | null | No | The absolute path of the file (of the drawing, or the one the operation reads or writes). |
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. |
conflict | -32004 | The current state does not allow this now. |
failed | -32005 | The operation failed. |
busy | -32006 | BadBit is busy opening or saving a file; try again shortly. |
Example
MCP
JSON
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"arguments": {
"path": "/Users/me/Projects/rooms.txt"
},
"operation": "cad.attributes.import"
},
"name": "badbit_call_operation"
}
}Python
Python
import badbit
result = badbit.cad.attributes.import_(path="/Users/me/Projects/rooms.txt")LISP
LISP
(badbit-call "cad.attributes.import" '(("path" . "/Users/me/Projects/rooms.txt")))JSON-RPC
JSON
{
"id": 1,
"jsonrpc": "2.0",
"method": "badbit/call",
"params": {
"arguments": {
"path": "/Users/me/Projects/rooms.txt"
},
"operation": "cad.attributes.import"
}
}Commands that do the same
Full schema
JSON Schema 2020-12.
Parameters (input)
JSON
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"properties": {
"attributes_text": {
"default": null,
"description": "The tab-separated ATTOUT text (the header HANDLE, BLOCKNAME and the tags; one row per insert).",
"type": [
"string",
"null"
]
},
"path": {
"default": null,
"description": "The absolute path of the file (of the drawing, or the one the operation reads or writes).",
"maxLength": 4096,
"minLength": 1,
"type": [
"string",
"null"
]
}
},
"type": "object"
}Result (output)
JSON
{
"$defs": {
"Changes": {
"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"
},
"truncated": {
"description": "The lists were cut at the limit.",
"type": "boolean"
}
},
"required": [
"created",
"modified",
"deleted",
"document_changed",
"truncated"
],
"type": "object"
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"changes": {
"$ref": "#/$defs/Changes",
"description": "What the request changed in the drawing."
},
"inserts_changed": {
"description": "How many inserts of the block changed.",
"format": "uint",
"minimum": 0,
"type": "integer"
},
"missing_handles": {
"description": "How many rows did not find the insert by HANDLE.",
"format": "uint",
"minimum": 0,
"type": "integer"
},
"skipped_locked": {
"description": "Objects left as they were because they are on locked layers.",
"format": "uint",
"minimum": 0,
"type": "integer"
},
"values_changed": {
"description": "How many attribute values changed.",
"format": "uint",
"minimum": 0,
"type": "integer"
}
},
"required": [
"inserts_changed",
"values_changed",
"missing_handles",
"skipped_locked",
"changes"
],
"type": "object"
}