# create a layout layout = pya.Layout() # set database unit to um layout.dbu = 0.001 # create layers l255 = layout.layer(255,0) l1 = layout.layer(1,0) # create the top cell cell_top = layout.create_cell("top") # create the cp cell cell_cp = layout.create_cell("SqSIPHA45W100nm") S = 0.0707 P = 70.7 # draw the cp pts = [pya.DPoint(-S,0), pya.DPoint(0, -S), pya.DPoint(S, 0), pya.DPoint(0, S)] cp = pya.DPolygon(pts) cell_cp.shapes(l1).insert(pya.DPolygon(pts)) array_cell_cp = pya.CellInstArray( cell_cp.cell_index(), pya.Trans(pya.Point(0,0)), pya.DVector (0, 0), pya.DVector (P, P), 1, 20) cell_top.insert(array_cell_cp) # export gds file #layout.write("/export/git-work/klayout-python/slanted-array-test.gds") layout.write("slanted-array-test.gds")