# 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

		if (not isOleFile(filename)):
			logError(u"ERROR> '%s' is not a valid Autodesk Inventor file!", filename)
			return False
	return canImport()

def releaseMemory():
	setThumbnail(None)
	Acis.releaseMemory()
	importerClasses.releaseModel()

def adjustView(doc):
	if (FreeCAD.GuiUp):
		# adjust camara position and orientation
		g = FreeCADGui.getDocument(doc.Name)
		v = g.ActiveView
		c = v.getCameraNode()
		p = coin.SbVec3f(1, 1, 1)
		o = coin.SbVec3f(0, 0, 0)
		u = coin.SbVec3f(0, 1, 0)
		c.position.setValue(p)
		c.pointAt( o, u )
		FreeCADGui.SendMsgToActiveView("ViewFit")

def insert(filename, docname, skip = [], only = [], root = None):
	'''
	opens an Autodesk Inventor file in the current document
	'''
	doc = FreeCAD.listDocuments().get(docname)
	if (doc):
		if (isFileValid(filename)):

# 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

		if (not isOleFile(filename)):
			logError(u"ERROR> '%s' is not a valid Autodesk Inventor file!", filename)
			return False
	return canImport()

def releaseMemory():
	setThumbnail(None)
	Acis.releaseMemory()
	importerClasses.releaseModel()

def adjustView(doc):
	if (FreeCAD.GuiUp):
		# adjust camara position and orientation
		g = FreeCADGui.getDocument(doc.Name)
		v = g.ActiveView
		c = v.getCameraNode()
		p = coin.SbVec3f(1, 1, 1)
		o = coin.SbVec3f(0, 0, 0)
		u = coin.SbVec3f(0, 1, 0)
		c.position.setValue(p)
		c.pointAt( o, u )
		FreeCADGui.SendMsgToActiveView("ViewFit")

def insert(filename, docname, skip = [], only = [], root = None):
	'''
	opens an Autodesk Inventor file in the current document
	'''
	doc = FreeCAD.listDocuments().get(docname)
	if (doc):
		if (isFileValid(filename)):

			logAlways(u"Importing: %s", filename)
