axi/examples/paths.py

25 lines
643 B
Python
Raw Normal View History

2017-01-16 03:03:12 +00:00
import axi
import sys
def main():
filename = sys.argv[1]
2017-03-25 00:25:15 +00:00
print 'loading paths'
2017-01-16 03:03:12 +00:00
d = axi.Drawing(axi.load_paths(filename))
2017-03-25 00:25:15 +00:00
print 'eliminating duplicate paths'
d.paths = list(set([tuple(x) for x in d.paths]))
print 'transforming paths'
# d = d.scale(1, -1)
d = d.rotate_and_scale_to_fit(12, 8.5, step=90)
print 'sorting paths'
2017-01-16 03:03:12 +00:00
d = d.sort_paths()
2017-03-25 00:25:15 +00:00
print 'joining paths'
d = d.join_paths(0.02)
print 'simplifying paths'
2017-01-16 03:03:12 +00:00
d = d.simplify_paths(0.001)
2017-03-25 00:25:15 +00:00
print 'rendering paths'
d.render(line_width=0.25/25.4).write_to_png('out.png')
# axi.draw(d)
2017-01-16 03:03:12 +00:00
if __name__ == '__main__':
main()