# Path: importerUtils.py
# def canImport():
# 	global _can_import
# 	return _can_import
# 
# 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 getAuthor():
# 	return _author
# 
# def getComment():
# 	global _comment
# 	return _comment
# 
# def getLastModifiedBy():
# 	global _lastModifiedBy
# 	return _lastModifiedBy
# 
# def setThumbnail(thumbnail):
# 	global _thumbnail
# 	_thumbnail = thumbnail
# 	return
# 
# Path: importerFreeCAD.py
# def createGroup(name):
# 	return newObject('App::DocumentObjectGroup', name)


import os, sys, FreeCAD, FreeCADGui, importerSAT, importerDXF, Import_IPT, importerF3D
import Acis, importerClasses
from importerUtils   import canImport, logInfo, logWarning, logError, logAlways, getAuthor, getComment, getLastModifiedBy, setThumbnail
from olefile         import isOleFile
from importerFreeCAD import createGroup
from pivy            import coin

				return Import_IPT
	elif (ext == '.ipn'):
		ole = Import_IPT.checkVersion(filename)
		if (ole):
			if (Import_IPT.read(ole)):
				return Import_IPT
	elif (ext == '.idw'):
		ole = Import_IPT.checkVersion(filename)
		if (ole):
			if (Import_IPT.read(ole)):
				return Import_IPT
	elif (ext == '.f3d'):
		if (importerF3D.read(filename)):
			return importerF3D
	return None

def isFileValid(filename):
	if (not os.path.exists(os.path.abspath(filename))):
		logError(u"File doesn't exists (%s)!", os.path.abspath(filename))
		return False
	if (not os.path.isfile(filename)):
		logError(u"Can't import folders!")
		return False
	if (filename.split(".")[-1].lower() in ("ipt", "iam", "ipn", "idw")):
		if (not isOleFile(filename)):
			logError(u"ERROR> '%s' is not a valid Autodesk Inventor file!", filename)
			return False
	return canImport()

def releaseMemory():

# Path: importerUtils.py
# def canImport():
# 	global _can_import
# 	return _can_import
# 
# 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 getAuthor():
# 	return _author
# 
# def getComment():
# 	global _comment
# 	return _comment
# 
# def getLastModifiedBy():
# 	global _lastModifiedBy
# 	return _lastModifiedBy
# 
# def setThumbnail(thumbnail):
# 	global _thumbnail
# 	_thumbnail = thumbnail
# 	return
# 
# Path: importerFreeCAD.py
# def createGroup(name):
# 	return newObject('App::DocumentObjectGroup', name)


# Path: importerIL.py
import os, sys, FreeCAD, FreeCADGui, importerSAT, importerDXF, Import_IPT, importerF3D
import Acis, importerClasses
from importerUtils   import canImport, logInfo, logWarning, logError, logAlways, getAuthor, getComment, getLastModifiedBy, setThumbnail
from olefile         import isOleFile
from importerFreeCAD import createGroup
from pivy            import coin

				return Import_IPT
	elif (ext == '.ipn'):
		ole = Import_IPT.checkVersion(filename)
		if (ole):
			if (Import_IPT.read(ole)):
				return Import_IPT
	elif (ext == '.idw'):
		ole = Import_IPT.checkVersion(filename)
		if (ole):
			if (Import_IPT.read(ole)):
				return Import_IPT
	elif (ext == '.f3d'):
		if (importerF3D.read(filename)):
			return importerF3D
	return None

def isFileValid(filename):
	if (not os.path.exists(os.path.abspath(filename))):
		logError(u"File doesn't exists (%s)!", os.path.abspath(filename))
		return False
	if (not os.path.isfile(filename)):
		logError(u"Can't import folders!")
		return False
	if (filename.split(".")[-1].lower() in ("ipt", "iam", "ipn", "idw")):
		if (not isOleFile(filename)):
			logError(u"ERROR> '%s' is not a valid Autodesk Inventor file!", filename)
			return False
	return canImport()

def releaseMemory():

	setThumbnail(None)
