Search And Replace Query: translate found shapes into As-Seen-In-Top

I have embedded 9 user properties with shapes on a layer (29/0), and succeeded in extracting them back out. However, I would need the As-Seen-In-Top coordinates, and I am not entirely sure how to do that in this Query format. This is how far i got:

select cell_name,,,,,,,,,,, from shapes on layer 29/0 from instances of * where len(>3

Can anyone help me trying to tickle out the translated coordinates ?



  • Hi Thomas,

    there is a function called "path_trans" which will give you the (DBU unit) transformation into the top cell.

    I'd suggest this solution:

    select var b=(path_trans*shape.bbox)*layout.dbu; cell_name,,,, ... from shapes on layer 29/0 from instances of ..* where len(>3

    This also shows how to use variables ("var ...;" is injected before the first expression to set the "b" variable). This shortens the expression somewhat.

    I have also made a reference to layout.dbu instead of dividing by 1000. This solution is more universal.

    BTW: I apologize for the bad error messages in the expression parser. It's syntax is too flexible .. :(


  • beautiful ! worked nicely ! THANK YOU !

    can you have multiple of these search and replace actions in one ? I also use it to move fill shapes to another layer, and I need to do this for several layers. For some reason, I can never do more than 1 line.

  • Very good :)

    On the other hand - sorry, there is only a single line. You can stash your query in the list below and restore it if that is helpful.

    Basically, queries can also be issued from Python, like this:

    pya.LayoutQuery("with shapes on layer 67/20 from cells * do = shape.bbox").execute(

    here my query is with shapes on layer 67/20 from cells * do = shape.bbox. Please substitute yours.
    You can wrap that in a loop an execute multiple queries sequentially.


Sign In or Register to comment.