# Path: importerConstants.py
# MIN_0   = 0.0
# 
# MIN_PI  = -pi
# 
# MIN_PI2 = -pi / 2
# 
# MIN_INF = float('-inf')
# 
# MAX_2PI = 2 * pi
# 
# MAX_PI  = pi
# 
# MAX_PI2 = pi / 2
# 
# MAX_INF = float('inf')
# 
# MAX_LEN = 2e+100
# 
# Path: importerConstants.py
# CENTER = VEC(0, 0, 0)
# 
# DIR_X  = VEC(1, 0, 0)
# 
# DIR_Y  = VEC(0, 1, 0)
# 
# DIR_Z  = VEC(0, 0, 1)
# 
# ENCODING_FS      = 'utf8'


import traceback, Part, Draft, os, FreeCAD, re
from importerUtils              import *
from FreeCAD                    import Vector as VEC, Rotation as ROT, Placement as PLC, Matrix as MAT, Base
from math                       import pi, fabs, degrees, asin, sin, cos, tan, atan2, ceil, e, cosh, sinh, tanh, acos, acosh, asin, asinh, atan, atanh, log, sqrt, exp, log10
from importerConstants          import MIN_0, MIN_PI, MIN_PI2, MIN_INF, MAX_2PI, MAX_PI, MAX_PI2, MAX_INF, MAX_LEN
from importerConstants          import CENTER, DIR_X, DIR_Y, DIR_Z, ENCODING_FS

			logError(traceback.format_exc())
			raise Exception("Unknown surface-type '%s'!" % (subtype))

		return surface, i
#FIXME: this is a dirty hack :(
	if (chunk.tag == TAG_DOUBLE):
		a, i = getFloats(chunks, index, 5)
		return None, i
	if (chunk.tag in [TAG_POSITION, TAG_VECTOR_3D]):
		a, i = getFloats(chunks, i, 2)
		return None, i

def getDiscontinuityInfo(chunks, index, inventor):
	a1, i = getFloatArray(chunks, index)
	a2, i = getFloatArray(chunks, i)
	a3, i = getFloatArray(chunks, i)
	a4, i = getFloatArray(chunks, i)
	a5, i = getFloatArray(chunks, i)
	a6, i = getFloatArray(chunks, i)
	if (inventor):
		e, i = getBoolean(chunks, i)
	else:
		e = False
	return (a1, a2, a3, a4, a5, a6, e), i

def rotateShape(shape, dir):
	# Setting the axis directly doesn't work for directions other than x-axis!
	angle = degrees(DIR_Z.getAngle(dir))
	if (isEqual1D(angle, 0)):
		axis = DIR_Z.cross(dir) if angle != 180 else DIR_X

# Path: importerConstants.py
# MIN_0   = 0.0
# 
# MIN_PI  = -pi
# 
# MIN_PI2 = -pi / 2
# 
# MIN_INF = float('-inf')
# 
# MAX_2PI = 2 * pi
# 
# MAX_PI  = pi
# 
# MAX_PI2 = pi / 2
# 
# MAX_INF = float('inf')
# 
# MAX_LEN = 2e+100
# 
# Path: importerConstants.py
# CENTER = VEC(0, 0, 0)
# 
# DIR_X  = VEC(1, 0, 0)
# 
# DIR_Y  = VEC(0, 1, 0)
# 
# DIR_Z  = VEC(0, 0, 1)
# 
# ENCODING_FS      = 'utf8'


# Path: Acis.py
import traceback, Part, Draft, os, FreeCAD, re
from importerUtils              import *
from FreeCAD                    import Vector as VEC, Rotation as ROT, Placement as PLC, Matrix as MAT, Base
from math                       import pi, fabs, degrees, asin, sin, cos, tan, atan2, ceil, e, cosh, sinh, tanh, acos, acosh, asin, asinh, atan, atanh, log, sqrt, exp, log10
from importerConstants          import MIN_0, MIN_PI, MIN_PI2, MIN_INF, MAX_2PI, MAX_PI, MAX_PI2, MAX_INF, MAX_LEN
from importerConstants          import CENTER, DIR_X, DIR_Y, DIR_Z, ENCODING_FS

			logError(traceback.format_exc())
			raise Exception("Unknown surface-type '%s'!" % (subtype))

		return surface, i
#FIXME: this is a dirty hack :(
	if (chunk.tag == TAG_DOUBLE):
		a, i = getFloats(chunks, index, 5)
		return None, i
	if (chunk.tag in [TAG_POSITION, TAG_VECTOR_3D]):
		a, i = getFloats(chunks, i, 2)
		return None, i

def getDiscontinuityInfo(chunks, index, inventor):
	a1, i = getFloatArray(chunks, index)
	a2, i = getFloatArray(chunks, i)
	a3, i = getFloatArray(chunks, i)
	a4, i = getFloatArray(chunks, i)
	a5, i = getFloatArray(chunks, i)
	a6, i = getFloatArray(chunks, i)
	if (inventor):
		e, i = getBoolean(chunks, i)
	else:
		e = False
	return (a1, a2, a3, a4, a5, a6, e), i

def rotateShape(shape, dir):
	# Setting the axis directly doesn't work for directions other than x-axis!
	angle = degrees(DIR_Z.getAngle(dir))
	if (isEqual1D(angle, 0)):
		axis = DIR_Z.cross(dir) if angle != 180 else DIR_X

		shape.rotate(PLC(CENTER, axis, angle))
