Saltar al contenido
BadBit Documentación
Iniciar sesión Descargar la beta

Operaciones de BadBit CAD

cad.block.parameter_edit

Cambia un parámetro de un bloque dinámico (las propiedades del parámetro en el editor de bloques).

  • Programa: BadBit CAD
  • Tipo de acción: Cambia el dibujo
  • Modifica el dibujo
  • Desde la versión 2027.0.0-beta.8

Cambia en el bloque name el parámetro parameter (el node o la etiqueta): solo lo que venga (etiquetas, nombre del objeto, descripción, paleta, encadenamiento, valores aceptados, puntos, lugar de la etiqueta, pinzamientos, base en el medio, perpendicular, ángulo base, los nombres de los estados de la simetría). Las acciones siguen vinculadas a él. Un paso de deshacer. Devuelve lo que cambió.

Parámetros

NombreTipoObligatorioDescripción
base_anglenumber | nullNoEl ángulo base de la rotación, en grados (la línea de referencia del editor).
base_at_middleboolean | nullNoLa base del lineal en el medio (los dos lados se mueven la mitad).
base_locationarray<number> | nullNoEl primer punto [x, y] del parámetro, en coordenadas del bloque: la base, el centro de la rotación, el lugar del pinzamiento.
chain_actionsboolean | nullNoEncadena acciones: movido por una acción de otro parámetro, dispara las suyas.
end_locationarray<number> | nullNoEl segundo punto [x, y] del parámetro: el final del lineal y del polar, la esquina del XY, el radio de la rotación, la dirección de la alineación, el final de la línea de reflexión.
flipped_statestring | nullNoEl nombre del estado invertido.
grip_countinteger | nullNoCuántos pinzamientos: 0 o 1; 2 en el lineal y el polar; 4 en el XY.
label_locationarray<number> | nullNoEl lugar [x, y] de la etiqueta en el editor de bloques.
namestringSíNombre (de la capa, de la variable de sistema o del comando, según la operación).
not_flipped_statestring | nullNoEl nombre del estado no invertido.
parameterDynNodeRefSíEl parámetro del bloque dinámico: el node o la etiqueta.
parameter_descriptionstring | nullNoLa descripción del parámetro (la sugerencia de la paleta).
parameter_labelstring | nullNoLa etiqueta del parámetro: el nombre de la propiedad en la paleta y en cad.block.dynamic_set.
parameter_label2string | nullNoLa segunda etiqueta (el ángulo del polar, la Y del XY).
parameter_object_namestring | nullNoEl nombre del objeto parámetro (el Name de BPARAMETER).
perpendicularboolean | nullNoLa alineación perpendicular (falso: tangente).
show_in_paletteboolean | nullNoMuestra la propiedad en la paleta Propiedades.
value_setDynValueSet | nullNoLos valores aceptados: value_list, o increment con minimum y maximum (sin nada, cualquier valor; ángulos en grados).
value_set2DynValueSet | nullNoLos valores aceptados de la segunda parte (el ángulo del polar, la Y del XY).

Errores

CódigoJSON-RPCQué significa
invalid_params-32602Los parámetros no siguen el esquema o una regla de la operación.
not_found-32001El objeto, la operación, el archivo o el nombre no existe.
conflict-32004El estado actual no lo permite ahora.
failed-32005La operación falló.

Ejemplo

MCP

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

Python

Python
import badbit

result = badbit.cad.block.parameter_edit(name="Door", parameter="Width", value_set={"value_list": [700, 800, 900]})

LISP

