# 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

		self.uvorigin = CENTER
		self.sensev   = 'forward_v'
		self.urange   = Interval(Range('I', MIN_0), Range('I', MAX_2PI))
		self.vrange   = Interval(Range('I', MIN_0), Range('I', MAX_2PI))
	def getSatTextGeometry(self, index): return "%s %s %s %s %s %s %s %s #" %(vec2sat(self.center), vec2sat(self.axis), self.major, self.minor, vec2sat(self.uvorigin), self.sensev, self.urange, self.vrange)
	def __repr__(self):      return "Surface-Torus: center=%s, normal=%s, R=%g, r=%g, uvorigin=%s" %(self.center, self.axis, self.major, self.minor, self.uvorigin)
	def setSubtype(self, chunks, index):
		self.center, i   = getLocation(chunks, index)
		self.axis, i     = getVector(chunks, i)
		self.major, i    = getLength(chunks, i)
		self.minor, i    = getLength(chunks, i)
		self.uvorigin, i = getLocation(chunks, i)
		self.sensev, i   = getEnumByTag(chunks, i, SENSEV)
		self.urange, i   = getInterval(chunks, i, MIN_0, MAX_2PI, 1.0)
		self.vrange, i   = getInterval(chunks, i, MIN_0, MAX_2PI, 1.0)
		return i
	def build(self, face = None):
		if (self.__ready_to_build__):
			self.__ready_to_build__ = False
			circleAxis   = self.axis.cross(self.uvorigin).normalize()
			circleCenter = self.center + self.uvorigin.normalize() * fabs(self.major)
			circle       = Part.makeCircle(fabs(self.minor), circleCenter, circleAxis)
			try:
				torus = circle.revolve(self.center, self.axis, 360)
				self.profile = CurveEllipse()
				self.profile.center = circleCenter
				self.profile.axis   = circleAxis
				if (isEqual1D(circleAxis.x, 1.0)):
					self.profile.major = DIR_Y
				elif (isEqual1D(circleAxis.x, -1.0)):

# 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

		self.uvorigin = CENTER
		self.sensev   = 'forward_v'
		self.urange   = Interval(Range('I', MIN_0), Range('I', MAX_2PI))
		self.vrange   = Interval(Range('I', MIN_0), Range('I', MAX_2PI))
	def getSatTextGeometry(self, index): return "%s %s %s %s %s %s %s %s #" %(vec2sat(self.center), vec2sat(self.axis), self.major, self.minor, vec2sat(self.uvorigin), self.sensev, self.urange, self.vrange)
	def __repr__(self):      return "Surface-Torus: center=%s, normal=%s, R=%g, r=%g, uvorigin=%s" %(self.center, self.axis, self.major, self.minor, self.uvorigin)
	def setSubtype(self, chunks, index):
		self.center, i   = getLocation(chunks, index)
		self.axis, i     = getVector(chunks, i)
		self.major, i    = getLength(chunks, i)
		self.minor, i    = getLength(chunks, i)
		self.uvorigin, i = getLocation(chunks, i)
		self.sensev, i   = getEnumByTag(chunks, i, SENSEV)
		self.urange, i   = getInterval(chunks, i, MIN_0, MAX_2PI, 1.0)
		self.vrange, i   = getInterval(chunks, i, MIN_0, MAX_2PI, 1.0)
		return i
	def build(self, face = None):
		if (self.__ready_to_build__):
			self.__ready_to_build__ = False
			circleAxis   = self.axis.cross(self.uvorigin).normalize()
			circleCenter = self.center + self.uvorigin.normalize() * fabs(self.major)
			circle       = Part.makeCircle(fabs(self.minor), circleCenter, circleAxis)
			try:
				torus = circle.revolve(self.center, self.axis, 360)
				self.profile = CurveEllipse()
				self.profile.center = circleCenter
				self.profile.axis   = circleAxis
				if (isEqual1D(circleAxis.x, 1.0)):
					self.profile.major = DIR_Y
				elif (isEqual1D(circleAxis.x, -1.0)):

					self.profile.major = -DIR_Y
