axi/examples/paths.py

27 lines
699 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))
2018-01-29 18:44:44 +00:00
# print 'eliminating duplicate paths'
# d.paths = list(set([tuple(x) for x in d.paths]))
print 'joining paths'
d = d.join_paths(0.001)
2017-03-25 00:25:15 +00:00
print 'transforming paths'
2017-03-25 02:11:33 +00:00
d = d.scale(1, -1)
2017-03-25 00:25:15 +00:00
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'
2018-01-29 18:44:44 +00:00
d = d.join_paths(0.01)
2017-03-25 00:25:15 +00:00
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')
2018-01-29 18:44:44 +00:00
# axi.draw(d)
2017-01-16 03:03:12 +00:00
if __name__ == '__main__':
main()