# Path: importerUtils.py
# def isEqual(a, b, e = 0.0001):
# 	if (a is None): return isEqual(b, CENTER)
# 	if (b is None): return isEqual(a, CENTER)
# 	return ((a - b).Length < e)
# 
# def getDumpFolder():
# 	global _dump_folder
# 	return _dump_folder
# 
# Path: importerUtils.py
# def logInfo(msg, *args):
# 	if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo",    Console.PrintMessage, msg, args)
# 
# def logWarning(msg, *args):
# 	if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args)
# 
# def logError(msg, *args):
# 	if (__prmPrefOW__.GetBool("checkError", True)):    _log("logError",   Console.PrintError,   msg, args)
# 
# def logAlways(msg, *args):
# 	_log("logAlways", Console.PrintMessage, msg, args)
# 
# def isEqual1D(a, b, e = 0.0001):
# 	if (a is None): return isEqual1D(b, 0.0)
# 	if (b is None): return isEqual1D(a, 0.0)
# 	return abs(a - b) < e
# 
# def getAuthor():
# 	return _author
# 
# def getDescription():
# 	return _description
# 
# def getColorDefault():
# 	global _colorDefault
# 	return _colorDefault
# 
# 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'


from datetime          import datetime
from importerUtils     import isEqual, getDumpFolder
from FreeCAD           import Vector as VEC, Placement as PLC
from importerUtils     import logInfo, logWarning, logError, logAlways, isEqual1D, getAuthor, getDescription, getColorDefault
from importerConstants import CENTER, DIR_X, DIR_Y, DIR_Z, ENCODING_FS
import traceback, inspect, os, sys, Acis, math, re, Part, io

	torus.placement = _createAxis2Placement3D('', center, 'Origin', axis, 'center_axis', ref, 'ref_axis')
	if (minor < 0.0): return torus, (sense != 'forward')
	return torus, (sense == 'forward')

def _createSurfaceFaceShape(acisFace, shape):
	surface = acisFace._surface.getSurface()
	if (isinstance(surface, Acis.SurfaceCone)):
		return _createSurfaceCone(surface.center, surface.axis, surface.cosine, surface.sine, surface.major, acisFace.sense)
	if (isinstance(surface, Acis.SurfacePlane)):
		return _createSurfacePlane(surface.root, surface.normal, acisFace.sense)
	if (isinstance(surface, Acis.SurfaceSphere)):
		return _createSurfaceSphere(surface.center, surface.radius, surface.pole, acisFace.sense)
	if (isinstance(surface, Acis.SurfaceTorus)):
		return _createSurfaceToroid(surface.major, surface.minor, surface.center, surface.axis, acisFace.sense)
	if (isinstance(shape, Part.BSplineSurface)):
		return _createSurfaceBSpline(shape, surface, acisFace.sense)
#	if (isinstance(shape, Part.Mesh)):
#		return _createSurfaceMesh(shape, acisFace.sense)
	if (isinstance(shape, Part.Cone)):
		return _createSurfaceCone(surface.center, surface.axis, surface.cosine, surface.sine, surface.major, acisFace.sense)
	if (isinstance(shape, Part.Cylinder)):
		return _createSurfaceCylinder(shape.Center, shape.Axis, shape.Radius, acisFace.sense)
	if (isinstance(shape, Part.Plane)):
		return _createSurfacePlane(shape.Position, shape.Axis, acisFace.sense)
	if (isinstance(shape, Part.Sphere)):
		return _createSurfaceSphere(surface.center, surface.radius, surface.pole, acisFace.sense)
	if (isinstance(shape, Part.SurfaceOfRevolution)):
		return _createSurfaceRevolution(surface.profile, surface.center, surface.axis, acisFace.sense)
	if (isinstance(shape, Part.Toroid)):
		return _createSurfaceToroid(surface.major, surface.minor, surface.center, surface.axis, acisFace.sense)

