Home Forums Nazca bbox bug Reply To: bbox bug


Dear Joe,

Thank you for the example. This may look surprising, but it is expected behaviour.

A bbox of a cell is a rectangular shape in the native orientation of the block. Let’s say you draw a thin diagonal line from (0, 0) to (1, 1), then the bbox is bottom-left (0, 0) to top right (1, 1), but the upper left and bottom right corner of the bbox (square) are empty. If you rotate the bbox by -45 degree, the diagonal is a vertical line and the bbox a diamond shape. If you place this in another cell it will see the diamond left and right tips “pushing” the parent bbox.

The bend example is similar; Interconnects in Nazca by default (by choice) are not instantiated when exported to gds (they are nazca internally cells, actually a stack of cells, each with a bbox), so you do not see that diamond bbox anymore. But you do see it pushing the bbox of cell main. The bbox is visualized in the example below.

Nazca does also have a convex hull option as boundary. Such hull will always make the structure “touch” the parent bbox. But also that touching is optional, because you can still ask a parent cell to either use the hull (if present) or the rectangular bbox of the instance to calculate the bounding box. Calculating a hull costs (much) more time, so it is not used in mask elements or interconnects.

import nazca as nd

from nazca import cp, Cell
from nazca.interconnects import Interconnect as IC

#  Interconnect settings
XS = 'xs1'
nd.add_layer2xsection(xsection=XS, layer=1)
IC_1 = IC(width=1, radius=80, xs=XS)

with Cell('bend', autobbox=True) as bend:

# main
with Cell('main', autobbox=True) as main:
    bend.put(0, 0, 45)

nd.export_gds(topcells=main, filename='bbox_test.gds')