31 May 2018 at 08:41 #4210KYUNG HUN YOONParticipant
Dear, Nazca team,
How can I create a polygon subtracted one polygon from another polygon?
For example, I’d like to design a array of rectangles with a hexagon shape holes.31 May 2018 at 11:00 #4212RonaldKeymaster
Hi Kyung Hun Yoon,
Assuming you go the gds format in the end, the polygon should not have crossing lines and should have a “direction” such that if you travel along your polygon, the right hand side of your line always “points” to the area between your rectangle and hexagon. Here some ways to subtract a shape inside another shape:
1. Place the rectangle and hexagon in different mask layers and consider subtraction in a post-processing step on your mask. In KLayout for example you can perform boolean operations fast and efficiently (Edit/Layer/Boolean Operations).
2. Construct your polygon by adding the hexagon points to the rectangle points while taking into account the direction and the closure of the polygons (end-point = start-point), for example:
import nazca as nd square1 = [(0, -5), (5, 0), (0, 5), (-5, 0), (0, -5)] square2 = [(-10, -10), (10, -10), (10, 10), (-10, 10), (-10,-10)] diff = square2 + square1[::-1] # reverse direction of inner shape square1 nd.Polygon(layer=1, points=square1).put() nd.Polygon(layer=3, points=square2).put() nd.Polygon(layer=5, points=diff).put(30) nd.export_gds()
3. Use the pyclipper module in Nazca (nazca.clipper), however, this will not work well for a subtraction of shapes fully inside another shape, because pyclipper is not restricted to gds type of polygon concepts.
Ronald1 June 2018 at 08:11 #4221KYUNG HUN YOONParticipant
It was not successful to use pyclipper, but I got exactly what I want with the method 2.28 June 2018 at 16:47 #4448alvinMember
Can I do subtraction based on the whole layer so as to reverse the tone of the mask? Alternatively, is there any method written in the library to simply produce positive mask?28 June 2018 at 18:51 #4451XaveerModerator
A good solution is to define a large rectangle and use the boolean operations in (e.g.) KLayout to subtract all structures from it. The DRC engine in KLayout is an excellent tool to automate this if needed.
Another solution could be to let the mask manufacturer take care of the inversion. You can typically specify dark field or bright field polarity.
In principle you can use pyclipper and create a large rectangle and subtract all polygons in the layer you want to invert from it. However, since the pyclipper definition of gaps in a structure is not compatible with GDS, this will in general not work.
Xaveer3 February 2022 at 17:10 #6696XaveerModerator
Just an update on this topic: polygons with holes resulting from boolean opearations are now properly handled by recent versions of Nazca, provided the pyclipper module is installed.
- You must be logged in to reply to this topic.