Custom complex geometry script


Hi all,

Is there a way to create a custom geometric structure via a script and/or is is this the right approach. First, I want to create a custom multicore fiber, using cylinders somehow. Then, I want to taper that multicore fiber into a multimode fiber (essentially creating a photonic lantern) using truncated cones.

Any thoughts?


Hi, @jkoehl !

I do not see any problems in creating the structure you need by script.
For cones in the tapers you can use the script provided here: How to draw a (truncated) cone in DEVICE using the 'planar solid' object

Try to write a script and keep us informed :slight_smile:


Hi, @msaygin
I have the same problem on create multicore fibre. I have tried to combine a cylinder with a pc array but it didn’t work. there were always some overlapping areas and the refractive index of both the center core and outer core would be wrong as a result.



then provide a script to better understand the problem )


Hi @msaygin,

Is there an example that’s for MODE solutions?



Hi @msaygin,

Nevermind that, I copy and pasted it into MODE. :innocent:



Hi @msaygin,

I there a method with which I can acquire the script for a ring structure? Will ‘getdata’ work or does a script exist that can be linked?

If I had that, I think I could build the PL.



I have already used Meshorder to solve this problem, thank you all the same :slight_smile:



Here is the list of lumerical commands that can be used:

Usually, a structure geometry starts with add…, so for ring the command is addring.
I don’t quite understand what you meant in getdata.


Hi @msaygin,

What I’d like to find is an example of how to create the geometry of a ring structure or possibly extract and modify the vertices and facets from addring. Unfortunately, I didn’t find anything like that. :frowning:

But I have attempted to write a script that will create the ring structure. After reading both How to draw a (truncated) cone in DEVICE using the 'planar solid' object and I thought I had a good handle on it. However, I can’t seem to draw it correctly, as the ring script doesn’t draw the bottom facets of the ring. Sadly, I can’t figure out why. Could you (or anyone) take a look? cladding_ring.lsf (2.5 KB)

Coincidentally, when I copy/paste the planar solid “cube” example into the MODE script file editor and run it, it also fails to draw a few of the facets.

Thanks for your help.


Here’s a slightly different approach, based on the truncated cone. I receive an “invalid planar solid” error. Could someone look at this one? Seems like I’m close, but missing something. cladding_ring2.lsf (2.5 KB)



I didn’t understand what mesh order was when you mentioned it, but now I get it. :slight_smile:

Thank you


Hi @jkoehl

I had a look at the script, not too sure where the error is, so I started from scratch:

> for(i=1:4*seg) {
>     a{i} = cell(1);
> }
> for(i=1:seg) {
>     #out facet
>     if (i == seg ) {
>         a{i}{1} = [i,1,seg+1,2*seg];
>     } else {
>         a{i}{1} = [i,i+1,seg+i+1,seg+i];
>     }
>     #in facet
>     if (i == seg) {
>         a{seg+i}{1} = [2*seg+i,2*seg+1,3*seg+1,4*seg];
>     } else {
>         a{seg+i}{1} = [2*seg+i,2*seg+i+1,3*seg+i+1,3*seg+i];
>     }
>     #bot
>     if (i == seg) {
>         a{2*seg+i}{1} = [i,1,2*seg+1,3*seg];
>     } else {
>         a{2*seg+i}{1} = [i,i+1,2*seg+i+1,2*seg+i];
>     }
>     #top
>     if (i == seg) {
>         a{3*seg+i}{1} = [seg+i,seg+1,3*seg+1,4*seg];
>     } else {
>         a{3*seg+i}{1} = [seg+i,seg+i+1,3*seg+i+1,3*seg+i];
>     }    
> }

I think the main difference is, I only used 1 cell per facet, and I got rid of the Bc terms in x,y,z.