Closed
Description
Dear @klayoutmatthias,
In the manual operation, it is not possible to create a new cell with a name that already exists.
This is, of course, fine.
Manual Operation
In my PYA similar to below, I want to create some static cells from a PCell template.
PYA: dupCells-AAA.py
#
# Why can I have duplicated cells?
#
import pya
MainWindow = pya.MainWindow.instance()
CurrentView = MainWindow.current_view()
Layout = CurrentView.active_cellview().layout()
def AddMyDonut(newName):
global Layout
paraL = "layer"
paraR1 = "actual_radius1"
paraR2 = "actual_radius2"
paraN = "npoints"
params = dict()
params[paraL] = pya.LayerInfo(1, 0)
params[paraR1] = 50
params[paraR2] = 100
params[paraN] = 128
sbcell1 = Layout.create_cell( "DONUT", "Basic", params ).cell_index()
sbcell2 = Layout.convert_cell_to_static( sbcell1 )
print( "Cell ID: (PCell, Static)=(%d, %d)" % (sbcell1, sbcell2) )
# Expect an Exception if the cell name is duplicated
Layout.rename_cell( sbcell2, newName )
Layout.delete_cell( sbcell1 )
# Misuse
MyDonuts = [ "A", "A", "A" ]
# Correct use
#MyDonuts = [ "A", "B", "C" ]
for donut in MyDonuts:
AddMyDonut(donut)
print( " I'm going to SREF the generated donuts into the TOP cell." )
print( " I want AddMyDonut() function to detect the duplication of cell names." )
print( " Happy to have many grade-A donuts, though..." )
If I execute this PYA, I can get duplicated A cells.
PYA: dupCells-ABC.py
#
# Why can I have duplicated cells?
#
import pya
MainWindow = pya.MainWindow.instance()
CurrentView = MainWindow.current_view()
Layout = CurrentView.active_cellview().layout()
def AddMyDonut(newName):
global Layout
paraL = "layer"
paraR1 = "actual_radius1"
paraR2 = "actual_radius2"
paraN = "npoints"
params = dict()
params[paraL] = pya.LayerInfo(1, 0)
params[paraR1] = 50
params[paraR2] = 100
params[paraN] = 128
sbcell1 = Layout.create_cell( "DONUT", "Basic", params ).cell_index()
sbcell2 = Layout.convert_cell_to_static( sbcell1 )
print( "Cell ID: (PCell, Static)=(%d, %d)" % (sbcell1, sbcell2) )
# Expect an Exception if the cell name is duplicated
Layout.rename_cell( sbcell2, newName )
Layout.delete_cell( sbcell1 )
# Misuse
#MyDonuts = [ "A", "A", "A" ]
# Correct use
MyDonuts = [ "A", "B", "C" ]
for donut in MyDonuts:
AddMyDonut(donut)
print( " I'm going to SREF the generated donuts into the TOP cell." )
print( " I want AddMyDonut() function to detect the duplication of cell names." )
print( " Happy to have many grade-A donuts, though..." )
If I run this PYA, I can get what I want.
However, if I run the script twice, I get duplicated cells again.
It will be helpful if there is a mechanism to detect duplicated cell names in PYA/RBA, too.
This is a kind of fool-safe mechanism rather than an enhancement.
Regards,
Kazzz-S
Metadata
Metadata
Assignees
Labels
No labels