Home Forums Nazca temporary cells and flattened cells Reply To: temporary cells and flattened cells

#5740
Ronald
Keymaster

Dear Joe,

1. Cell creation and placing cells (the Nazca “put” method) in a layout are fundamentally two separate things and actually a core Nazca working principle. You can create a complete layout in a cell hierarchy, and as long as you do not instantiate the root cell of that hierarchy in a cell that is exported, it won’t be part of the exported layout. You can access all that cell’s information though and everything is calculated inside that root cell without ever putting it.

The cell renaming warning can always be resolved. Either by using the @hashme decorator, see https://nazca-design.org/hashme/ , or by assigning a cell to a variable instead of regenerating it multiple times in a function call.

Another way to reuse the cell name is to delete it from the cellnames dictionary, which also gets rid of the cell itself (via Python garbage collection if you don’t keep a reference to an object). I think that what you describe you want to do is to generate a cell definition multiple times with the same name, each time read something from it and delete it. Something like this?:

import nazca as nd

def give_me_a_cell(i):
    with nd.Cell('name') as C:
       # stuff in the cell
       pass
    return C

for i in range(100):
    A = give_me_a_cell(i=i)
    # read out stuff from cell A
    del nd.cfg.cellnames['name']

2. nd.Cell(instantiate=False) makes instances of this cell resolve in their parent(s) upon export. Interconnects, mask elements (like nd.strt) and stubs have instantiate=False by default. New user cells have instantiate=True by default.

Ronald