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.

39 lines
1.3KB

  1. import pya
  2. import os
  3. base_dir = os.path.dirname(os.path.abspath(__file__))
  4. ly1 = pya.Layout()
  5. ly1.read(os.path.join(base_dir, "..", "gds", "alignment_marks_overlapped.gds"))
  6. ly2 = pya.Layout()
  7. ly2.read(os.path.join(base_dir, "..", "gds", "image_overlapped.gds"))
  8. ly1_top_cell = ly1.top_cell()
  9. tmp = ly1.create_cell("Image")
  10. tmp.copy_tree(ly2.top_cell())
  11. ly1_top_cell.insert(pya.CellInstArray(tmp.cell_index(), pya.Trans(3, False, 0, 0)))
  12. ly1.rename_cell(ly1_top_cell.cell_index(), "All")
  13. ly1_top_cell.flatten(1)
  14. ly1.write(os.path.join(base_dir, "..", "gds", "image_with_alignment_marks_overlapped.gds"))
  15. ly1 = pya.Layout()
  16. ly1.read(os.path.join(base_dir, "..", "gds", "inverted_tonality", "alignment_marks_overlapped_inverse.gds"))
  17. ly2 = pya.Layout()
  18. ly2.read(os.path.join(base_dir, "..", "gds", "inverted_tonality", "image_overlapped_inverse.gds"))
  19. ly2.top_cell().transform_into(pya.Trans(3, False, 0, 0))
  20. processor = pya.ShapeProcessor()
  21. processor.boolean(ly1, ly1.top_cell(), 0, ly2, ly2.top_cell(), 0, ly1.top_cell().shapes(0), 1, False, False, True)
  22. processor = pya.ShapeProcessor()
  23. processor.boolean(ly1, ly1.top_cell(), 1, ly2, ly2.top_cell(), 1, ly1.top_cell().shapes(1), 1, False, False, True)
  24. ly1.write(os.path.join(base_dir, "..", "gds", "inverted_tonality", "image_with_alignment_marks_overlapped_inverse.gds"))