I am trying to generate a layout containing several cells and I wish to avoid to regenerate the same cells over and over. I understand how this can be done with a single cell using the hashme decorator, but I have some doubts on how to set up my script, which contains nested cells and functions defining parametrized cells.
I do not understand:
– Where is the best place to place all the @hashme lines ? If I collect them all together at the beginning of the script, I receive a warning.
– What is the effect of the ‘hashme = True’ parameter ? The cell seems to be hashed anyway.
– Why do some of the hashed cells contain an additional name identifier ‘_$####’ and others do not?
– Why some of the cells end up with a text field listing their parameters, and others not?
– Is there an alternative way to tell Nazca to always check for already generated cells (based e.g. on the cell name), rather than having to manage this decorator for each cell?
Below an example code, where the ‘mmi1x2’ cells gets the additional name identifier, but no parameter string printed, differently from the ‘cm’ cells.
with nd.Cell(‘MMI_1x2’, hashme = True) as mmi1x2:
with nd.Cell(name=’cm’, autobbox = True, hashme = True) as cm:
All cells generated by hashed function calls have the _$#### hash suffix as unique identifier.
In newer Nazca versions (0.5.7 and up) the hashme=True has become optional in de Cell() call.
The hashme decorator does not only check for the cell name, but for the full call profile and it generates a unique cell name based on that (with the hash). You can also manage cell names yourself and simply send or generate a unique cell name every time you call your cell generating function. Hashme does all the work for you in one line with a few characters in case of parametrized cells.