[newbie] select instances by rotation angle

hello everyone.
i just starting tinkering with klayout. I have a top cell full of instances of the same daughter cell. Some of them have a rotation angle of 0 degrees, while some of them are rotated by 180 degrees. How can I select all and only instances which are rotated, keeping the rest unselected?
TIA

Comments

  • edited February 24

    Here is a recipe for version 0.29.11:

    • Select "Edit/Search and replace"
    • Assuming your current cell is called "TOP", enter the following custom query:
    instances of cell TOP.* where inst.trans.rot == 2
    
    • Push the Execute button. The result list will be filled with the instances that have orientation 180° (corresponding to rot == 2 as 180=2*90)
    • Click the "Export" menu button top right and select "To selection"

    Matthias

  • Thank you so much, Matthias! Sorry for my late reply, i was ill.
    It works just fine!
    I also tried another option, changing slightly the query in "where inst.trans.angle != 0"; although, it works correctly only with zero; when i typed 180 the angle gave erratic results, selecting all instances. It looks like a "contains" criterion is being performed, because 180 contains the figure 0 so it will select either 0 and 180...

  • edited March 5

    Hi @Clod,

    actually, the rotation angle of the "simple transformation" is encoded in multiples of 90 degree, so 0 = 0°, 1 = 90°, 2 = 180° and 3 = 270°. In addition the codes 4 to 7 encode additional mirroring at the x axis before the rotation.

    So checking rot != 180 will render all instances as the code is 0 to 7 only.

    There is a complex transformation available (that is "cplx_trans" instead of "trans") which also includes scaling and arbitrary angle rotations. This is rarely used in VLSI layouts, so it's not first choice. This features a float rotation angle and with this transformation, "angle != 180" is the right approach.

    Matthias

  • Understood. Thank you so much for your clear explaination!

Sign In or Register to comment.