Counts the number of instances of the block in the document.
rhinoscriptsyntax.BlockInstanceCount(block_name, where_to_look=0)
rhinoscript.block.BlockInstanceCount(block_name, where_to_look=0)
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 |
Number |
The number of instances of the block in the document if successful. |
import rhinoscriptsyntax as rs
blockname = rs.GetString("Block to count")
if rs.IsBlock(blockname):
count = rs.BlockInstanceCount(blockname)
print count, "block(s) found."