## Photonics

#### modeling problem

• 2212296
Subscriber

1.How to connect two cubes into a whole (code instructions)？

2.How to perform symmetrical operations on graphics (code instructions)

thank you all ！

• Guilin Sun
Ansys Employee

I am not sure what do you mean "connect". You can use script to modify their relative positions:
setnamed("cube1","x",-1e-6);

setnamed("cube2","x",1e-6);

similarly for yz.

You can also add them into a structure group: https://optics.ansys.com/hc/en-us/articles/360034382434-Structure-Groups-Simulation-object

Symmetry can only be performed with boundary conditions. When the device AND the source polarization have symmetry, you can apply symmetry BCs. Using

?getnamed("FDTD","x min bc");  to get the current x min BC. you can set it:

setnamed("FDTD","x min bc","symmetric"); for symmetric BC

setnamed("FDTD","x min bc","anti-symmetric"); for antisymmetric BC

Other direction is similar.

Other

• 2212296
Subscriber

Sorry, I may not have described it accurately.

1. Connection: It is to connect individual small graphics into a whole, and then mirror the whole.
2. 2, I mean to mirror the pattern. How to use code to achieve?
• Guilin Sun
Ansys Employee

It might be able to realize.  When an object is mirrored, at least one of the coordinate (xmax,ymax and zmax) will be flipped. if so, you can rotate the object 180 deg, and shift it.

For example, rotate am object 180deg and shift -2e-6 along x.

setnamed("object_name","first axis","z");

setnamed("object_name","rotation 1", 180);

setnamed("object_name","x",-2e-6);

Below are triangles, the right one is the original, and the left one is rotated and shifted.

When you say connect, do you mean add them into a group. yes, it is also doable: addstructuregroup - Script command

There are related script. Please try. If you have question using script, please write a new post.