LISP
(badbit-call "cad.block.parameter_edit" '(("name" . "Door") ("parameter" . "Width") ("value_set" . (("value_list" . (700 800 900))))))

JSON-RPC

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

Esquema completo

JSON Schema 2020-12, con las descripciones en inglés.

Parámetros (entrada)
JSON
{
  "$defs": {
    "DynNodeRef": {
      "anyOf": [
        {
          "format": "uint32",
          "minimum": 0,
          "type": "integer"
        },
        {
          "type": "string"
        }
      ]
    },
    "DynValueSet": {
      "additionalProperties": false,
      "properties": {
        "increment": {
          "description": "The increment of the accepted values (greater than zero).",
          "format": "double",
          "type": [
            "number",
            "null"
          ]
        },
        "maximum": {
          "description": "The largest accepted value.",
          "format": "double",
          "type": [
            "number",
            "null"
          ]
        },
        "minimum": {
          "description": "The smallest accepted value.",
          "format": "double",
          "type": [
            "number",
            "null"
          ]
        },
        "value_list": {
          "description": "The list of accepted values (the one in the block drawing always counts).",
          "items": {
            "format": "double",
            "type": "number"
          },
          "maxItems": 10000,
          "type": "array"
        }
      },
      "type": "object"
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "base_angle": {
      "default": null,
      "description": "The rotation base angle, in degrees (the editor reference line).",
      "format": "double",
      "type": [
        "number",
        "null"
      ]
    },
    "base_at_middle": {
      "default": null,
      "description": "The linear base at the middle (both sides move half).",
      "type": [
        "boolean",
        "null"
      ]
    },
    "base_location": {
      "default": null,
      "description": "The first point [x, y] of the parameter, in block coordinates: the base, the rotation center, the grip location.",
      "items": {
        "format": "double",
        "type": "number"
      },
      "maxItems": 2,
      "minItems": 2,
      "type": [
        "array",
        "null"
      ]
    },
    "chain_actions": {
      "default": null,
      "description": "Chains actions: moved by an action of another parameter, it fires its own.",
      "type": [
        "boolean",
        "null"
      ]
    },
    "end_location": {
      "default": null,
      "description": "The second point [x, y] of the parameter: the end of linear and polar, the XY corner, the rotation radius, the alignment direction, the end of the reflection line.",
      "items": {
        "format": "double",
        "type": "number"
      },
      "maxItems": 2,
      "minItems": 2,
      "type": [
        "array",
        "null"
      ]
    },
    "flipped_state": {
      "default": null,
      "description": "The name of the flipped state.",
      "type": [
        "string",
        "null"
      ]
    },
    "grip_count": {
      "default": null,
      "description": "How many grips: 0 or 1; 2 for linear and polar; 4 for XY.",
      "format": "uint8",
      "maximum": 255,
      "minimum": 0,
      "type": [
        "integer",
        "null"
      ]
    },
    "label_location": {
      "default": null,
      "description": "The location [x, y] of the label in the block editor.",
      "items": {
        "format": "double",
        "type": "number"
      },
      "maxItems": 2,
      "minItems": 2,
      "type": [
        "array",
        "null"
      ]
    },
    "name": {
      "description": "Name (of the layer, of the system variable or of the command, depending on the operation).",
      "type": "string"
    },
    "not_flipped_state": {
      "default": null,
      "description": "The name of the not flipped state.",
      "type": [
        "string",
        "null"
      ]
    },
    "parameter": {
      "$ref": "#/$defs/DynNodeRef",
      "description": "The dynamic block parameter: the node or the label."
    },
    "parameter_description": {
      "default": null,
      "description": "The parameter description (the palette tip).",
      "type": [
        "string",
        "null"
      ]
    },
    "parameter_label": {
      "default": null,
      "description": "The parameter label: the property name in the palette and in cad.block.dynamic_set.",
      "type": [
        "string",
        "null"
      ]
    },
    "parameter_label2": {
      "default": null,
      "description": "The second label (the polar angle, the XY Y).",
      "type": [
        "string",
        "null"
      ]
    },
    "parameter_object_name": {
      "default": null,
      "description": "The parameter object name (the BPARAMETER Name).",
      "type": [
        "string",
        "null"
      ]
    },
    "perpendicular": {
      "default": null,
      "description": "Perpendicular alignment (false: tangent).",
      "type": [
        "boolean",
        "null"
      ]
    },
    "show_in_palette": {
      "default": null,
      "description": "Shows the property in the Properties palette.",
      "type": [
        "boolean",
        "null"
      ]
    },
    "value_set": {
      "anyOf": [
        {
          "$ref": "#/$defs/DynValueSet"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The accepted values: value_list, or increment with minimum and maximum (nothing: any value; angles in degrees)."
    },
    "value_set2": {
      "anyOf": [
        {
          "$ref": "#/$defs/DynValueSet"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The accepted values of the second part (the polar angle, the XY Y)."
    }
  },
  "required": [
    "name",
    "parameter"
  ],
  "type": "object"
}
Resultado (salida)
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"
}
Buscar en la documentación