AutoXchange 2024 Technical Documentation

JSON Block Counting Parameters

JSON Block Counting Parameters

The Block Counting Parameters are all parameters that define how block references (usages of a block) can be counted.

There are no corresponding normal parameters to this section. Blocks can only be counted via the JSON file.

For each block to be counted, the block name must be listed. A File name can be listed. It will default to the same name and location as the output file (or the input file if no output is listed) with the extension of “.csv” (Comma Separated Value).

Note: anonymous blocks, those blocks created by AutoCAD for use in such things as hatching and dimensioning, are never counted and are ignored for all these examples. These blocks have names that start with an asterisk ("*U1").

If all named blocks are to be counted, then use a single asterisk (’*’) as the block name.

  {
    "Counts": {
      "Blocks": "*"
    }
  }

To count all instances of a given block, just list that block name.

  {
    "Counts": {
      "Block": "PART1"
    }
  }

To count all instances of multiple blocks, list those blocks as a JSON array.

  {
    "Counts": {
      "Blocks": ["PART1","PART2","PART10"]
    }
  }

To count all instances of a given block with a given attribute value, list the name of the block and the attribute Tag Name and Value.

  {
    "Counts": {
      "File": "/home/tms/count_info.csv",
      "Block": {
        "BlockName":  "PART1",
        "Attributes": {"PARTNO": "123P1"}
      }
    }
  }

To count all instances of multiple block with given attribute values, list the name of the block and the attribute Tag Name and Value for each block in a separate section. Do not forget the comma between sections.

  {
    "Counts": {
      "File": "/home/tms/count_info.csv",
      "Blocks": {
        "Block": {
          "BlockName":  "PART1",
          "Attributes": {"PARTNO": "123P1"}
        },
        "Block": {
          "BlockName":  "PART2",
          "Attributes": {"PARTNO": "345P2"}
        }
	  }
    }
  }
Last updated on 21 Apr 2020
Published on 21 Apr 2020