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

Operações do BadBit CAD

cad.block.action_edit

Muda uma ação de um bloco dinâmico.

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

Muda no bloco name a ação dynamic_action (o node ou o nome): só o que vier (nome, conjunto de seleção, ponto do parâmetro, contorno, itens que só giram, multiplicador, deslocamento do ângulo em graus, xy_type, ponto base próprio ou dependent_base, distâncias da matriz, lugar do ícone). Um passo do desfazer. Devolve o que mudou.

Parâmetros

NomeTipoObrigatórioDescrição
action_base_pointarray<number> | nullNãoO ponto base próprio [x, y] de escalar e girar (Independente; sem ele, o do parâmetro).
action_namestring | nullNãoO nome da ação.
angle_offsetnumber | nullNãoO deslocamento do ângulo da ação, em graus.
column_offsetnumber | nullNãoA distância entre as colunas da matriz (padrão: o comprimento do parâmetro).
dependent_baseboolean | nullNãoVolta a usar o ponto base do parâmetro (Dependente).
distance_multipliernumber | nullNãoO multiplicador da distância da ação.
dynamic_actionDynNodeRefSimA ação do bloco dinâmico: o node ou o nome.
icon_locationarray<number> | nullNãoO lugar [x, y] do ícone da ação no editor de blocos (padrão: o fim do parâmetro).
key_pointDynKeyPoint | nullNãoO ponto do parâmetro que a ação move: base ou end (o padrão).
namestringSimNome (da camada, da variável de sistema ou do comando, conforme a operação).
rotate_only_itemsarray<integer> | nullNãoOs itens que só giram no esticar polar.
row_offsetnumber | nullNãoA distância entre as linhas da matriz (parâmetro XY; padrão: a altura).
selection_itemsarray<integer> | nullNãoOs itens da definição (os índices de cad.block.definition).
selection_parametersarray<DynNodeRef> | nullNãoOs parâmetros que entram no conjunto de seleção da ação (ela os leva junto).
stretch_framearray<array<number>> | nullNãoO contorno do esticar [[x, y], …] (pelo menos 3 pontos): o que está todo dentro anda, do que cruza só os pontos de dentro.
xy_typeDynXyType | nullNãoA componente do parâmetro XY que a ação usa: xy, x ou y.

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.

Exemplo

MCP

JSON
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "arguments": {
        "distance_multiplier": 0.5,
        "dynamic_action": "Stretch1",
        "name": "Door"
      },
      "operation": "cad.block.action_edit"
    },
    "name": "badbit_call_operation"
  }
}

Python

Python
import badbit

result = badbit.cad.block.action_edit(distance_multiplier=0.5, dynamic_action="Stretch1", name="Door")

LISP

LISP
(badbit-call "cad.block.action_edit" '(("distance_multiplier" . 0.5) ("dynamic_action" . "Stretch1") ("name" . "Door")))

JSON-RPC

JSON
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "badbit/call",
  "params": {
    "arguments": {
      "distance_multiplier": 0.5,
      "dynamic_action": "Stretch1",
      "name": "Door"
    },
    "operation": "cad.block.action_edit"
  }
}

Esquema completo

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

Parâmetros (entrada)
JSON
{
  "$defs": {
    "DynKeyPoint": {
      "oneOf": [
        {
          "const": "base",
          "type": "string"
        },
        {
          "const": "end",
          "type": "string"
        }
      ]
    },
    "DynNodeRef": {
      "anyOf": [
        {
          "format": "uint32",
          "minimum": 0,
          "type": "integer"
        },
        {
          "type": "string"
        }
      ]
    },
    "DynXyType": {
      "oneOf": [
        {
          "const": "xy",
          "type": "string"
        },
        {
          "const": "x",
          "type": "string"
        },
        {
          "const": "y",
          "type": "string"
        }
      ]
    }
  },
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "properties": {
    "action_base_point": {
      "default": null,
      "description": "The own base point [x, y] for scale and rotate (Independent; without it, the parameter's).",
      "items": {
        "format": "double",
        "type": "number"
      },
      "maxItems": 2,
      "minItems": 2,
      "type": [
        "array",
        "null"
      ]
    },
    "action_name": {
      "default": null,
      "description": "The action name.",
      "type": [
        "string",
        "null"
      ]
    },
    "angle_offset": {
      "default": null,
      "description": "The action angle offset, in degrees.",
      "format": "double",
      "type": [
        "number",
        "null"
      ]
    },
    "column_offset": {
      "default": null,
      "description": "The distance between array columns (default: the parameter length).",
      "format": "double",
      "type": [
        "number",
        "null"
      ]
    },
    "dependent_base": {
      "default": null,
      "description": "Goes back to using the parameter base point (Dependent).",
      "type": [
        "boolean",
        "null"
      ]
    },
    "distance_multiplier": {
      "default": null,
      "description": "The action distance multiplier.",
      "format": "double",
      "type": [
        "number",
        "null"
      ]
    },
    "dynamic_action": {
      "$ref": "#/$defs/DynNodeRef",
      "description": "The dynamic block action: the node or the name."
    },
    "icon_location": {
      "default": null,
      "description": "The location [x, y] of the action icon in the block editor (default: the parameter end).",
      "items": {
        "format": "double",
        "type": "number"
      },
      "maxItems": 2,
      "minItems": 2,
      "type": [
        "array",
        "null"
      ]
    },
    "key_point": {
      "anyOf": [
        {
          "$ref": "#/$defs/DynKeyPoint"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The parameter point the action moves: base or end (the default)."
    },
    "name": {
      "description": "Name (of the layer, of the system variable or of the command, depending on the operation).",
      "type": "string"
    },
    "rotate_only_items": {
      "default": null,
      "description": "The items that only rotate in the polar stretch.",
      "items": {
        "format": "uint32",
        "minimum": 0,
        "type": "integer"
      },
      "maxItems": 100000,
      "type": [
        "array",
        "null"
      ]
    },
    "row_offset": {
      "default": null,
      "description": "The distance between array rows (XY parameter; default: the height).",
      "format": "double",
      "type": [
        "number",
        "null"
      ]
    },
    "selection_items": {
      "default": null,
      "description": "The definition items (the indexes from cad.block.definition).",
      "items": {
        "format": "uint32",
        "minimum": 0,
        "type": "integer"
      },
      "maxItems": 100000,
      "type": [
        "array",
        "null"
      ]
    },
    "selection_parameters": {
      "description": "The parameters in the action selection set (it moves them along).",
      "items": {
        "$ref": "#/$defs/DynNodeRef"
      },
      "maxItems": 1000,
      "type": [
        "array",
        "null"
      ]
    },
    "stretch_frame": {
      "default": null,
      "description": "The stretch frame [[x, y], …] (at least 3 points): what is fully inside moves; of what crosses it, only the points inside.",
      "items": {
        "items": {
          "format": "double",
          "type": "number"
        },
        "maxItems": 2,
        "minItems": 2,
        "type": "array"
      },
      "maxItems": 10000,
      "type": [
        "array",
        "null"
      ]
    },
    "xy_type": {
      "anyOf": [
        {
          "$ref": "#/$defs/DynXyType"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "The XY parameter component the action uses: xy, x or y."
    }
  },
  "required": [
    "name",
    "dynamic_action"
  ],
  "type": "object"
}
Resultado (saída)
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 na documentação