I’m “BRAND” new user in Lumerical. I will like to drawing for future simulation and structure with rounder corner. Basically is V shape polygon. Any tutorial available? Thanks in advance…

Rod.

# Drawing structures with rounder corner in FDTD

**rod**#1

Arc waveguide

Different triangular angles

How to setup a structure of a large sphere evenly coated by small spherical particles

**aya_zaki**#2

This can possible be done using scripting. If you check the structure script of the rectangular rounded extruded polygon in the library, you will find that its merely about defining all the vertices in an array and passing them to a polygon structure.

Here is the script of the round corner rectangle

```
> ##############################################
> # Rectangular polygon with rounded corners
> # A rectangular polygon with each corner rounded by a radius and custom resolution.
> #
> # Input properties
> # res: number of vertices to approximate roundness by
> # index: index of refraction for dielectric
> # material: material of object
> # x span, y span: lengths of the rectangle
> # z span: height of the rectangle
> # radius: radius of rounded corner
> #
> # Tags: quadrilateral extrusion rectangular rectangle polygon rounded corners
> #
> # Copyright 2011 Lumerical Solutions Inc
> ##############################################
> # simplify variable names by removing spaces
> x_span = %x span%;
> y_span = %y span%;
> z_span = %z span%;
> V=matrix(2,res*4); # vertices of polygon
>
> xc=x_span/2-radius;
> yc=y_span/2-radius;
> x_centers=[xc,xc,-xc,-xc];
> y_centers=[yc,-yc,-yc,yc];
> for (i=1:4) {
> # define curve points
> theta = (i-1)*pi/2 + linspace(0,pi/2,res);
>
> x_corner_tmp= x_centers(i) + radius*sin(theta);
> y_corner_tmp= y_centers(i) + radius*cos(theta);
> # add curve points to vertices
> V(1,1+(i-1)*res:i*res) = x_corner_tmp;
> V(2,1+(i-1)*res:i*res) = y_corner_tmp;
> }
>
> addpoly;
> set("x",0);
> set("y",0);
> set("z span",z_span);
> set("vertices",V);
> set("material",material);
> if(get("material")=="<Object defined dielectric>")
> { set("index",index); }
```

Rounded corner Structure design (isosceles triangle)

**konslekk**#3

Hi @rod

In Lumerical’s Knowledge base there are some examples. In MODE Solutions and FDTD solutions you can build any polygon you want. Also, there are some very useful python scripts. You can write python script or use directly the shapes that already exist in the object library. Here, you can find some useful information :

Structures - Polygon : https://kb.lumerical.com/en/index.html?ref_sim_obj_structures_polygon.html

Complex structures - Rounded corners: https://kb.lumerical.com/en/index.html?ref_sim_obj_creating_rounded_corners.html ( usr_round_corners.fsp)

Complex structures - Sidewall angle : https://kb.lumerical.com/en/index.html?ref_sim_obj_sidewall_angle.html ( usr_extrude_poly.lsf)

I hope that it helps !

**rod**#4

First I would like to Thanks you for the reply answer…my structure is basically a V shape with an angle of 75° . I was thinking create the structure from a primate Polygon and them extrude on Z direction, but I can’t find the wait to define the “vertices” on the example script. Another option will be from to rectangle overlapping , rounder the corners of this.

Its possible to create the structure in AutoCAD and them import it? This will be conflict at the simulation section?

**konslekk**#5

Hi @rod

I don’t think that AutoCAD has the possibility to export a GDS file. You could design the polygon layout in KLayout and then, import the GDS file in FDTD or MODE.

Please read this previous post :

Also, this page is very useful : https://kb.lumerical.com/en/index.html?ref_sim_obj_gdsii_import_export.html

And here there is the method of GDSII export automation with KLayout : https://kb.lumerical.com/en/index.html?ref_sim_obj_gdsii_auto_export.html

I hope that it helps .

**rod**#6

after a define my polygon (example :politest). How can I define the “vertices” that I want to rounder. What is "res’ on the script that you posted, sorry my lack of knowledge.

Thank you ,

Rod.

P.S:

