Hi @JonnyPot
In addition to the above, these two rules will calculate spacing based on either an optimal value (Closest to), or a maximum allowable series spacing, respectively.
'Work to optimal spacing. Returns closest value
Height = 1205 ' Some arbitrary number
OptimalSpacing = 200
TestQty = Floor(Height/OptimalSpacing)
SeriesSpacing = Height / TestQty
SeriesQty = Height / SeriesSpacing
MessageBox.Show("Series Spacing = " & SeriesSpacing & vbLf & "Series Qty = " & SeriesQty, "iLogic")
'Work to maximum spacing, returns no greater than max value
Height = 1282 ' Some arbitrary number
MaxSeriesHeight = 200
TestQty = Round(Height / MaxSeriesHeight, 0)
'Find Actual spacing
TestSpacing = Height / TestQty
'Loop and retest spacing until condition is met
Do While TestSpacing > MaxSeriesHeight
TestQty += 1
TestSpacing = Height / TestQty
Loop
'Set values to driving parameters
SeriesQty = TestQty
SeriesSpacing = TestSpacing
MessageBox.Show("Series Spacing = " & SeriesSpacing & vbLf & "Series Qty = " & SeriesQty, "iLogic")
Your values for the height may need to take in to account any top and bottom frame thickness etc, however these rules should get you on the right track.
Regards