the way i approach this is to create 2 end caps and a middle component. then i can calculate the length of the gridbeam constrained to the block size and count the number of middle components to copy. see attached.

to use a different size you could adjust the size value noting that the holes will scale accordingly. or re-size each component manual and adjust the holes and positions etc. if the size of each is not a cube, you might need another attribute to handle the different dimension. e.g. if the sign post is 3x3 but the height is 2, the calculation needs to know the height of 2... in my model it assumes all 3 dimensions are the same.

to neaten it up i hide the edges on the ends and middle which face each other. i took out the inner geometry as it will overload quickly when lot's of these are used in a model.

using the gridbeam to create a small wheelbarrow

dynamic gridbeam component