I understand how the solution in the array sx file works. I was confused by the dynamic block in this file which doesn't add anything there. On this method (slightly changed) I made my file - attached. I set the length of the profile, the number of pieces (X) and make an array in the path option, where in the "elements" parameters I substitute X and in "between" - col. The solution works - it is not a dynamic block, but apart from that, the solution meets all my expectations. I can set a gap (even 2 different ones - from the beginning of the profile (GAPSC) and between pieces (GAPSZK) but I have to do it before applying the array. If it's not possible to do it in a dynamic block, this must suffice.
The second option is to set the d1 and x parameters, thanks to which the length of the SZP is known, then the function copy in multiple mode + selecting the option copy in a array where the amount is x and the spacing = col values and it also works. You can only rewrite the SZP function to some line that would transfer its length to a rectangle (now it copies them together with the entire SZP formula).
"The rectangles sometimes run away somewhere" because of the inconsistent way constraints behave and the inconsistent way constraints behave is the main reason that I posted the solution I offered (which met all of the initial criteria you requested).
It is unfortunate that you erroneously posted the 5000 unit max as a desired property in your initial file. If you had not posted that misleading nonsense initially, it would have saved a lot of time and effort.
I fixed the file - the forms don't run anymore, the reason was the path (the line according to which the elements are arranged), the base point and others.
You are right, it was unnecessary although in reality it is (the profile is 5000mm). However, I quickly realized that it is not the profile and 5000 will be the determinant, but the entire length, e.g. 7566mm or 133.2m, which will have to be made of several profiles, sometimes of different lengths, so I sent a second post.
I thanked you for your time, willingness and somewhat solving my problem.
As I wrote, I am new to dynamic blocks.