BKG_CountBlocks

Version 20160307 (freeware).
Works on BricsCAD V13 and higher for Windows®. But due to a bug in BricsCAD V13.2.9 and V13.2.10 the table option of the program does not work on those versions.
By downloading the .zip file you agree to the EULA for free software (freeware).

Download link: BKG_CountBlocks.zip (< 40kB)

Dialog

BKG_CountBlocks is a full featured block counter. Its features include counting nested blocks* and counting unmirrored and mirrored blocks separately.

There are two versions of the program. A dialog driven version: BKG_CountBlocks (or BCBL) and a command line version: -BKG_CountBlocks (or -BCBL). The command line version can be used for scripts and toolbar macros.

The program works in four steps. First you have to select block entities in the drawing. You then choose from a number of options, explained in the following section of this text. Next the program shows the data it has collected and this data can then be copied to the clipboard, saved to a file or used to create a table in the drawing.

* In this text and in the program the word 'block' can also mean 'xref'.

Program options

Dialog

Block name match

If you are using a consistent naming scheme for blocks and xrefs you can use this option to narrow down the selection. This option is non-restrictive, meaning the program will look inside blocks that do not meet the block name match criterion, for blocks that do. You can use wild-cards in the match string. The matching is case-insensitive.

Layer name match

You can also use the layer name to filter blocks. As with the previous option this option is non-restrictive, you can use wild-cards in the string and the matching is case-insensitive.

Count dynamic blocks

This is a restrictive option. If you choose to not count dynamic blocks, all nested blocks inside those blocks will also not be counted.

Count xrefs

This is also a restrictive option.

Count nested blocks

If you choose to count nested block all nesting levels will be checked. The names of non-xref blocks nested in an xref will be prefixed with the name of the xref and ' -> '.

Count nested blocks on frozen layers

This can be a tricky option. The program only checks the layer the block is inserted on. It does not check if the block is invisible because the entities in the block are on layers that are invisible. Note that the program always considers layer '0' to be thawed. This is a restrictive option.

Count unmirrored and mirrored separately

The program can determine if a block is mirrored or not. Nested blocks are also processed. See the next section for more information.

Specify undefined if found

A block can only be called mirrored or unmirrored within a 2D context. The mirroring of blocks with a Z-axis that is not parallel to the Z-axis of the WCS is considered undefined. If you only work in 2D this option is not relevant.

Unmirrored, mirrored or undefined mirroring: How does it work?

This section gives some background information on how the program decides if a block is unmirrored, mirrored or if the mirroring is undefined.

The decision process can be represented by the table below. Each statement in the table is checked. If a statement is true the number from the True column is entered in the Result column. If not, the number from the False column is entered. The final result is the multiplication of all numbers in the Result column.

The final result can have three values:
1: The block is unmirrored; -1: The block is mirrored; Or 0: The mirroring is undefined.

Statement True False Result
1. The Z-axis of the block is not parallel to the Z-axis of the WCS. 0 1
2. The block is nested in a block with a Z-axis that is not parallel to the Z-axis of the WCS.
- Repeat for every nesting level.
0 1
3. The X-scale of the block is negative. -1 1
4. The Y-scale of the block is negative. -1 1
5. The direction of the positive Z-axis of the block is opposite to that of the WCS. -1 1
6. The block is dynamic and has a flip action that has been flipped.
- Only flip actions with 'flip' in the name are checked.
- Repeat for every flip action.
-1 1
7. The block is nested in a mirrored block.
- Repeat for every nesting level.
-1 1

Installing the program

Unpack BKG_CountBlocks.des from the .zip file in a folder in the search path and follow the instructions you can find here.

What is new

Version 20160307:
  • Improved: The 'BKG_CountBlocks Data' dialog has been resized to avoid a horizontal scrollbar. The scrollbar would appear in V14 and higher due to changes in the BricsCAD DCL implementation.
  • Changed: Minor internal changes.
Version 20141027:
  • Changed: Minor internal changes.
Version 20131204:
  • Fixed: The stricter Lisp-engine of BricsCAD V14.1.09 and higher prevented the loading of the previous version.
Version 20131002:
  • Changed: Multiple internal changes.
Version 20120520:
  • Improved: Using functions from BricsCAD's new Lisp-engine (available since V12.2.5) creating a table has become much faster.
  • Fixed: A Lisp bug in BricsCAD V12.2.7 required some workarounds.
Version 20120412:
  • First public version.