Instead of your GOSUB routines try this FOR NEXT loop instead:
leadspc=6.0" !start space from bottom of standards
spcng=(shigt-(leadspc*2))/nshelves !shelf spacing per overall height of standards
If spcng<6.0" then spcng=6.0"
If spcng>24.0" then spcng=24.0"
FOR i=1 TO nshelves
This is a little cleaner code. FYI - Anytime you need to calculate quantities, lengths, numbers, etc. from the overall dimensions of an object - you should do the coding in the "Master Script".
Hope this gets you on the right track.
David Larrew, AIA, GDLA, GSRC
Architectural Technology Specialist
a r c h i S O L U T I O N S
WIN7-10/ OSX 10.15.7
AC 5.1-25 USA