(Deprecated) countVisibleNodes

This example uses API v1. See collectVisibleGeometries for an example with API v2.

snippets/deprecated/countVisibleNodes.py
 1# © 2024 Autodesk, Inc. All rights reserved.
 2
 3# Counts/collects visible geometry nodes with API v1.
 4# Note: This does not evaluate the choice of switch nodes.
 5
 6nodelist = []
 7def countVisibleGeometry( node):
 8    if( node.getActive()):
 9        if( node.getType() == "Geometry"):
10            nodelist.append(node)
11        for i in range(0,node.getNChildren()):
12            countVisibleGeometry( node.getChild(i))
13        
14def countVisibleGeometries( node):
15    nodelist[:] = []
16    countVisibleGeometry(node)
17    print(len(nodelist))