BadBit CAD operations
cad.block.visibility_items
Shows or hides items in the visibility states of a dynamic block (BVSHOW, BVHIDE).
- Program: BadBit CAD
- Type of action: Changes the drawing
- Changes the drawing
- Since version 2027.0.0-beta.8
In the block name, show true shows (BVSHOW) and false hides (BVHIDE) the items selection_items (the indexes from cad.block.definition) in the block state, in state_names or, with all_states, in all of them. A hidden item becomes controlled by the visibility. One undo step. Returns what changed.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
all_states | boolean | No | In all visibility states. |
name | string | Yes | Name (of the layer, of the system variable or of the command, depending on the operation). |
selection_items | array<integer> | Yes | The definition items (the indexes from cad.block.definition). |
show | boolean | Yes | Shows (true) or hides (false). |
state_names | array<string> | No | The visibility states, by name (without them, the block state). |
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. |
Example
MCP
JSON
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"arguments": {
"name": "Door",
"selection_items": [
3
],
"show": false,
"state_names": [
"Closed"
]
},
"operation": "cad.block.visibility_items"
},
"name": "badbit_call_operation"
}
}Python
Python
import badbit
result = badbit.cad.block.visibility_items(name="Door", selection_items=[3], show=False, state_names=["Closed"])LISP
LISP
(badbit-call "cad.block.visibility_items" '(("name" . "Door") ("selection_items" . (3)) ("show" . nil) ("state_names" . ("Closed"))))JSON-RPC
JSON
{
"id": 1,
"jsonrpc": "2.0",
"method": "badbit/call",
"params": {
"arguments": {
"name": "Door",
"selection_items": [
3
],
"show": false,
"state_names": [
"Closed"
]
},
"operation": "cad.block.visibility_items"
}
}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": {
"all_states": {
"default": false,
"description": "In all visibility states.",
"type": "boolean"
},
"name": {
"description": "Name (of the layer, of the system variable or of the command, depending on the operation).",
"type": "string"
},
"selection_items": {
"description": "The definition items (the indexes from cad.block.definition).",
"items": {
"format": "uint32",
"minimum": 0,
"type": "integer"
},
"maxItems": 100000,
"minItems": 1,
"type": "array"
},
"show": {
"description": "Shows (true) or hides (false).",
"type": "boolean"
},
"state_names": {
"default": [],
"description": "The visibility states, by name (without them, the block state).",
"items": {
"type": "string"
},
"maxItems": 1000,
"type": "array"
}
},
"required": [
"name",
"selection_items",
"show"
],
"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"
}