We have an exciting announcement about badges coming in May 2025. Until then, we will temporarily stop issuing new badges for course completions and certifications. However, all completions will be recorded and fulfilled after May 2025.
Photonics

Photonics

Topics related to Lumerical and more.

Creating a polygon with tilted sidewalls via python API

    • m.hoormann
      Subscriber

      Hello,

      I am trying to create a polygon with tilted sidewalls in python. I have adapted the script that is given as an example in the artical: Tips for adding sidewall angles to simulation objects – Ansys Optics

      My python code does look like this:

          name = "Angled WG"
          vertices_1 = np.array([[Epi["Total t"], -Data["Angled WG"]["w"]/2],  
                               [Epi["Total t"] + Data["Angled WG"]["t"], -Data["Angled WG"]["w"]/2],
                               [Epi["Total t"] + Data["Angled WG"]["t"], Data["Angled WG"]["w"]/2],
                               [Epi["Total t"], Data["Angled WG"]["w"]/2]
                               ])
         
          mode.addpoly()
          mode.set("vertices", vertices_1)
          vertices = mode.get("vertices")
          # print(vertices)

          mode.addlayerbuilder()

          mode.set("name", "WG")
          mode.set("geometry", {"1:0": vertices})
          mode.set("gds sidewall angle position reference", "Bottom")

          n_GaN = [n_e_GaN, n_o_GaN, n_o_GaN]
          material = name

          if mode.getmaterial(name) == str("The material, " + name + ", is not available."):
              mode.setmaterial(mode.addmaterial("(n,k) Material"), "name", material)

              mode.setmaterial(material, "Anisotropy", 1)                                             # Diagonal Anisotropy
              mode.setmaterial(
                  material, {"Refractive Index": np.array(n_GaN), "Imaginary Refractive Index": 0}
              )        

          mode.addlayer("WG Layer")
          mode.setlayer("WG Layer", "layer number", "1:0")
          mode.setlayer("WG Layer", "thickness", Data["Angled WG"]["t"])
          mode.setlayer("WG Layer", "pattern material", material)
          mode.setlayer("WG Layer", "sidewall angle", Data["Angled WG"]["angle"])

      The code runs, however, the polygon with the sidewalls is not created via the layer builder

       

      Could you help me with fixing this issue?

      Kind regards,

      Matthias Hoormann

    • Kirill
      Ansys Employee

      Hello Matthias,

      It seems you are not able to complete the layer setting with

      mode.set("geometry", {"1:0": vertices})


      Try to use

      mode.set("geometry", {"1:0": [vertices]})

      instead and see if it helps.

      Also, since you're calculating the vertices yourself, you can pass them directly to the LayerBuilder without the need to create an extruded polygon.

      Best regards,
      Kirill

Viewing 1 reply thread
  • You must be logged in to reply to this topic.