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, shape.bbox.center.x/1000, shape.bbox.center.y/1000, shape.property(0), shape.property(1), shape.property(2), shape.property(3), shape.property(4), shape.property(5), shape.property(6), shape.property(7), shape.property(8) from shapes on layer 29/0 from instances of * where len(shape.property(1))>3


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

Thanks.
Thomas.

Comments

  • 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, b.center.x, b.center.y, shape.property(0), ... from shapes on layer 29/0 from instances of ..* where len(shape.property(1))>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 .. :(

    Matthias

  • 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.box = shape.bbox").execute(pya.CellView.active().layout())
    

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

    Matthias

Sign In or Register to comment.