qp(X2) # In this case X2 is empty -- therefore E1 and E3 are identical! # We can double-check this by computing the area of each device print('E1 != E2 because X1 is not blank: it has total polygon area %s' % X1.area()) print('E1 == E3 because X2 is blank: it has total polygon area %s' % X2.area()) #============================================================================== # Removing geometry #============================================================================== # If you want, you can remove DeviceReferences or Polygons with D.remove() # Let's add some geometry to a blank Device D: D = Device() myell1 = D.add_ref(pg.L()) mytee2 = D.add_ref(pg.tee().movex(15)) mypoly1 = D.add_polygon([(8, 6, 7, 9), (6, 8, 9, 5)]) mypoly2 = D.add_polygon([(0, 0), (1, 1), (1, 3), (-3, 3)]).movey(-5) qp(D) # Now we can remove two of the elements we don't want anymore D.remove(mytee2) D.remove(mypoly2) qp(D) #============================================================================== # Save / export to SVG #============================================================================== # For figure-quality publications sometimes you want to save your geometry # as a more convenient vector file format like SVG (for Inkscape, Illustrator, # etc). For that purpose you can use the write_svg() command
# example-flagpole import phidl.geometry as pg from phidl import quickplot as qp D = pg.flagpole(size = (50,25), stub_size = (4,8), shape = 'p', taper_type = 'fillet', layer = 0) # taper_type should be None, 'fillet', or 'straight' qp(D) # quickplot the geometry create_image(D, 'flagpole') # example-tee import phidl.geometry as pg from phidl import quickplot as qp D = pg.tee(size = (8,4), stub_size = (1,2), taper_type = 'fillet', layer = 0) # taper_type should be None, 'fillet', or 'straight' qp(D) # quickplot the geometry create_image(D, 'tee') # example-taper import phidl.geometry as pg from phidl import quickplot as qp D = pg.taper(length = 10, width1 = 6, width2 = 4, port = None, layer = 0) qp(D) # quickplot the geometry create_image(D, 'taper') # example-ramp import phidl.geometry as pg