Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/python
- head="""<?xml version="1.0" encoding="UTF-8" standalone="no"?>
- <svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="210mm"
- height="297mm"
- viewBox="0 0 744.09448819 1052.3622047"
- id="svg4135"
- version="1.1"
- inkscape:version="0.91 r13725"
- sodipodi:docname="drawing.svg">
- <sodipodi:namedview
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1"
- objecttolerance="10"
- gridtolerance="10"
- guidetolerance="10"
- inkscape:pageopacity="0"
- inkscape:pageshadow="2"
- inkscape:window-width="1414"
- inkscape:window-height="779"
- id="namedview8"
- showgrid="false"
- inkscape:zoom="14.352473"
- inkscape:cx="26.120517"
- inkscape:cy="18.909715"
- inkscape:window-x="172"
- inkscape:window-y="99"
- inkscape:window-maximized="0"
- inkscape:current-layer="svg4135" />
- <defs
- id="defs4137" />
- <metadata
- id="metadata4140">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title />
- </cc:Work>
- </rdf:RDF>
- </metadata>
- """
- bottom="</svg>"
- hexagono="""
- <path
- style="fill:none;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
- id="pathID"
- d="m XX,YY -2.7570672,4.7754 -5.5141344,0 -2.75706716,-4.7754 2.75706716,-4.7754 5.5141344,0 z" />
- """
- basex = 12
- basey = 1047
- columna = 0
- id = 1
- incrementox = 8.278261
- incrementy = 9.6132
- salida = ""
- axisx=basex
- axisy=basey
- while axisx<1487:
- while axisy>0:
- print "X:",axisx,"Y",axisy
- salida = salida + hexagono.replace("XX",str(axisx)).replace("YY",str(axisy)).replace("ID",str(id))
- axisy -= incrementy
- axisx += incrementox
- columna += 1
- if columna == 2:
- columna = 0
- if columna == 1:
- axisy = 1042.1934
- else:
- axisy = basey
- id += 1
- f=open("hexgrid.svg","w")
- f.write(head)
- f.write(salida)
- f.write(bottom)
- f.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement