draw_bottom_layer.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import time
  2. import ezdxf
  3. doc = ezdxf.new('R2000')
  4. msp = doc.modelspace()
  5. out_width = 10374
  6. out_height = 8593
  7. start_point = (0, 0)
  8. first_point_row = 375
  9. first_point_col = 1000
  10. msp.add_line(start_point, (start_point[0], start_point[1] + first_point_col))
  11. msp.add_line(start_point, (start_point[0] + first_point_row, start_point[1]))
  12. msp.add_line(start_point,(start_point[0],start_point[1]+out_height))
  13. msp.add_line(start_point,(start_point[0]+out_width,start_point[1]))
  14. msp.add_line((start_point[0] + out_width, start_point[1]), (start_point[0] + out_width, start_point[1] + out_height))
  15. msp.add_line((start_point[0]+out_width,start_point[1]+out_height),(start_point[0]+out_width,start_point[1]+out_height))
  16. msp.add_line(start_point,(start_point[0],start_point[1]+out_height))
  17. msp.add_line(start_point,(start_point[0]+out_width,start_point[1]))
  18. msp.add_line((start_point[0] + out_width, start_point[1]), (start_point[0] + out_width, start_point[1] + out_height))
  19. msp.add_line((start_point[0]+out_width,start_point[1]+out_height),(start_point[0]+out_width,start_point[1]+out_height))
  20. cursor_col = start_point[1] + first_point_col
  21. while (cursor_col < out_height):
  22. msp.add_line((start_point[0], cursor_col), ((start_point[0] + out_width), cursor_col))
  23. cursor_col = cursor_col + 1000
  24. cursor_row = start_point[0] + first_point_row
  25. while (cursor_row < out_width):
  26. msp.add_line((cursor_row, start_point[1]), (cursor_row, (start_point[1] + out_height)))
  27. cursor_row = cursor_row + 1000
  28. a = time.time()
  29. doc.saveas(f'save/bottom{str(a)}.dxf')