Home Forums Nazca Questions and Answers Structure or loop too big? plus why can't I re-run same script? Reply To: Structure or loop too big? plus why can't I re-run same script?

#6190
Ronald
Keymaster

Dear Cameron.

When placing the text, its xpos and ypos are multiplied by i and j again in your script. This gives coordinates that are indeed out of range for gds, hence the error. Below a clean up that also utilizes the font you initialized.

import nazca as nd

cpitchx = 6000
cpitchy = 5500
offsety = 958
offsetx = 294
row = 24
col = 12

font = nd.Font('cousine') # create object to create text in the indicated font.
with nd.Cell(name='Cell_C') as cellc:
    for i in range(col):
        xpos = cpitchx * i + int(i / 2) * offsetx
        for j in range (row):
            num_r = f"{j}"
            #nd.text(text=num_r, height=100, layer=1, align='cc').put(cpitchx * i, cpitchy * j)
            num_c = f"c{i}r{j}"
            ypos = cpitchy * j + int(j / 2) * offsety
            font.text(text=num_c, height=100, layer=1, align='cc').put(xpos + 750, ypos)
cellc.put(0, 0, 0)
print('done')
nd.export_gds(filename='chip_numbers_space2.gds')

Ronald