Dynamo for Civil 3D — stop graph if no BlockReference exists?

Hi all,

I have a cleanup workflow in Dynamo for Civil 3D that selects drawing objects and filters them by type (blocks, lines, circles, polylines, etc.).

The issue is performance: if the selected list does not contain any BlockReference, I want the workflow to stop immediately instead of continuing with the rest of the calculations.

Is there an existing node or recommended approach to:

  • scan the object list first

  • detect whether a BlockReference exists

  • and terminate or bypass the rest of the graph if none are found?

Any advice would be appreciated. Thanks!

I think if you swap string.contains to a string equality check, it will be faster. and i believe the script will stop if an empty list goes to object.Explode.

Hi @BimAmbit, I used the “==” node and tried comparing computation time and found significant difference. Thanks a lot.