qp(D) # quickplot the geometry create_image(D, 'arc') # example-straight import phidl.geometry as pg from phidl import quickplot as qp D = pg.straight(size = (4,2), layer = 0) qp(D) # quickplot the geometry create_image(D, 'straight') # example-L import phidl.geometry as pg from phidl import quickplot as qp D = pg.L(width = 7, size = (10,20) , layer = 0) qp(D) # quickplot the geometry create_image(D, 'L') # example-C import phidl.geometry as pg from phidl import quickplot as qp D = pg.C(width = 7, size = (10,20) , layer = 0) qp(D) # quickplot the geometry create_image(D, 'C') # example-offset import phidl.geometry as pg from phidl import quickplot as qp from phidl import Device
X2 = pg.xor_diff(A=E1, B=E3) 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,
def test_L(): D = pg.L(width=1, size=(10, 20), layer=0) h = D.hash_geometry(precision=1e-4) assert (h == 'fc8e0a442ddc6f348876c14da19fcdaf0024705a')