Home Forums Nazca Polygon subtraction function

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #4210
    KYUNG HUN YOON
    Participant

    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.

    #4212
    Ronald
    Keymaster

    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.

    Ronald

    #4221
    KYUNG HUN YOON
    Participant

    Thank you.

    It was not successful to use pyclipper, but I got exactly what I want with the method 2.

    #4448
    alvin
    Member

    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?

    #4451
    Xaveer
    Moderator

    Dear Alvin,

    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.

    Xaveer

    #6696
    Xaveer
    Moderator

    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.

    Xaveer

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.