Operaciones de BadBit CAD
cad.layer.modify
Modifica, renombra o hace actual una capa.
- Programa: BadBit CAD
- Tipo de acción: Cambia el dibujo
- Modifica el dibujo
- Desde la versión 2027.0.0-beta.6
Modifica las propiedades dadas de la capa name; new_name la renombra (la capa 0 no se puede renombrar); current la hace la capa actual.
Parámetros
| Nombre | Tipo | Obligatorio | Descripción |
|---|---|---|---|
color | Color | null | No | Color: índice 1 a 255 de la paleta de AutoCAD, bylayer, byblock, un nombre (red, yellow, green, cyan, blue, magenta, white) o #rrggbb. |
current | boolean | null | No | Capa actual: true la hace la capa donde se crean los objetos nuevos; en los resultados, si lo es. |
frozen | boolean | null | No | Capa inutilizada: no se muestra ni se regenera. |
linetype | string | null | No | Nombre del tipo de línea (debe estar cargado en el dibujo), o bylayer. |
lineweight | Lineweight | null | No | Grosor en milímetros (0.25, 0.35, 0.5…), o bylayer (en las capas, default). |
locked | boolean | null | No | Bloqueada: en la capa, se muestra pero sus objetos no cambian; en la ventana gráfica, la escala y la vista no cambian. |
name | string | Sí | Nombre (de la capa, de la variable de sistema o del comando, según la operación). |
new_name | string | null | No | Nombre nuevo de la capa. |
on | boolean | null | No | Activada: la capa (desactivada, sus objetos no se muestran) o la ventana gráfica (desactivada, no muestra el modelo). |
plot | boolean | null | No | La capa sale en el trazado. |
Errores
| Código | JSON-RPC | Qué significa |
|---|---|---|
invalid_params | -32602 | Los parámetros no siguen el esquema o una regla de la operación. |
conflict | -32004 | El estado actual no lo permite ahora. |
not_found | -32001 | El objeto, la operación, el archivo o el nombre no existe. |
Ejemplo
MCP
JSON
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"arguments": {
"frozen": false,
"name": "Walls",
"new_name": "A-WALL"
},
"operation": "cad.layer.modify"
},
"name": "badbit_call_operation"
}
}Python
Python
import badbit
result = badbit.cad.layer.modify(frozen=False, name="Walls", new_name="A-WALL")LISP
LISP
(badbit-call "cad.layer.modify" '(("frozen" . nil) ("name" . "Walls") ("new_name" . "A-WALL")))JSON-RPC
JSON
{
"id": 1,
"jsonrpc": "2.0",
"method": "badbit/call",
"params": {
"arguments": {
"frozen": false,
"name": "Walls",
"new_name": "A-WALL"
},
"operation": "cad.layer.modify"
}
}Comandos que hacen lo mismo
LAYFRZLAYLCKLAYMCURLAYOFFLAYULK
Esquema completo
JSON Schema 2020-12, con las descripciones en inglés.
Parámetros (entrada)
JSON
{
"$defs": {
"Color": {
"anyOf": [
{
"format": "uint8",
"maximum": 255,
"minimum": 0,
"type": "integer"
},
{
"type": "string"
}
]
},
"Lineweight": {
"anyOf": [
{
"format": "double",
"type": "number"
},
{
"type": "string"
}
]
}
},
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"properties": {
"color": {
"anyOf": [
{
"$ref": "#/$defs/Color"
},
{
"type": "null"
}
],
"default": null,
"description": "Color: index 1 to 255 of the AutoCAD palette, bylayer, byblock, a name (red, yellow, green, cyan, blue, magenta, white) or #rrggbb."
},
"current": {
"default": null,
"description": "Current layer: true makes it the layer where new objects are created; in results, whether it is.",
"type": [
"boolean",
"null"
]
},
"frozen": {
"default": null,
"description": "Frozen layer: not shown and not regenerated.",
"type": [
"boolean",
"null"
]
},
"linetype": {
"default": null,
"description": "Linetype name (it must be loaded in the drawing), or bylayer.",
"type": [
"string",
"null"
]
},
"lineweight": {
"anyOf": [
{
"$ref": "#/$defs/Lineweight"
},
{
"type": "null"
}
],
"default": null,
"description": "Lineweight in millimeters (0.25, 0.35, 0.5…), or bylayer (on layers, default)."
},
"locked": {
"default": null,
"description": "Locked: for a layer, shown but its objects cannot be changed; for a layout viewport, its scale and view cannot change.",
"type": [
"boolean",
"null"
]
},
"name": {
"description": "Name (of the layer, of the system variable or of the command, depending on the operation).",
"maxLength": 255,
"minLength": 1,
"type": "string"
},
"new_name": {
"default": null,
"description": "New name of the layer.",
"maxLength": 255,
"minLength": 1,
"type": [
"string",
"null"
]
},
"on": {
"default": null,
"description": "Turned on: the layer (off: its objects are not shown) or the layout viewport (off: it does not show the model).",
"type": [
"boolean",
"null"
]
},
"plot": {
"default": null,
"description": "The layer is plotted.",
"type": [
"boolean",
"null"
]
}
},
"required": [
"name"
],
"type": "object"
}Resultado (salida)
JSON
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"name": {
"description": "Name (of the layer, of the system variable or of the command, depending on the operation).",
"type": "string"
}
},
"required": [
"name"
],
"type": "object"
}