Home Forums Nazca Identify Cells already created Reply To: Identify Cells already created

#5920
Daneel
Member

Hello Ronald,

I have another follow-up question on that topic.

I have a function which defines a cell which itself consists of several subcells. Is it possible to use the hasme = True statement with the last cell, which is returned by the function? If I do it like that I receive an exceptio: Exception: Detected a call nd.Cell(hashme=True) without first calling the @hashme(‘cellname’) decorator with a non-empty ‘cellname’.

Does that mean the hashme only works with one cell per function, does the cell which is hashed has to be follow the function definition directly or do i have to hash each cell in the function?

import nazca as nd
import nazca.geometries as geom

@nd.bb_util.hashme('rectangle', 'length', 'width') # gives default cell name 'rectangle_80_80'
def rectangles(length=80, width=80):
    with nd.Cell('Text') as text:
        nd.text(text = 'Rectangle' + str(length) +' ,' + str(width),
        height = 30, layer = 'Label', align='cc').put(0,0)

    with nd.Cell(hashme=True) as rectangle:
        rect = geom.box(length=length, width=width)
        nd.Polygon(points=rect).put(0, 0)
        text.put(100,0)
    
    return rectangle

rectangles().put()
rectangles().put()

nd.export_gds()