How to specify the property "index" when add rectangulars using struct

Hi,

Can we use addrect(struct) for adding rectangulars with specified indices?

I tried to use the script as bwblow

props = {“name”:“waveguide”,
“x”: 0,
“x span”: 1000e-9,
“y”: 0,
“y span”: 500e-9,
“z”: 0,
“z span”: 220e-9,
“index”: 1.44};
addrect(props);

But it doesn’t work with errors

1.unable to set property ‘index’: the value was modified after being set
2. error during property initialization, the requested object cannot be created

Thanks!

Hello @rcheng1,

The problem here is that the index is dependent on the material being ‘’. Though this is the default, so you would think that you should be able to pass index, it seems that when using the constructor, index is passed before the material is set. I have logged this as a bug, and until it is fixed I suggest you change the index after the object is initialized.

props = {‘name’:‘waveguide’,
‘x’: 0,
‘x span’: 1000e-9,
‘y’: 0,
‘y span’: 500e-9,
‘z’: 0,
‘z span’: 220e-9};
addrect(props);
set(‘index’,1.44);

Cheers,