#!/usr/bin/env python
"""With an .ib file as argument, turn the mesh inside out, so that 
each face faces in the opposite direction.
"""

import sys

if __name__ == '__main__':
	out = []
	with open(sys.argv[1], 'rb') as fi:
		while True:
			n = fi.read(6)
			assert(len(n) in [0, 6])
			if not n:
				break
			out.append(n[:2] + n[4:] + n[2:4])
	with open(sys.argv[1], 'wb') as fi:
		for n in out:
			fi.write(n)

