lrp.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import svgwrite
  2. # 29.7 cm width 25 is a safe printable area
  3. # 21.9 cm width 17 is a safe
  4. def makePoly(document, numberOfCircles, radius, yval, colorOfFill, colorOfStroke):
  5. widthOfPage = float(document.attribs["width"][:-2])
  6. x = 0
  7. y = yval
  8. for n in range(numberOfCircles):
  9. positionOnPage = x * horizontal_distance
  10. document.add(document.circle(center=(positionOnPage, y),r=radius, fill = colorOfFill, stroke = colorOfStroke))
  11. if positionOnPage < 841:
  12. x += 1
  13. else:
  14. x = 0
  15. y += 50
  16. yy = 50
  17. for z in range(5):
  18. if z == 0:
  19. document.add(document.circle(center=(0, yy),r=radius, fill = 'black', stroke = 'black'))
  20. else:
  21. horizontal_total = (z * 1998)
  22. positionOnPageTwo = horizontal_total - (int(horizontal_total / 840) * 840)
  23. document.add(document.circle(center=(positionOnPageTwo, yy),r=radius, fill = 'black', stroke = 'black'))
  24. yy += 50 * (int((z * 1998)/840))
  25. svg_document = svgwrite.Drawing(filename = "hyperobject.svg", size = ("841.89px", "595.28px"))
  26. numberOfLargeCircles = 333
  27. numberOfSmallCircles = 5
  28. horizontal_distance = 30
  29. proportion_horizontal_distance = (333 / 5) * 30
  30. #makePoly(svg_document, numberOfSmallCircles, 2, 50, proportion_horizontal_distance, 'white', 'pink') # 820 first arg
  31. makePoly(svg_document, numberOfLargeCircles, 8, 75, 'red', 'red') # widthOfPage, numberOfCircle, radius, yval
  32. svg_document.save()