如何在 gds-py 主模块中创建数组。我制作了一个多边形,我想创建一个相同的二维数组
How to create array in gds-py master module. I have made a polygon, I want to create an 2 d array of the same
import numpy
import gdspy
print('Using gdspy module version ' + gdspy.__version__)
First we need a cell to add the polygons to.
poly_cell = gdspy.Cell('POLYGONS')
我们通过顶点定义多边形。
points = [(15, 77), (15, 173), (77, 173), (77, 245), (173, 245), (173, 173), (245, 173),(245, 77), (173, 77), (173, 5), (77, 5), (77, 77),(15, 77)]
Create the polygon on layer 1.
poly1 = gdspy.Polygon(points, 1)
Create another polygon from the same set of points, but rotate it
180 degrees and add it to the cell.
poly1 = gdspy.Polygon(points, 1).rotate(numpy.pi/4)
poly_cell.add(poly1)
gdspy.gds_print('tutorial.gds', unit=1.0e-6, precision=1.0e-9)
gdspy.LayoutViewer()
您可以使用 CellArray 方法将您的单元格引用到插入到新单元格中的数组中。例如:
main = gdspy.Cell('Main')
main.add(gdspy.CellArray(poly_cell, 10, 10, (500, 500)))
查看结果:
gdspy.LayoutViewer()
加法说明。
import numpy
import gdspy
size_x = 1000
size_y = 1000
a_cell = gdspy.Cell('a')
a_cell.add(gdspy.Rectangle((0,0), (size_x, size_y), 2))
b_cell = gdspy.Cell('b')
#Array number x
quantity_x = 10
#Array number y
quantity_y =10
#Cell interval
#x interval
interval_x = 1000
#y interval
interval_y = 1000
#start cell position
#x position
position_x = 500
#y position
position_y = 500
b_cell.add(gdspy.CellArray('a', quantity_x, quantity_y,
(interval_x,interval_y), (position_x,position_y)))
import numpy
import gdspy
print('Using gdspy module version ' + gdspy.__version__)
First we need a cell to add the polygons to.
poly_cell = gdspy.Cell('POLYGONS')
我们通过顶点定义多边形。
points = [(15, 77), (15, 173), (77, 173), (77, 245), (173, 245), (173, 173), (245, 173),(245, 77), (173, 77), (173, 5), (77, 5), (77, 77),(15, 77)]
Create the polygon on layer 1.
poly1 = gdspy.Polygon(points, 1)
Create another polygon from the same set of points, but rotate it
180 degrees and add it to the cell.
poly1 = gdspy.Polygon(points, 1).rotate(numpy.pi/4)
poly_cell.add(poly1)
gdspy.gds_print('tutorial.gds', unit=1.0e-6, precision=1.0e-9)
gdspy.LayoutViewer()
您可以使用 CellArray 方法将您的单元格引用到插入到新单元格中的数组中。例如:
main = gdspy.Cell('Main')
main.add(gdspy.CellArray(poly_cell, 10, 10, (500, 500)))
查看结果:
gdspy.LayoutViewer()
加法说明。
import numpy
import gdspy
size_x = 1000
size_y = 1000
a_cell = gdspy.Cell('a')
a_cell.add(gdspy.Rectangle((0,0), (size_x, size_y), 2))
b_cell = gdspy.Cell('b')
#Array number x
quantity_x = 10
#Array number y
quantity_y =10
#Cell interval
#x interval
interval_x = 1000
#y interval
interval_y = 1000
#start cell position
#x position
position_x = 500
#y position
position_y = 500
b_cell.add(gdspy.CellArray('a', quantity_x, quantity_y,
(interval_x,interval_y), (position_x,position_y)))