Counting code block

Hi all,

I have a question about the following problem. I have a script for counting structural piles in my Revit model. I now want to give a specific number for the first selected pile and the rest should be added up.

The script works fine if i begin counting at 1. But when i want it to start (for example) counting at 50 it starts counting back. See the following images. I tried to put in different commands but it still didn’t work. What am i doing wrong? How can i solve this?


Try placing a +n after the range (before the string conversion), or use (n..n+a)+"".

For future reference, here are the standard nomenclatures for different sequence patterns:
Generally, i is the initial value, j represents the number of steps, and n is the step value. Using a # changes the value to a count.

0..10..3 = A sequence of 0 to 10 by 3.
0..10..#3 = A sequence of 0 to 10, counting 3 times.
0..#10..3 = A sequence starting at 0, counting 10 times by 3.


Thanks for the reply! I didn’t quite understand what you meant. But i tried something else what helped me out. See the following image.

Thanks! this will also be very usefull.

It is because of the fact that a<50. So it creates a downgrading range.
You can do it like that:
Create a code block with “b+50” and connect List.Count to “b”. Then connect that one the a.

1 Like