Convert a Compass plot file to XYZ pointcloud

def plt2xyz(fname):
	"""Convert a Compass plot file to XYZ pointcloud"""
	parser = CompassPltParser(fname)
	plt = parser.parse()

	for segment in plt:
		for command in segment:
			if command.cmd == 'd':
				if plt.utm_zone:
					x, y, z = command.x * FT_TO_M, command.y * FT_TO_M, command.z * FT_TO_M
				else:
					x, y, z = command.x, command.y, command.z
				print('%.3f\t%.3f\t%.3f' % (x, y, z))