Thank you for your interesting question. First the solution:
A = cellA.put() cellB.put(A.pin['lb'].move(0, -50))
Hence, simply use the pin (Node) methods: move, rot, skip, offset.
It works as as follows:
A = cellA.put() # place cellA in cell 'nazca' as instance variable A cellB.put(A.pin['lb'].move(0, -50)) # connect cellB relative to pin['lb'] of instance A
It is best to avoid the cp syntax. The preferred syntax is simpler and more intuitive and lets Nazca do the thinking.
What happens in your first example is several things:
moves the “current pin” cp to a pin inside cellA. I assume here cellA is a Cell object and not an Instance.
generates a new pin (Node object) w.r.t. cp and places it in the present (active) Cell, i.e. cell ‘nazca’. However, this new pin is higher up in the hierarchy than cellA. It is not possible to connect pins between cell hierarchies. It violates (gds) hierarchy, hence the Exception.
If you insist on cp syntax, below is how do it right, i.e. connect to an instance of cellA, not to cellA directly:
A = cellA.put() nd.cp.goto_pin(A.pin['lb']) nd.cp.move(0, -50) cellB.put()
The take away is that the pins inside a “closed” or “finished” cell are not allowed for direct connection (the cell is closed). Instantiating the closed cell in the cell under construction, the active cell, however, creates new pins in the active cell, which can be connected to. Nazca will check for consistency to avoid topological errors in your gds.
In the second case:
nd.cp.goto_pin(cellA.pin['lb']) xya = nd.cp.here()
nothing new happens, xya is the same Node as after cp.goto_pin()
creates a new pin in cell ‘nazca’ based on the floats in (xya.x, xya.y), which are coordinates w.r.t. cellA!
this time over the connections are all inside cell ‘nazca’ and all seems well, but …, there is a catch from the previous lines of code: position (0, 50) is measured from the origin of cellA but applied w.r.t. origin of cell ‘nazca’.
An other case:
Note that in a similar way it is not allowed to connect cellB inside cellA after cellA was created:
cellB.put(cellA.pin['lb']) Exception: You are trying to connect to a closed Cell object
If you need cellB inside cellA simply put cellB there during the definition of cellA.