McNeel Wiki
Count Block Instances
edit · print · help · all topics
Main Pages

AccuRender

Bongo

Brazil r/s

Developer

Flamingo

Penguin

Rhino Blogs

Rhino

Rhino Labs

Search

Languages

Česky

Deutsch

English

Español

Français

Italiano

Polish

日本語

한국어

中文(繁體)

中文(简体)

 
.
DeveloperRhinoScript
SummaryDemonstrates how to count block instances using RhinoScript.

Question:

My customer has a document that contains hundreds of block definitions. How does he count all instances of all blocks at once, and not one by one? That is, I want to print out a report of all blocks and the number of instances.

Answer:

See the following RhinoScript.

 Sub CountAllInstancesOfAllBlocks
   arrNames = Rhino.BlockNames(True)
   If IsArray(arrNames) Then
     For Each strName In arrNames
       Rhino.Print strName & " = " & CStr(Rhino.BlockInstanceCount(strName))
     Next
   End If
 End Sub
rename · changes · history · subscriptions · lost and found · references · file upload