Home Forums KLayout Bending

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #6367
    Rose Shoaa
    Participant

    I would be grateful if you could help me with the following questions:

    I have structure consists of a box(rectangular) which two tapers are connected to it. I must put this structure on top of a ring resonator where the structure should completely fit in, how can I bend my structure according to the radius of the ring?
    Or, if it’s not possible, any suggestions?

    thanks

    Rose

    #6369
    Ronald
    Keymaster

    Dear Rose,

    Would you have a picture of what you like to achieve?

    Ronald

    #6370
    Rose Shoaa
    Participant

    Dear Ronald

    Thank you so much for your prompt reply. Can you please see the picture below.
    the picture of a box which has two tapers on both sides and needs to match the arch of a ring resonator
    with 100micron radius and 10 micron thickness.

    Many thanks in advance for your help.

    Kind regards
    Rose

    #6371
    Rose Shoaa
    Participant

    taper.box

    #6372
    Rose Shoaa
    Participant

    Dear Ronald,

    Thank you so much for your prompt reply. Can you please see the picture.
    The picture of a box which has two tapers on both sides and needs to match the arch of a ring resonator with 100micron radius and 10 micron thickness.
    The whole structure goes on top of  the ring resonator and needs to carve around it.
    I also attached the codes of my structure to give you a better idea of what I mean.
    Many thanks in advance for your help.

    Kind regards
    Rose

    #6373
    Ronald
    Keymaster

    Dear Rose,

    To make a polygon shape follow an “arbitrary” line would require to transform its polygon from the standard straight coordinate system to one that follows the line. For an arc you can do something like below, where the red shape is the original shape and the blue is wrapped on a circular arc:

    from math import sin, cos
    import nazca as nd
    
    def create_taper():
        """Create a taper shape as you see fit."""
        dh = 1
        s = 30
        N = 20
        points1 = []
        points2 = []
        for i in range(N + 1):
            scale = -0.5 + i / N
            points1.append((s*scale, dh * (1 - abs(scale))))
            points2.append((-s*scale, -dh *(1 - abs(scale))))
        return points1 + points2                   
        
    def bend_polygon(points=None, radius=10):
        """Bend a polygon along a circular arc."""
        pointsout = []
        # Conformal transformation to a circular grid:
        for x, y in points:
            x2 = (radius + y) * sin(x / radius)
            y2 = (radius + y) * cos(x / radius)
            pointsout.append((x2, y2))
        return pointsout
        
    with nd.Cell() as C:
        radius = 15
        points = create_taper()
        pointsbend = bend_polygon(points=points, radius=radius)
        nd.Polygon(points=points, layer=1).put(0, radius)
        nd.Polygon(points=pointsbend, layer=2).put(0)
    
    nd.export_png(C)

    Ronald

    #6374
    Rose Shoaa
    Participant

    Dear Ronald

    Thanks for your help.

    How can I generate a gds file from your codes?

    Whenever I run the codes, It shows nothing?

    Many Thanks

    Rose

    #6380
    Ronald
    Keymaster

    Dear Rose,

    It generates a png as the one shown in the post.
    You may need to add a line like plt.show().
    (to poke Matplotlib, import matplotlob.pyplot as plt)

    For gds you can use nd.export_gds(C)

    Ronald

    #6385
    Rose Shoaa
    Participant

    Dear Ronald

    Thanks for your response.
    I followed all your instructions but my gds file still shows nothing.
    It appears empty (no layers and…).
    Any suggestion?
    Many Thanks.

    Rose

    #6390
    Ronald
    Keymaster

    Dear Rose,

    If I copy paste the example with nd_export_plt() as provided and run in Spyder it shows the plot in the Spyder plot tab (Spyder4), as expected and shown in the post. If you do not see it, do you see any matplotlib output outside Nazca?

    If I copy paste the example and *replace* nd.export_plt(C) with nd.export_gds(C) it exports the gds as expected.

    Starting layout export...
    ...gds generation
    ...Wrote file './nazca_export.gds'

    Note-1

    nd_export_plt(C) # the C is needed as cell C is never put() in the example.
    # alternatively:
    C.put(0)
    nd_export_plt() # export the nazca main canvas having C on board.

    If you keep both plt and gds output commands you have to check the notes below.

    Note-2:

    nd_export_plt()  # deletes/resets the canvas after export
    nd_export_gds()  # nothing to draw

    Note-3:

    nd_export_plt(clear=False)  # does *not* delete the canvas
    nd_export_gds()  # now generates full gds

    Ronald

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