You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
831B

  1. import pya
  2. #amount to shift in units of distance between images
  3. shift_x = 0
  4. shift_y = 0
  5. #vars on current sizes
  6. shift_mult = 5
  7. pixel_size = 20
  8. image_dist = (shift_mult * 3 * 2 + 2) * pixel_size * 100
  9. print(image_dist)
  10. #shift and take the overlap returning a 3rd layer
  11. ly = pya.CellView.active().layout()
  12. l10 = ly.layer(1, 0)
  13. l20 = ly.layer(2, 0)
  14. bbox = pya.Region()
  15. bbox.insert(ly.top_cell().bbox())
  16. #r10 = bbox - pya.Region(ly.top_cell().begin_shapes_rec(l10))
  17. #r20 = bbox - pya.Region(ly.top_cell().begin_shapes_rec(l20))
  18. r10 = pya.Region(ly.top_cell().begin_shapes_rec(l10))
  19. r20 = pya.Region(ly.top_cell().begin_shapes_rec(l20))
  20. r10.move(image_dist * shift_x, image_dist* shift_y)
  21. ly.delete_layer(ly.layer(3, 0))
  22. ly.top_cell().shapes(ly.layer(3, 0)).insert(bbox - (r10 | r20))
  23. pya.LayoutView.current().add_missing_layers()