# We can additionally use a LayerSet to add the same structure to several # layers at once by passing the whole layerset to the layer argument text4 = DL.add_ref(pg.text('All layers', size=10, layer=ls)).movey(-120) qp(DL) DL.write_gds('MultipleLayerText.gds') # If we want to examine any single layer, we can call them by their names, # for example gold_layer = ls['au'] print(ls['nb']) # We can quickly preview our color scheme using the LayerSet.preview() # function as well. P = pg.preview_layerset(ls) qp(P) P.write_gds('MyLayerSetPreview.gds') # We can even save the LayerSet as a KLayout .lyp file ("layer properties" file) # useful for getting the color scheme in KLayout to match quickplot import phidl.utilities as pu pu.write_lyp('MyLayerSetPreview.lyp', layerset=ls) #============================================================================== # Removing layers #============================================================================== # Now say we only wanted to get layers 4 and 5 from an imported. We can remove # the unwanted layers using the remove_layers() function D = pg.import_gds(filename='MyLayerSetPreview.gds')
qp(D) # quickplot the geometry create_image(D, 'import_gds') # example-preview_layerset import phidl.geometry as pg from phidl import quickplot as qp from phidl import LayerSet lys = LayerSet() lys.add_layer('p', color = 'lightblue', gds_layer = 1, gds_datatype = 0) lys.add_layer('p+', color = 'blue', gds_layer = 2, gds_datatype = 0) lys.add_layer('p++', color = 'darkblue', gds_layer = 3, gds_datatype = 0) lys.add_layer('n', color = 'lightgreen', gds_layer = 4, gds_datatype = 0) lys.add_layer('n+', color = 'green', gds_layer = 4, gds_datatype = 98) lys.add_layer('n++', color = 'darkgreen', gds_layer = 5, gds_datatype = 99) D = pg.preview_layerset(lys, size = 100, spacing = 100) qp(D) # quickplot the geometry create_image(D, 'preview_layerset') phidl.reset() # example-connector import phidl.geometry as pg from phidl import quickplot as qp D = pg.connector(midpoint = (0,0), width = 1, orientation = 0) qp(D) # quickplot the geometry create_image(D, 'connector') # example-compass import phidl.geometry as pg from phidl import quickplot as qp