def save_gds(name): path = os.path.abspath(os.path.dirname(os.sys.argv[0])) + os.sep ## Output the layout to a GDSII file (default to all created cells). ## Set the units we used to micrometers and the precision to nanometers. gdspy.gds_print(path + name + '.gds', unit=1.0e-9, precision=1.0e-9) print('gds file saved: ' + name + '.gds')
def write_gds(self, layout, tech, target=None): """Paint the pages in a GDS file, with meta-data. :param target: A filename, file-like object, or :obj:`None`. :returns: list of gdspy.Cell objects, each corresponding to one page. """ # TODO: add custom cell names cells = [] for ii, cell in enumerate(layout): this_cell = gdspy.Cell('page ' + str(ii)) cell.draw(this_cell) # Don't think I need this... # write_pdf_metadata(self, file_obj, scale, self.metadata, attachments, # self.url_fetcher) if target is None: return cells else: # Cells are already a part of gdspy, don't need to add them. # TODO: add multi-lib support in gdspy gdspy.gds_print(target, unit=tech.units, precision=tech.precision)
def generateFabricationOutput(filenameNoExt, outDir, shapelyLayers): if outDir[-1] != '/': outDir += '/' outPath = outDir + filenameNoExt + '-fab.gds' logger.info("Converting geometry to GDSII.") topCell = gdspy.Cell('TOP') # Map layer name to GDS layer number per James e-mail layerNumberMap = { DxfConfig.METAL: 0, DxfConfig.SU8_1: 1, DxfConfig.SU8_2: 2, DxfConfig.SU8_3: 3, DxfConfig.LABEL: 10, DxfConfig.VPORT: 11, DxfConfig.POSTS: 12, DxfConfig.ALIGNMENT: 20, DxfConfig.BORDER: 21, DxfConfig.CRITICAL_BOND: 22 } for layerName, shapelyObjects in shapelyLayers.iteritems(): layerNumber = layerNumberMap[layerName] if layerName == DxfConfig.VPORT: # The 'shapelyObjects' will be dxfgrabber circles ... logger.info('Converting the VPORT layer') map( lambda circle: __convertDXFCircle2gds( topCell, circle, layerNumber), shapelyObjects) else: logger.info("Converting shapely geometry for layer " + layerName) map( lambda shape: __convertShapely2gds(topCell, shape, layerNumber ), shapelyObjects) gdspy.gds_print(outPath, unit=1.0e-6, precision=1.0e-9)
def write_gds(self, target=None, zoom=1, attachments=None): """Paint the pages in a GDS file, with meta-data. :param target: A filename, file-like object, or :obj:`None`. :type zoom: float :param zoom: This is ignored, for now. Not sure if I'll implement it. Here is description from original write_pdf(): The zoom factor in PDF units per CSS units. **Warning**: All CSS units (even physical, like ``cm``) are affected. For values other than 1, physical CSS units will thus be “wrong”. Page size declarations are affected too, even with keyword values like ``@page { size: A3 landscape; }`` :param attachments: A list of additional file attachments for the generated GDS document or :obj:`None`. The list's elements are :class:`Attachment` objects, filenames, URLs or file-like objects. :returns: list of gdspy.Cell objects, each corresponding to one page. """ # TODO: add control over unit/precision cells = [] for ii, page in enumerate(self.pages): this_cell = gdspy.Cell('page ' + str(ii)) page.paint_gds(this_cell) cells += [this_cell] # cells = cells.append(this_cell) # Don't think I need this... # write_pdf_metadata(self, file_obj, scale, self.metadata, attachments, # self.url_fetcher) if target is None: return cells else: # Cells are already a part of gdspy, don't need to add them. # FINISH ME: add multi-lib support in gdspy gdspy.gds_print(target, unit=1.0e-6, precision=5.0e-9)
for j in range(0, 3): idx = 3 * i + j totalLength = l4[idx] openDis = gaps[idx] capDist = 50 constantOffset = 15 distOffset = widths[idx] / 2 + gaps[idx] + constantOffset + dWidth * idx print(distOffset) cpwSrtExtend = 200 bendRad = 150 meanderLen = totalLength - openDis - capDist - cpwSrtExtend - pi * bendRad cpw = gdslib.CPWPath(1e-9, (widths[idx] + 2 * gaps[idx]) / 2 + 4, layer=8, cellName=device) cpw.start([1125 + 150 + distOffset + 2500 * i, 1900 + 1100 * j], '+y') cpw.openGap(openDis) cpw.straight(capDist) cpw.bend(bendRad, 'r') cpw.straight(cpwSrtExtend) cpw.bend(bendRad, 'r') cpw.meander(meanderLen, bendRad, 500, 'll') cpw.end() # DEVICE LABEL deviceText = gdspy.Text(deviceName, 250, (3000, 500), layer=4) device.add(deviceText) gdspy.LayoutViewer() gdspy.gds_print(deviceName + '.gds', unit=1.0e-6, precision=1.0e-9)
combined_cell.add(gdspy.CellReference(nfc, origin=(0, -ii * d))) combined_cell.add( gdspy.CellReference(nfc, origin=(2 * wgx + 2 * (taper_ii_l) + iii_v_l, wgy - ii * d), rotation=180, x_reflection=True)) combined_cell.add(gdspy.CellReference(nc, origin=(0, -ii * d))) combined_cell.add(gdspy.CellReference(amc, origin=(-alL, alL))) combined_cell.add( gdspy.CellReference(amc, origin=(+alL + final_pos[0], -final_pos[1] - alL))) ## ------------------------------------------------------------------ ## ## OUTPUT ## ## ------------------------------------------------------------------ ## ## Output the layout to a GDSII file (default to all created cells). ## Set the units we used to micrometers and the precision to nanometers. gdspy.gds_print(name + '.gds', unit=1.0e-6, precision=1.0e-9) print('Sample gds file saved: ' + name + '_mod.gds') ## ------------------------------------------------------------------ ## ## VIEWER ## ## ------------------------------------------------------------------ ## ## View the layout using a GUI. Full description of the controls can ## be found in the online help at http://gdspy.sourceforge.net/ #gdspy.LayoutViewer()
#for i in range(NumberOfDevices): # TaperStartPoint = StartPoint+array([i*1e+3,0]) # LengthBeforeBend += 10 # path = gdspy.Path(TaperRidgeWidth, TaperStartPoint, number_of_paths = 2, distance = TaperWidth + TaperRidgeWidth) # path.segment(layer, PreTaperLength, '+y') # ChipCell.add(polishMarks(layer,(path.x+125,path.y),'+y')) # ChipCell.add(gdspy.Text(layer, '%d'%(i) , 30,(path.x+35,path.y+50), angle = -0.5*pi)) # path.segment(layer, TaperLength, '+y', final_width = RidgeWidth, final_distance = WaveguideWidth + RidgeWidth) # path.segment(layer, LengthBeforeBend, '+y') # for r in range(3): # path.arc(layer, BendRadius, 0, 0.5*pi) # path.segment(layer, FieldSize-2*BendRadius, '-x') # path.arc(layer, BendRadius, 1.5*pi, pi) # path.segment(layer, SpectrometerInputPositionY-path.y, '+y') # ChipCell.add(polishMarks(layer,(-6.995e+3+i*1e+3,2.10e+3),'-y')) # ChipCell.add(path) #print 'area=',SpectrometerCell.area() #array = gdspy.CellArray(SpectrometerCell, 10, 1, (1e+3,0),origin=(-6e+3,0)) #ChipCell.add(array) gdspy.gds_view([VestedCell]) ChipCell = makeChipFrame() fp = open('chip22.gds','w') gdspy.gds_print(fp,cells=[VestedCell], unit=1, precision=1.0e-3) fp.close() fp = open('chip22Frame.gds','w') gdspy.gds_print(fp,cells=[ChipCell], unit=1, precision=1.0e-3) fp.close()
delta_x + delta_x, t_Zlow + gap), (x_start + l_res - 2 * delta_x + w_c, t_Zlow + gap - gndRes_h)] lowLeftGND = gdspy.Polygon(pointsLowLeft, 0) lowRightGND = gdspy.Polygon(pointsLowRight, 0) topLeftGND = gdspy.Polygon(pointsTopLeft, 0) topRightGND = gdspy.Polygon(pointsTopRight, 0) # cell.add(lowLeftGND) # cell.add(lowRightGND) # cell.add(topLeftGND) # cell.add(topRightGND) #%% ## Generate GDS ## ## ------------------------------------------------------------------ ## ## OUTPUT ## ## ------------------------------------------------------------------ ## # Output the layout to a GDSII file (default to all created cells). # Set the units we used to micrometers and the precision to nanometers. gdspy.gds_print(filepath + '\ ' + filename, unit=1.0e-6, precision=1.0e-9) print('gds file saved to "' + filepath + '\ ' + filename + '"') ## ------------------------------------------------------------------ ## ## VIEWER ## ## ------------------------------------------------------------------ ## # View the layout using a GUI. Full description of the controls can # be found in the online help at http://gdspy.sourceforge.net/ gdspy.LayoutViewer() print('Finished!')
label2 = gdspy.copy(label1, 0,-20) trans_cell.add(text1) trans_cell.add(text2) trans_cell.add(label1) trans_cell.add(label2) ## ------------------------------------------------------------------ ## ## OUTPUT ## ------------------------------------------------------------------ ## ## Output the layout to a GDSII file (default to all created cells). ## Set the units we used to micrometers and the precision to nanometers. gdspy.gds_print('tutorial.gds', unit=1.0e-6, precision=1.0e-9) ## ------------------------------------------------------------------ ## ## IMPORT ## ------------------------------------------------------------------ ## ## Import the file we just created, and extract the cell 'POLYGONS'. To ## avoid naming conflict, we will rename all cells. gdsii = gdspy.GdsImport('tutorial.gds', rename={'POLYGONS':'IMPORT_POLY', 'PATHS': 'IMPORT_PATHS', 'OPERATIONS': 'IMPORT_OPER', 'SLICE': 'IMPORT_SLICE', 'REFS': 'IMPORT_REFS',
imp_inner = 13 imp_outer = 17 ni_inner = 13 ni_outer = 19 UBM_radius = 19.0/2 po_radius = 12.5/2 contact_radius = 10/2 #Timepix3 metal_radius=20 imp_radius=15 contact_radius=7.5 po_radius=15 GenerateRoundPixel(pitchX,pitchY,metal_radius,imp_radius,contact_radius,po_radius) #GenerateSquarePixel(pitchX,pitchY,al_inner,al_outer,imp_inner,imp_outer,ni_inner,ni_outer,po_radius,contact_radius,UBM_radius,'PIXEL') #GenerateGuardRings(npixX*pitchX,npixY*pitchY, [0], [5], [5], 3., cellname='GR',3) GenerateEdge(pitchX,pitchY,npixX,npixY,edge-(pitchX/2.-imp_radius),50) GeneratePixelArray('PIXEL','EDGE',npixX,npixY,pitchX,pitchY,'TOP') # Save GDSII to File name = os.path.abspath(os.path.dirname(os.sys.argv[0])) + os.sep +\ 'Timepix3_%ix%i_ADVACAM2014_%ium_edges_v2'%(npixX,npixY,edge) gdspy.gds_print(name + '.gds', unit=1.0e-6, precision=1.0e-9) print('Sample gds file saved: ' + name + '.gds')
label1 = gdspy.Label('Created with gdspy ' + gdspy.__version__, (-7, -36), 'nw', layer=6) label2 = gdspy.copy(label1, 0, -20) trans_cell.add(text1) trans_cell.add(text2) trans_cell.add(label1) trans_cell.add(label2) # ------------------------------------------------------------------ # # OUTPUT # ------------------------------------------------------------------ # # Output the layout to a GDSII file (default to all created cells). # Set the units we used to micrometers and the precision to nanometers. gdspy.gds_print('tutorial.gds', unit=1.0e-6, precision=1.0e-9) # ------------------------------------------------------------------ # # IMPORT # ------------------------------------------------------------------ # # Import the file we just created, and extract the cell 'POLYGONS'. To # avoid naming conflict, we will rename all cells. gdsii = gdspy.GdsImport('tutorial.gds', rename={ 'POLYGONS': 'IMPORT_POLY', 'PATHS': 'IMPORT_PATHS', 'OPERATIONS': 'IMPORT_OPER', 'SLICE': 'IMPORT_SLICE', 'REFS': 'IMPORT_REFS', 'TRANS': 'IMPORT_TRANS'
from context import strange import numpy import gdspy from lxml import etree ## Do parsing parser = etree.HTMLParser() try: document = etree.parse("./inputs/artist-test_css.html", parser) except etree.XMLSyntaxError, e: print(e.error_log) artist = strange.artist(1e-6, 1e-9) cells = artist.drawGDS(document) # Output GDS gdspy.gds_print('./outputs/visualTest_artist.gds', unit=1.0e-6, precision=5.0e-9) # Look at the results gdspy.LayoutViewer(cells=cells)
def Draw_Mask(Save_Path = '.', Through_Line_Layer = 1, Resonator_Trace_Layer = 2, Pillar_Layer = 3): #For Test Only! Remove when deployed gdspy.Cell.cell_dict = {} # Obtain Sensor Parapeters Mask_Params = Mask_DB.Get_Mask_Data("SELECT X_Length, Y_Length, Rows, Columns FROM Wafer WHERE wafer_id = 1",'all') #sql_cmd = "SELECT X_Length, Y_Length, Rows, Columns FROM Wafer WHERE id = 1" #Cursor.execute(sql_cmd) #Mask_Params = Cursor.fetchall() Mask_Cell_X_Length, Mask_Cell_Y_Length, Mask_Rows, Mask_Columns= Mask_Params[0] # Obtain list of sensor ids Sensor_Nums = Mask_DB.Get_Mask_Data("SELECT sensor_id FROM Sensors",'all') #sql_cmd = "SELECT id, Sensor FROM Sensors" #Cursor.execute(sql_cmd) #Sensor_Nums = Cursor.fetchall() #Initialize Mask Cell mask_cell_name = 'MASK' global mask_cell mask_cell = gdspy.Cell(mask_cell_name) sens_index = 0 for col in xrange(Mask_Columns): for row in xrange(Mask_Rows): global current_sensor_origin current_sensor_origin = np.array([Mask_Cell_X_Length*row + -Mask_Cell_X_Length*Mask_Rows/2, -Mask_Cell_Y_Length*(col+1) + Mask_Cell_Y_Length*Mask_Columns/2]) print('row %i, col %i' % (row,col)) sensor_cell = Draw_Sensor(Sensor_Nums[sens_index][0], Through_Line_Layer = Through_Line_Layer, Resonator_Trace_Layer = Resonator_Trace_Layer, Pillar_Layer = Pillar_Layer) mask_cell.add(gdspy.CellReference(sensor_cell, tuple(current_sensor_origin))) sens_index += 1 #Add text for all cells incldings the sensor labels and the resonator labels mask_cell.add(gdspy.CellReference(text_cell, (0,0))) ################## # Draw Alignment Marks ################## def draw_alignment(Inner_Cross_Layer, Outer_Cross_Layer,Inner_Cross_Thickness,Outer_Cross_Thickness,Outer_Cross_Width, Guidelines = True, Outer_Only = False, *arg): """ Inner_Cross_Thickness is line width of cross Outer_Cross_Thickness is line width of outer cross Outer_Cross_Width is overall width and height of cross Guidelines = True -- draws stepped guidlines which point to alignment cross Outer_Only = True -- draws only the outer features on each layer: Inner_Cross_Layer, Outer_Cross_Layer if Outer_Cross_Thickness == 0 only the inner features are drawn on each layer: Inner_Cross_Layer, Outer_Cross_Layer """ Inner_Cross_Thickness = float(Inner_Cross_Thickness) Outer_Cross_Thickness = float(Outer_Cross_Thickness) Outer_Cross_Width = float(Outer_Cross_Width) if arg is not (): ang = arg[0] else: ang = 0 def draw_cross(Layer,cross_line_width,cross_width): """cross_line_width is line width of cross cross_width is Overall width and height of cross """ P_1 = gdspy.Path(cross_line_width, (-cross_width/2, 0)) P_1.segment(cross_width, '+x', layer = Layer) P_2 = gdspy.Path(cross_line_width, (0,-cross_width/2)) P_2.segment((cross_width/2)-(cross_line_width/2), '+y', layer = Layer) P_3 = gdspy.Path(cross_line_width, (P_2.x,P_2.y+cross_line_width)) P_3.segment((cross_width/2)-(cross_line_width/2), '+y', layer = Layer) return P_1.polygons+P_2.polygons+ P_3.polygons def draw_guide_lines(Layer,Line_Width_Start,Length,Steps): polygons = [] for i in xrange(1,Steps+1): polygons.append(gdspy.Path(Line_Width_Start*i,(Outer_Cross_Width/2 + Inner_Cross_Thickness +(i-1)*(Length/Steps),0)).segment(Length/Steps,'+x',layer = Layer).polygons) for i in xrange(1,Steps+1): polygons.append(gdspy.Path(Line_Width_Start*i,(-(Outer_Cross_Width/2 + Inner_Cross_Thickness +(i-1)*(Length/Steps)),0)).segment(Length/Steps,'-x', layer = Layer).polygons) return reduce(lambda x, y: x+y,polygons) cross_line_width = Inner_Cross_Thickness #line width of cross cross_width = Outer_Cross_Width - 2*Outer_Cross_Thickness # overall width and height of cross i = draw_cross(Inner_Cross_Layer,cross_line_width,cross_width) inner_cross_poly_set = gdspy.PolygonSet(i, layer =Inner_Cross_Layer ).rotate(ang, center=(0, 0)) if Outer_Cross_Thickness==0: o = draw_cross(Outer_Cross_Layer,cross_line_width,cross_width) outer_cross_poly_set = gdspy.PolygonSet(o, layer =Outer_Cross_Layer ).rotate(ang, center=(0, 0)) else: o = draw_cross(Outer_Cross_Layer,3*cross_line_width,Outer_Cross_Width) primitives = [gdspy.PolygonSet(i, layer = 0),gdspy.PolygonSet( o, layer = 0)] subtraction = lambda p1, p2: p2 and not p1 outer_cross_poly_set = gdspy.boolean( primitives, subtraction, max_points=199,layer =Outer_Cross_Layer).rotate(ang, center=(0, 0)) if Outer_Only == True: inner_cross_poly_set = gdspy.boolean( primitives, subtraction, max_points=199,layer =Inner_Cross_Layer ).rotate(ang, center=(0, 0)) poly_set_list = [inner_cross_poly_set, outer_cross_poly_set] if Guidelines == True: guide_line_length = 5*Outer_Cross_Width num_steps = 3 gi = draw_guide_lines(Inner_Cross_Layer,Inner_Cross_Thickness,guide_line_length,num_steps) inner_guide_line_poly_set = gdspy.PolygonSet( gi, layer =Inner_Cross_Layer ) if Outer_Cross_Thickness==0: go = draw_guide_lines(Outer_Cross_Layer,Inner_Cross_Thickness,guide_line_length,num_steps) outer_guide_line_poly_set = gdspy.PolygonSet( go, layer =Outer_Cross_Layer ) else: go = draw_guide_lines(Outer_Cross_Layer,2*Outer_Cross_Thickness+Inner_Cross_Thickness ,guide_line_length,num_steps) primitives = [gdspy.PolygonSet(gi, layer = 0),gdspy.PolygonSet( go, layer = 0 )] subtraction = lambda p1, p2: p2 and not p1 outer_guide_line_poly_set = gdspy.boolean(primitives, subtraction, max_points=199, layer =Inner_Cross_Layer ) if Outer_Only == True: inner_guide_line_poly_set = gdspy.boolean(primitives, subtraction, max_points=199, layer =Inner_Cross_Layer ) poly_set_list.append(inner_guide_line_poly_set) poly_set_list.append(outer_guide_line_poly_set) align_cell = gdspy.Cell('Alignment_Mark', exclude_from_global=True) align_cell.add(poly_set_list) return align_cell align_mark_y_separation = 400. align_mark_x_separation = 48600. align_mark_set_separation = 10800. align_cell1 = draw_alignment(Pillar_Layer, Resonator_Trace_Layer,10,10,200,True,True,0*np.pi/4) #Outer_Only == True because Pillar_Layerwill be polarity reversed align_cell2 = draw_alignment(Through_Line_Layer, Resonator_Trace_Layer,5,5,200,True,False,np.pi/4) align_cell_ref = gdspy.CellArray(align_cell1, 2, 2, [align_mark_x_separation,align_mark_y_separation], origin=(-align_mark_x_separation/2, -align_mark_y_separation/2), rotation=None, magnification=None, x_reflection=False) mask_cell.add(align_cell_ref) align_cell_ref = gdspy.CellArray(align_cell2, 2, 2, [align_mark_x_separation+align_mark_set_separation,align_mark_y_separation], origin=(-(align_mark_x_separation+align_mark_set_separation)/2, -align_mark_y_separation/2), rotation=None, magnification=None, x_reflection=False) mask_cell.add(align_cell_ref) name = Save_Path + os.sep + 'mask' mask_cell.flatten() #name = os.path.abspath(os.path.dirname(os.sys.argv[0])) + os.sep + 'mask' ## Output the layout to a GDSII file (default to all created cells). ## Set the units we used to micrometers and the precision to nanometers. gdspy.gds_print(name + '.gds', unit=1.0e-6, precision=1.0e-9) print('gds file saved: ' + name + '.gds') ## Save an image of the boolean cell in a png file. Resolution refers ## to the number of pixels per unit in the layout. Resolution changed from 4 ## to 1 to avoid "malloc_error" #gdspy.gds_image([resonator_cell], image_name=name, resolution=1, antialias=4) #comment out save as png for speed #print('Image of the boolean cell saved: ' + name + '.png') ## Import the file we just created, and extract the cell 'POLYGONS'. To ## avoid naming conflict, we will rename all cells. #gdsii = gdspy.GdsImport(name + '.gds', rename={sensor_cell_name:'IMPORT_SENSOR'}) ## Now we extract the cells we want to actually include in our current ## structure. Note that the referenced cells will be automatically ## extracted as well. #gdsii.extract(sensor_cell_name) ## View the layout using a GUI. Full description of the controls can ## be found in the online help at http://gdspy.sourceforge.net/ #gdspy.LayoutViewer(colors=[None] * 64) # for outlined polygons gdspy.LayoutViewer()
while True: box = extract_box(img,y) if not box: break (x,y,x2,y2) = box c.add(gdspy.Rectangle(gds_layer, (x,height-y), (x2,height-y2))) # parse command-line arguments name = sys.argv[1] scale = sys.argv[2] # GDS initialization c = gdspy.Cell(name) # GDS layers layer(c,"diffusion.png",1) layer(c,"implant.png",2) layer(c,"buried.png",3) layer(c,"poly.png",4) layer(c,"contact.png",5) layer(c,"metal.png",6) layer(c,"overglass.png",7) # GDS finalize import sys gdspy.gds_print(sys.stdout, unit=float('%se-6'%scale), precision=1.0e-9)
gdsii3.extract('base_for_clear_mark3') gdsii3.extract('clear_layer_mark3') poly_cell.add(gdspy.CellReference('base_for_clear_mark3', (40000-245+30-500, 750))) poly_cell.add(gdspy.CellReference('clear_layer_mark3', (40000-245+30-500, 750))) poly_cell.add(gdspy.CellReference('base_for_clear_mark3', (-40000-245+30+500, 750))) poly_cell.add(gdspy.CellReference('clear_layer_mark3', (-40000-245+30+500, 750))) gdsii2 = gdspy.GdsImport('ks_MA6_ff_4in.gds', layers = {1:3, 2:50}) gdsii2.extract('Cell0') poly_cell.add(gdspy.CellReference('Cell0', (0, 0))) #ref_cell.add(gdspy.CellReference('ff', (0, 0))) gdspy.gds_print('attractorv3.gds', unit=1.0e-6, precision=1.0e-9) ## ------------------------------------------------------------------ ## ## VIEWER ## ## ------------------------------------------------------------------ ## ## View the layout using a GUI. Full description of the controls can ## be found in the online help at http://gdspy.sourceforge.net/ gdspy.LayoutViewer()
assert( filecmp.cmp( './tests/outputs/artist-test_tech_only.gds', './tests/outputs/artist-test_tech_only-truth.gds' ) ) def test_css(self): ## Do parsing parser = etree.HTMLParser() try: document = etree.parse("./tests/inputs/artist-test_css.html", parser) except etree.XMLSyntaxError, e: print(e.error_log) cells = self.thisArtist.drawGDS(document,'artist-test_css') # Output GDS gdspy.gds_print('./tests/outputs/artist-test_css.gds', unit=1.0e-6, precision=5.0e-9) assert( filecmp.cmp( './tests/outputs/artist-test_css.gds', './tests/outputs/artist-test_css-truth.gds' ) )
import numpy import gdspy path_cell = gdspy.Cell('PATHS') path1 = gdspy.Path(1, (0, 0)) spec = {'layer': 1, 'datatype': 1} path1.arc(2, -numpy.pi , numpy.pi , **spec) path_cell.add(path1) gdspy.gds_print('teste1.gds', unit=1.0e-6, precision=1.0e-9) gdspy.LayoutViewer()
meanderLen = totalLength - openDis - couplingDist - 3*cpwSrtExtend - 3*pi*bendRad/2 cpw = gdslib.CPWPath(10,5,layer = 6, cellName = device) # ALTERNATE BETWEEN TOP AND BOTTOM SIDE OF FEEDLINE if mod(i,2) == 0: cpw.start([2100 - 750 + 625 + 200 + 1700*i,3000 + 15 + openDis + 2*cpwSrtExtend + bendRad],'-y') bendDir = 'r' meanderDir = 'll' else: cpw.start([2100 - 750 + 625 + 200 + 1700*i,3000 - 15 - openDis - 2*cpwSrtExtend - bendRad],'+y') bendDir = 'l' meanderDir = 'rr' cpw.straight(2*cpwSrtExtend) cpw.bend(bendRad, bendDir) cpw.straight(couplingDist) cpw.bend(bendRad, bendDir) cpw.straight(cpwSrtExtend) cpw.bend(bendRad, bendDir) cpw.meander(meanderLen, bendRad, 500,meanderDir) cpw.openGap(openDis) cpw.end() print(cpw.len()) # DEVICE LABEL deviceText = gdspy.Text(deviceName, 250, (3000,250), layer=4) device.add(deviceText) gdspy.gds_print(deviceName + '.gds', unit=1.0e-6, precision=1.0e-9) gdspy.LayoutViewer()
box = extract_box(img, y) if not box: break (x, y, x2, y2) = box c.add(gdspy.Rectangle(gds_layer, (x, height - y), (x2, height - y2))) # parse command-line arguments name = sys.argv[1] scale = sys.argv[2] # GDS initialization c = gdspy.Cell(name) # GDS layers layer(c, "diffusion.png", 1) layer(c, "implant.png", 2) layer(c, "buried.png", 3) layer(c, "poly.png", 4) layer(c, "contact.png", 5) layer(c, "metal.png", 6) layer(c, "overglass.png", 7) # GDS finalize import sys gdspy.gds_print(sys.stdout, unit=float('%se-6' % scale), precision=1.0e-9)
## Labels are special text objects which don't define any actual ## geometry, but can be used to annotate the drawing. Rotation, ## magnification and reflection of the text are not supported by the ## included GUI, but they are included in the resulting GDSII file. ref_cell.add(gdspy.Label('Created with gdspy ' + gdspy.__version__, (-7, -36), 'nw', layer=6)) ## ------------------------------------------------------------------ ## ## OUTPUT ## ------------------------------------------------------------------ ## ## Output the layout to a GDSII file (default to all created cells). ## Set the units we used to micrometers and the precision to nanometers. gdspy.gds_print('./outputs/tutorial.gds', unit=1.0e-6, precision=1.0e-9) ## ------------------------------------------------------------------ ## ## IMPORT ## ------------------------------------------------------------------ ## ## Import the file we just created, and extract the cell 'POLYGONS'. To ## avoid naming conflict, we will rename all cells. gdsii = gdspy.GdsImport('./outputs/tutorial.gds', rename={'POLYGONS':'IMPORT_POLY', 'PATHS': 'IMPORT_PATHS', 'BOOLEAN': 'IMPORT_BOOL', 'SLICE': 'IMPORT_SLICE', 'REFS': 'IMPORT_REFS'},
def export(filename): global __precision__ global __unit__ gdspy.gds_print(filename, unit=__unit__, precision=__precision__)