BlockInstanceCount

Counts the number of instances of the block in the document.

Syntax

rhinoscriptsyntax.BlockInstanceCount(block_name, where_to_look=0)

rhinoscript.block.BlockInstanceCount(block_name, where_to_look=0)

Parameters

block_name

Required.  String.  The name of an existing block definition.

where_to_look

Optional. Integer. Level to look for.

0 = get top level references in active document

1 = get top level and nested references in active document

2 = check for references from other instance definitions

Returns

Number

The number of instances of the block in the document if successful.

Example

import rhinoscriptsyntax as rs

blockname = rs.GetString("Block to count")

if rs.IsBlock(blockname):

    count = rs.BlockInstanceCount(blockname)

    print count, "block(s) found."

Also See

BlockInstanceInsertPoint

BlockInstances

BlockInstanceXform

IsBlockInstance