heitzmann / gdspy

Python module for creating GDSII stream files, usually CAD layouts.
Boost Software License 1.0
352 stars 128 forks source link

how to do y_reflection with cell view. #216

Closed jamesvitali closed 2 years ago

jamesvitali commented 2 years ago

there is a param named "x_reflection" in gdspy.CellReference , but no method for the reflection to Y axis. If I would like to reflect the cell but not increase the final gds size , any way I can take? thanks

tvt173 commented 2 years ago

hi @jamesvitali, handy trick to remember-- a y_reflection is equivalent to an x_reflection + a 180 degree rotation!

jamesvitali commented 2 years ago

hi @tvt173 thanks for your help , but for cell, any way to do mirror over a line through points 1 and 2? thanks

tvt173 commented 2 years ago

hi @jamesvitali , i recommend you consider using a higher-level library, such as gdsfactory or phidl. they are both based on gdspy and have such a function as you are requesting. i don't believe gdspy has such a function.

I give examples for gdsfactory as that's what I use primarily:

API reference: https://gdsfactory.github.io/gdsfactory/_autosummary/gdsfactory.ComponentReference.html#gdsfactory.ComponentReference.mirror

Example: https://gdsfactory.github.io/gdsfactory/notebooks/02_movement.html image

or of course you can also just copy the code out of the mirror function in gdsfactory and use it if you prefer to stay in pure gdspy

heitzmann commented 2 years ago

@jamesvitali Any mirror operation can be accomplished by an x-reflection + rotation. If I'm not mistaken, to mirror along a specific line, you can do an x-reflection and rotate by twice the angle define between the axis and the x-axis.