# Path: importerUtils.py
# def getFloat64(data, offset):
# 	'''
# 	Returns a double precision float value.
# 	Args:
# 		data
# 			A binary string.
# 		offset
# 			The zero based offset of the array.
# 	Returns:
# 		The double precision float value at offset.
# 		The new position in the 'stream'.
# 	'''
# 	val, = FLOAT64(data, offset)
# 	return val, offset + 8
# 
# def getUInt32(data, offset):
# 	'''
# 	Returns a single unsingned 32-Bit value.
# 	Args:
# 		data
# 			A binary string.
# 		offset
# 			The zero based offset of the unsigned 32-Bit value.
# 	Returns:
# 		The unsigned 32-Bit value at offset.
# 		The new position in the 'stream'.
# 	'''
# 	val, = UINT32(data, offset)
# 	return val, offset + 4
# 
# def getUInt16(data, offset):
# 	'''
# 	Returns a single unsingned 16-Bit value.
# 	Args:
# 		data
# 			A binary string.
# 		offset
# 			The zero based offset of the unsigned 16-Bit value.
# 	Returns:
# 		The unsigned 16-Bit value at offset.
# 		The new position in the 'stream'.
# 	'''
# 	val, = UINT16(data, offset)
# 	return val, offset + 2
# 
# def FloatArr2Str(arr):
# 	return (', '.join(['%g' %(f) for f in arr]))
# 
# def logError(msg, *args):
# 	if (__prmPrefOW__.GetBool("checkError", True)):    _log("logError",   Console.PrintError,   msg, args)


from importerUtils import getFloat64, getUInt32, getUInt16, FloatArr2Str, logError
from FreeCAD         import Rotation as ROT, Vector as VEC, Matrix as MAT
import math

		self.m = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]

	def read(self, data, offset):
		n, k = getUInt32(data, offset)
		if (n == 0x00000203):
			i = k
		else:
			i = offset
		'''           +---- Value for the 4. row to be used for the transformation matrix
		              |+--- Value for the 3. row to be used for the transformation matrix
		              ||+-- Value for the 2. row to be used for the transformation matrix
		              |||+- Value for the 1. row to be used for the transformation matrix
		              ||||
		              vvvv '''
		d1, i = getUInt16(data, i)
		'''           +-------- Mask for the 4. row of the transformation matrix
		              |+------- Mask for the 3. row of the transformation matrix
		              ||+------ Mask for the 2. row of the transformation matrix
		              |||+----- Mask for the 1. row of the transformation matrix
		              ||||
		              vvvv'''
		d2, i = getUInt16(data, i)
		self.a0 = d1 | (d2 << 16)
		self.m = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]
		for row in range(4):
			for col in range(4):
				j = col + 4 * row
				b = (1 << j)
				if (d2 & b == 0):
					if (d1 & b == 0):

# Path: importerUtils.py
# def getFloat64(data, offset):
# 	'''
# 	Returns a double precision float value.
# 	Args:
# 		data
# 			A binary string.
# 		offset
# 			The zero based offset of the array.
# 	Returns:
# 		The double precision float value at offset.
# 		The new position in the 'stream'.
# 	'''
# 	val, = FLOAT64(data, offset)
# 	return val, offset + 8
# 
# def getUInt32(data, offset):
# 	'''
# 	Returns a single unsingned 32-Bit value.
# 	Args:
# 		data
# 			A binary string.
# 		offset
# 			The zero based offset of the unsigned 32-Bit value.
# 	Returns:
# 		The unsigned 32-Bit value at offset.
# 		The new position in the 'stream'.
# 	'''
# 	val, = UINT32(data, offset)
# 	return val, offset + 4
# 
# def getUInt16(data, offset):
# 	'''
# 	Returns a single unsingned 16-Bit value.
# 	Args:
# 		data
# 			A binary string.
# 		offset
# 			The zero based offset of the unsigned 16-Bit value.
# 	Returns:
# 		The unsigned 16-Bit value at offset.
# 		The new position in the 'stream'.
# 	'''
# 	val, = UINT16(data, offset)
# 	return val, offset + 2
# 
# def FloatArr2Str(arr):
# 	return (', '.join(['%g' %(f) for f in arr]))
# 
# def logError(msg, *args):
# 	if (__prmPrefOW__.GetBool("checkError", True)):    _log("logError",   Console.PrintError,   msg, args)


# Path: importerTransformation.py
from importerUtils import getFloat64, getUInt32, getUInt16, FloatArr2Str, logError
from FreeCAD         import Rotation as ROT, Vector as VEC, Matrix as MAT
import math

		self.m = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]

	def read(self, data, offset):
		n, k = getUInt32(data, offset)
		if (n == 0x00000203):
			i = k
		else:
			i = offset
		'''           +---- Value for the 4. row to be used for the transformation matrix
		              |+--- Value for the 3. row to be used for the transformation matrix
		              ||+-- Value for the 2. row to be used for the transformation matrix
		              |||+- Value for the 1. row to be used for the transformation matrix
		              ||||
		              vvvv '''
		d1, i = getUInt16(data, i)
		'''           +-------- Mask for the 4. row of the transformation matrix
		              |+------- Mask for the 3. row of the transformation matrix
		              ||+------ Mask for the 2. row of the transformation matrix
		              |||+----- Mask for the 1. row of the transformation matrix
		              ||||
		              vvvv'''
		d2, i = getUInt16(data, i)
		self.a0 = d1 | (d2 << 16)
		self.m = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]
		for row in range(4):
			for col in range(4):
				j = col + 4 * row
				b = (1 << j)
				if (d2 & b == 0):
					if (d1 & b == 0):

						value, i = getFloat64(data, i)