# Path: importerUtils.py
# def isEqual(a, b, e = 0.0001):
# 	if (a is None): return isEqual(b, CENTER)
# 	if (b is None): return isEqual(a, CENTER)
# 	return ((a - b).Length < e)
# 
# def getDumpFolder():
# 	global _dump_folder
# 	return _dump_folder
# 
# Path: importerUtils.py
# def logInfo(msg, *args):
# 	if (__prmPrefOW__.GetBool("checkLogging", False)): _log("logInfo",    Console.PrintMessage, msg, args)
# 
# def logWarning(msg, *args):
# 	if (__prmPrefOW__.GetBool("checkWarning", False)): _log("logWarning", Console.PrintWarning, msg, args)
# 
# def logError(msg, *args):
# 	if (__prmPrefOW__.GetBool("checkError", True)):    _log("logError",   Console.PrintError,   msg, args)
# 
# def logAlways(msg, *args):
# 	_log("logAlways", Console.PrintMessage, msg, args)
# 
# def isEqual1D(a, b, e = 0.0001):
# 	if (a is None): return isEqual1D(b, 0.0)
# 	if (b is None): return isEqual1D(a, 0.0)
# 	return abs(a - b) < e
# 
# def getAuthor():
# 	return _author
# 
# def getDescription():
# 	return _description
# 
# def getColorDefault():
# 	global _colorDefault
# 	return _colorDefault
# 
# 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: Acis2Step.py
from datetime          import datetime
from importerUtils     import isEqual, getDumpFolder
from FreeCAD           import Vector as VEC, Placement as PLC
from importerUtils     import logInfo, logWarning, logError, logAlways, isEqual1D, getAuthor, getDescription, getColorDefault
from importerConstants import CENTER, DIR_X, DIR_Y, DIR_Z, ENCODING_FS
import traceback, inspect, os, sys, Acis, math, re, Part, io

	torus.placement = _createAxis2Placement3D('', center, 'Origin', axis, 'center_axis', ref, 'ref_axis')
	if (minor < 0.0): return torus, (sense != 'forward')
	return torus, (sense == 'forward')

def _createSurfaceFaceShape(acisFace, shape):
	surface = acisFace._surface.getSurface()
	if (isinstance(surface, Acis.SurfaceCone)):
		return _createSurfaceCone(surface.center, surface.axis, surface.cosine, surface.sine, surface.major, acisFace.sense)
	if (isinstance(surface, Acis.SurfacePlane)):
		return _createSurfacePlane(surface.root, surface.normal, acisFace.sense)
	if (isinstance(surface, Acis.SurfaceSphere)):
		return _createSurfaceSphere(surface.center, surface.radius, surface.pole, acisFace.sense)
	if (isinstance(surface, Acis.SurfaceTorus)):
		return _createSurfaceToroid(surface.major, surface.minor, surface.center, surface.axis, acisFace.sense)
	if (isinstance(shape, Part.BSplineSurface)):
		return _createSurfaceBSpline(shape, surface, acisFace.sense)
#	if (isinstance(shape, Part.Mesh)):
#		return _createSurfaceMesh(shape, acisFace.sense)
	if (isinstance(shape, Part.Cone)):
		return _createSurfaceCone(surface.center, surface.axis, surface.cosine, surface.sine, surface.major, acisFace.sense)
	if (isinstance(shape, Part.Cylinder)):
		return _createSurfaceCylinder(shape.Center, shape.Axis, shape.Radius, acisFace.sense)
	if (isinstance(shape, Part.Plane)):
		return _createSurfacePlane(shape.Position, shape.Axis, acisFace.sense)
	if (isinstance(shape, Part.Sphere)):
		return _createSurfaceSphere(surface.center, surface.radius, surface.pole, acisFace.sense)
	if (isinstance(shape, Part.SurfaceOfRevolution)):
		return _createSurfaceRevolution(surface.profile, surface.center, surface.axis, acisFace.sense)
	if (isinstance(shape, Part.Toroid)):
		return _createSurfaceToroid(surface.major, surface.minor, surface.center, surface.axis, acisFace.sense)

	logWarning("Can't export surface '%s.%s'!" %(shape.__class__.__module__, shape.__class__.__name__))
