Search and Replace Custom Query: Converting Polygon Shapes to PCell Circles

I am a PhD student who inherited a mask from a since graduated student that was made with LEdit and has features going down to ~250nm. These features are intended to be "circles" and the larger 30um sized ones resemble it fairly well however as he went down to the features below 2um, they no longer resemble a circle and eventually become octagons, which would invalidate my experiment's results and analysis. I could manually convert the octagons and other small features by hand for each individual feature in the unit cell and array accordingly but that would be time consuming for me to do this on future masks when I could do it much more quickly and efficiently (I think) using the custom search and replace feature.

When looking online I wasn't able to find a way to convert polygons to pcell circles (which themselves are 64 sided polygons) in the API Reference Assistant. Basically, what would need to be the syntax to convert the polygon shapes in the custom query from "X" sided to "Y" sided (approximately a circle)?

I ran the following queries and got the corresponding error messaged:
with polygons on layer 2/0 from cells * where shape.area < 10 um2 do shape.polygon = shape.polygon.convert_to_pcell(Basic.CIRCLE)
I get the error message ("1") "Unknown variable or function "Basic" at position 48 (..Basic.CIRCLE))". If I remove "Basic." from the query the unknown variable changes to "Circle". When I change "(Basic.CIRCLE)" to "[Basic.CIRCLE]]" I got the error message "Expected end of text here: ]" When I get rid of the extra "]" behind "CIRCLE]]" I get back to error message (1). When I get rid of the "Basic.CIRCLE" portion and have it end with "convert_to_pcell" I get the error message "Unknown method 'convert_to_pcell' of class 'Polygon' at position ..."

I imagine I could somehow manually try to adjust the number of points in the polygon rather than go the PCell route, but I'm not really sure how I would go about that. Any insight would be appreciated!


  • Matthias's reply to the above question:
    In your case, converting the shapes to PCells is probably not worth the effort as a PCell is only generating polygons. You can do that directly using the following query:

    with polygons or boxes on layer 2/0 from cells * where shape.area < 10 um2 do shape.polygon = Polygon.ellipse(shape.bbox, 64)

    This will replace all shapes by a circle or ellipse inside the shape's original bounding box and using 64 points for representing it as a polygon. "polygons or boxes" is important as boxes are separate objects and may need to be captured too.

    My note to Matthias's reply for other beginners such as myself: The query is in fact case sensitive :smile:

  • @vrienzi96 Yes it is case sensitive :) And thanks for sharing this!

Sign In or Register to comment.