Skip to content
BadBit Documentation
Sign in Download the beta

BadBit CAD operations

cad.block.property_table

Builds the property table of a dynamic block (BTABLE).

  • Program: BadBit CAD
  • Type of action: Changes the drawing
  • Changes the drawing
  • Since version 2027.0.0-beta.8

Replaces the property table of the block name (created at table_location, or at the base point, the first time): table_columns are the parameters (the node or the label) and table_rows the rows, one text per column (numbers, angles in degrees, x,y, the state name; empty is allowed), checked against each parameter; must_match (default yes) requires the properties to match a row, like BTABLE. Each insert chooses the row with cad.block.dynamic_set (the row number, from 1). One undo step. Returns what changed (and the node of the created table).

Parameters

NameTypeRequiredDescription
must_matchboolean | nullNoThe properties must match a table row (false: accepts values outside it).
namestringYesName (of the layer, of the system variable or of the command, depending on the operation).
table_columnsarray<DynNodeRef>YesThe table column parameters (the node or the label; in results, the node).
table_locationarray<number> | nullNoThe location [x, y] of the property table grip.
table_rowsarray<array<string>>YesThe table rows, one text per column (numbers, angles in degrees, x,y, the state name).

Errors

CodeJSON-RPCMeaning
invalid_params-32602The parameters do not follow the schema or a rule of the operation.
not_found-32001The object, operation, file or name does not exist.
conflict-32004The current state does not allow this now.
failed-32005The operation failed.

Example

MCP

JSON
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "arguments": {
        "name": "Door",
        "table_columns": [
          "Width"
        ],
        "table_rows": [
          [
            "700"
          ],
          [
            "800"
          ],
          [
            "900"
          ]
        ]
      },
      "operation": "cad.block.property_table"
    },
    "name": "badbit_call_operation"
  }
}

Python

Python
import badbit

result = badbit.cad.block.property_table(name="Door", table_columns=["Width"], table_rows=[["700"], ["800"], ["900"]])

LISP

LISP
(badbit-call "cad.block.property_table" '(("name" . "Door") ("table_columns" . ("Width")) ("table_rows" . (("700") ("800") ("900")))))

JSON-RPC

JSON
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "badbit/call",
  "params": {
    "arguments": {
      "name": "Door",
      "table_columns": [
        "Width"
      ],
      "table_rows": [
        [
          "700"
        ],
        [
          "800"
        ],
        [
          "900"
        ]
      ]
    },
    "operation": "cad.block.property_table"
  }
}

Commands that do the same

BTABLE

Full schema

JSON Schema 2020-12.

Parameters (input)
JSON
{
  "$defs": {
    "DynNodeRef": {
      "anyOf": [
        {
          "format": "uint32",
          "minimum": 0,
          "type": "integer"
        },
        {
          "type": "string"
        }
      ]
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "must_match": {
      "default": null,
      "description": "The properties must match a table row (false: accepts values outside it).",
      "type": [
        "boolean",
        "null"
      ]
    },
    "name": {
      "description": "Name (of the layer, of the system variable or of the command, depending on the operation).",
      "type": "string"
    },
    "table_columns": {
      "description": "The table column parameters (the node or the label; in results, the node).",
      "items": {
        "$ref": "#/$defs/DynNodeRef"
      },
      "maxItems": 100,
      "type": "array"
    },
    "table_location": {
      "default": null,
      "description": "The location [x, y] of the property table grip.",
      "items": {
        "format": "double",
        "type": "number"
      },
      "maxItems": 2,
      "minItems": 2,
      "type": [
        "array",
        "null"
      ]
    },
    "table_rows": {
      "description": "The table rows, one text per column (numbers, angles in degrees, x,y, the state name).",
      "items": {
        "items": {
          "type": "string"
        },
        "type": "array"
      },
      "maxItems": 10000,
      "type": "array"
    }
  },
  "required": [
    "name",
    "table_columns",
    "table_rows"
  ],
  "type": "object"
}
Result (output)
JSON
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "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"
    },
    "inserts_changed": {
      "description": "How many inserts of the block changed.",
      "format": "uint",
      "minimum": 0,
      "type": "integer"
    },
    "modified": {
      "description": "Whether there are unsaved changes; in results of changes, the identifiers of the objects changed.",
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "node": {
      "description": "The node number of the parameter or action (what the other dynamic block operations use).",
      "format": "uint32",
      "minimum": 0,
      "type": [
        "integer",
        "null"
      ]
    },
    "skipped_locked": {
      "description": "Objects left as they were because they are on locked layers.",
      "format": "uint",
      "minimum": 0,
      "type": "integer"
    },
    "truncated": {
      "description": "The lists were cut at the limit.",
      "type": "boolean"
    }
  },
  "required": [
    "inserts_changed",
    "created",
    "modified",
    "deleted",
    "document_changed",
    "truncated"
  ],
  "type": "object"
}
Search the documentation