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

Operações do BadBit CAD

cad.attributes.import

Traz de volta os valores dos atributos de um texto separado por tabulações (ATTIN).

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

Lê, como o ATTIN, o texto do ATTOUT (editado numa planilha) do arquivo path (caminho absoluto de um .txt) ou de attributes_text e troca os valores dos atributos de cada inserção pelo HANDLE da linha (<> não mexe; as inserções em camada travada ficam como estão). Um passo do desfazer. Devolve quantas inserções e valores mudaram e quantas linhas não acharam inserção.

Parâmetros

NomeTipoObrigatórioDescrição
attributes_textstring | nullNãoO texto separado por tabulações do ATTOUT (o cabeçalho HANDLE, BLOCKNAME e os rótulos; uma linha por inserção).
pathstring | nullNãoO caminho absoluto do arquivo (do desenho, ou o que a operação lê ou grava).

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.
conflict-32004O estado atual não permite isso agora.
failed-32005A operação falhou.
busy-32006O BadBit está abrindo ou salvando um arquivo; tente de novo daqui a pouco.

Exemplo

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"
  }
}

Comandos que fazem o mesmo

ATTIN

Esquema completo

JSON Schema 2020-12, com as descrições em inglês.

Parâmetros (entrada)
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"
}
Resultado (saída)
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"
}
Buscar na documentação