Delete instances of a cell

edited August 2012 in General
Hi,
great code which I am using for viewing large gds files.
However, I just wanted to set up a simple design in the editor mode where I defined a cell and placed several instances
of the cell at the top cell.
When I select one of these instances and want to delete it, all copies / instances of the cell disapear -
how can I delete just one instance of a cell?
Thanks
Stefan

KLayout 0.21.19 on WinXP SP3

Comments

  • edited November -1

    Hi Stefan,

    I guess you use "Delete cell" from the cell tree. This operation deletes the cell as a whole (and in consequence of that all instances of it).

    To delete a specific instance, reduce the hierarchy levels such that the instance you want to delete is shown as a box rather than by content. Then you can select this box and simply delete it as you would do with a shape. This operation does not delete the cell itself.

    Regards,

    Matthias

  • edited November -1
    Hi, Matthias,

    I want to delete specific cells in batch mode, if there is simple way to do it?
    Ex, the structure of example.gds is like following,

    1sttopcell
    2ndtopcell --> which is under 1sttopcell
    3_1topcell --> which is under 2ndtopcell
    3_2topcell --> which is under 2ndtopcell

    there are cells A, B, C, D, E under 3_1topcell
    there are cells A, E, X, Y, Z under 3_2topcell
    I want to delete cells A, Z in example.gds.

    Please tell me how to do it, thank you.

    Regards,
    Canny
  • edited November -1

    Hi Canny,

    do you mean to delete cells "A" and "Z" by name? Like selecting cell "A" in the hierarchy browser and use "Delete Cell" and do the same on "Z"?

    There is a huge difference whether that has to be done on a cell or instance basis.

    Regards,

    Matthias

  • edited November -1
    Hi, Matthias,

    Thank you and yes, I want to delete the cells by cell name, like you said.
    I also want to it could follow the option "Deep delete (delete cell plus subcells that not used otherwise" of delete cell function.

    Regards,
    Canny
  • edited November -1

    Hi Canny,

    the method you are looking for is the "prune_cell" method of the Layout object. Use "-1" as the second parameter to indicate that all hierarchy levels shall be considered.

    I.e.

    ly = .. # the layout
    [ "A", "Z" ].each do |name|
      ly.prune_cell(ly.cell_by_name(name), -1)
    end
    

    The code above is basically equivalent to using "Delete all cells plus subcells that are not used otherwise" on "A" and "Z".

    Regards,

    Matthias

  • edited November -1
    Hi, Matthias,

    It is very helpful and thank you for this nice function.

    Regards,
    Canny
Sign In or Register to comment.