Number of objects in a layer

Hi,
Is there a command to count the number of objects in a specific layer?

Hi Michel - No - not as a specific command - assuming none of the objects are hidden or locked, right click on a layer and choose ‘Select objects’. The number of selected objects is reported at the command line, though not a total, it is broken down by object type.

-Pascal

Oh fine, thanks. Nevertheless it should be wise to have a specific command or script!
Regards

Envoyé à partir de Outlook pour Android

Hi Michel - you can put this on a button:

! _-RunPythonScript (
import rhinoscriptsyntax as rs
x = rs.GetLayer()
if x:
    count = len(rs.ObjectsByLayer(x))
    print(str(count) + " objects are on " + x)
)

-Pascal

1 Like

Thank you Pascal.
It works very well!
What book to learn Python for Rhino you could suggest to me?
Regards.