Attached you will see the structure that I want to create. The dimension will be L= 400nm, W=140nm, H=150 with α = 75°. Those could be variables that a will playe in certain range during the simulation, I will say.

**aya_zaki**#7

Hi Rod,

“res” is the number of points (Vertices) in the round corner or we can say the resolution of the curve.

For the vertices you want to round, identify their center (like Xc and Yc). If the curvature is not the same for all vertices, then don’t use a for loop. Instead, define curve points to each vertex separately using the following lines of code.

```
# define curve points
theta = (i-1)*pi/2 + linspace(0,pi/2,res);
x_corner_tmp= x_centers(i) + radius*sin(theta);
y_corner_tmp= y_centers(i) + radius*cos(theta);
# add curve points to vertices
V(1,1+(i-1)res:ires) = x_corner_tmp;
V(2,1+(i-1)res:ires) = y_corner_tmp;
```

If this is still not clear, then please, start with writing a code for your V shape (without rounded edges ) and just post it here. Afterwards, we can modify it to rounded corners.

**rod**#8

Hi Aya_Zaki:

I really appreciate your time dedicate to find a solution on my issues with Lumerical project. If I go straight to structure an slect Polygon and start drawinf a ‘rpimitive V shape, Can I from overthere define my script to modify the corners? To be honest no idea how to write a simple script to drawing a primitive structure and how to difine the multiple point that will define the resolution of the corners. I attached a drawing with the ‘basic’ shape from where I suppose to rounder the corners to create the V-shape. Also how can accurate define the internal angle( A).

Thank you, Thank you, so much…

Rod.

**rod**#9

So far according with the code that you send me for my future rounder corner the center will (on a Cartesian coordinate system) define on the script ,

like the one on the picture?Thank you,

Rod

**rod**#10

Hi : Sorry to bother you…getting a little progress. From the structure drawing a figure out how to obtain the “Vertices” of them. From there, I must apply individually the last script that you send me to define the curve points from each individual corner? How can I transcript this “structure” to an script code on an easy way?

Thank you,

Rod.

**aya_zaki**#11

Hi @rod

It took some time to come up with a parameterized structure. Kindly, find attached a V-shape with rounded corner.

vshape.fsp (227.1 KB)

Here is how it looks:

Have fun and let me know how it works for you.

**rod**#12

Thank you, Thank you so much you are the Man…this going to help a lot just to start my project.

Keep in touch

**rod**#13

Hi Aya_Zaki:

After you create the structure group , I want to define the whole V-shape material properties( Si Palik , refractive index= 3.47). The only wait to do it is thought the script ?

Example: set(“Vshape_rd_extploy”,Si);

set(“index”, 3.47);

How can I define the mesh type(coarse, etc)

One more time , Thank you so much…

**aya_zaki**#14

Hi Rod,

I am so happy it works for you.

To keep things simple (without script), you can just edit the polygon under Vshape_rd_extpoly and modify the material as below:

**rod**#15

Well, if you take a look at the Yellow shadow message on top of the window for Edit Polygon …its no t possible to assign to your structure the Si data

Any other suggestion, I will love to keep simple that is the idea…

**aalam**#16

The structure group was created as a construction group. These types of groups do not allow external modifications of the children objects. The only way to modify the children is through the script.

**aya_zaki**#17

Yes, @rod, I am sorry. I was confused because this works when it is not a construction group and the material is not set in the script.

However, the solution is straight forward: 1) Add 2 new properties to the structure group {material, index}

2) Add this in the script:

set(“material”,Material);

if(get(“material”)=="")

{ set(“index”,index); }

Attached is the modified version of the structure.

vshape.fsp (227.3 KB)

**rod**#19

Hi Aya _Zaki:

```
One more time bother you.....
```

I’m really frustrate trying to simulate the model…basically I want to made the near and far-field projection to plot the polar graph of the scattering Electric Field and Magnetic field in the model… I found a couple of script examples doing this function but I can’t guess how to apply to my model…Now my laptop crash every time that I try to running the model…No idea to be honest…

Thanks in advance…

Rod.

P.S : COULD YOU TAKE A LOOK TO MY .fsp file?

vshapeV2.2Saturday.fsp (289 KB)