コード例 #1
0
	def __init__(self, filename):
		self.obj = printableObject.printableObject(filename)
		self.mesh = self.obj._addMesh()

		r = ParserCreate()
		r.StartElementHandler = self._StartElementHandler
		r.EndElementHandler = self._EndElementHandler
		r.CharacterDataHandler = self._CharacterDataHandler

		self._base = {}
		self._cur = self._base
		self._idMap = {}
		self._geometryList = []
		self._faceCount = 0
		r.ParseFile(open(filename, "r"))
		
		self.vertexCount = 0
		for instance_visual_scene in self._base['collada'][0]['scene'][0]['instance_visual_scene']:
			for node in self._idMap[instance_visual_scene['_url']]['node']:
				self._ProcessNode1(node)
		self.mesh._prepareFaceCount(self._faceCount)
		for instance_visual_scene in self._base['collada'][0]['scene'][0]['instance_visual_scene']:
			for node in self._idMap[instance_visual_scene['_url']]['node']:
				self._ProcessNode2(node)

		scale = float(self._base['collada'][0]['asset'][0]['unit'][0]['_meter']) * 1000
		self.mesh.vertexes *= scale
		
		self._base = None
		self._cur = None
		self._idMap = None
		
		self.obj._postProcessAfterLoad()
コード例 #2
0
ファイル: dae.py プロジェクト: dagomafr/Cura_by_dagoma
	def __init__(self, filename):
		self.obj = printableObject.printableObject(filename)
		self.mesh = self.obj._addMesh()

		r = ParserCreate()
		r.StartElementHandler = self._StartElementHandler
		r.EndElementHandler = self._EndElementHandler
		r.CharacterDataHandler = self._CharacterDataHandler

		self._base = {}
		self._cur = self._base
		self._idMap = {}
		self._geometryList = []
		self._faceCount = 0
		r.ParseFile(open(filename, "r"))
		
		self.vertexCount = 0
		for instance_visual_scene in self._base['collada'][0]['scene'][0]['instance_visual_scene']:
			for node in self._idMap[instance_visual_scene['_url']]['node']:
				self._ProcessNode1(node)
		self.mesh._prepareFaceCount(self._faceCount)
		for instance_visual_scene in self._base['collada'][0]['scene'][0]['instance_visual_scene']:
			for node in self._idMap[instance_visual_scene['_url']]['node']:
				self._ProcessNode2(node)

		scale = float(self._base['collada'][0]['asset'][0]['unit'][0]['_meter']) * 1000
		self.mesh.vertexes *= scale
		
		self._base = None
		self._cur = None
		self._idMap = None
		
		self.obj._postProcessAfterLoad()
コード例 #3
0
ファイル: obj.py プロジェクト: dagomafr/Cura_by_dagoma
def loadScene(filename):
	obj = printableObject.printableObject(filename)
	m = obj._addMesh()

	vertexList = []
	faceList = []

	f = open(filename, "r")
	for line in f:
		parts = line.split()
		if len(parts) < 1:
			continue
		if parts[0] == 'v':
			vertexList.append([float(parts[1]), float(parts[2]), float(parts[3])])
		if parts[0] == 'f':
			parts = map(lambda p: p.split('/')[0], parts)
			for idx in xrange(1, len(parts)-2):
				faceList.append([int(parts[1]), int(parts[idx+1]), int(parts[idx+2])])
	f.close()

	m._prepareFaceCount(len(faceList))
	for f in faceList:
		i = f[0] - 1
		j = f[1] - 1
		k = f[2] - 1
		if i < 0 or i >= len(vertexList):
			i = 0
		if j < 0 or j >= len(vertexList):
			j = 0
		if k < 0 or k >= len(vertexList):
			k = 0
		m._addFace(vertexList[i][0], vertexList[i][1], vertexList[i][2], vertexList[j][0], vertexList[j][1], vertexList[j][2], vertexList[k][0], vertexList[k][1], vertexList[k][2])

	obj._postProcessAfterLoad()
	return [obj]
コード例 #4
0
def convertImage(filename, height=20.0, width=100.0, blur=0, invert=False, baseHeight=1.0):
	image = wx.Image(filename)
	image.ConvertToGreyscale()
	if image.GetHeight() > 512:
		image.Rescale(image.GetWidth() * 512 / image.GetHeight(), 512, wx.IMAGE_QUALITY_HIGH)
	if image.GetWidth() > 512:
		image.Rescale(512, image.GetHeight() * 512 / image.GetWidth(), wx.IMAGE_QUALITY_HIGH)
	if blur > 0:
		image = image.Blur(blur)
	z = numpy.fromstring(image.GetData(), numpy.uint8)
	z = numpy.array(z[::3], numpy.float32)	#Only get the R values (as we are grayscale), and convert to float values
	if invert:
		z = 255 - z
	pMin, pMax = numpy.min(z), numpy.max(z)
	if pMax == pMin:
		pMax += 1.0
	z = ((z - pMin) * height / (pMax - pMin)) + baseHeight

	w, h = image.GetWidth(), image.GetHeight()
	scale = width / (image.GetWidth() - 1)
	n = w * h
	y, x = numpy.mgrid[0:h,0:w]
	x = numpy.array(x, numpy.float32, copy=False) * scale
	y = numpy.array(y, numpy.float32, copy=False) *-scale
	v0 = numpy.concatenate((x.reshape((n, 1)), y.reshape((n, 1)), z.reshape((n, 1))), 1)
	v0 = v0.reshape((h, w, 3))
	v1 = v0[0:-1,0:-1,:]
	v2 = v0[0:-1,1:,:]
	v3 = v0[1:,0:-1,:]
	v4 = v0[1:,1:,:]

	obj = printableObject.printableObject(filename)
	m = obj._addMesh()
	m._prepareFaceCount((w-1) * (h-1) * 2 + 2 + (w-1)*4 + (h-1)*4)
	m.vertexes = numpy.array(numpy.concatenate((v1,v3,v2,v2,v3,v4), 2).reshape(((w-1) * (h-1) * 6, 3)), numpy.float32, copy=False)
	m.vertexes = numpy.concatenate((m.vertexes, numpy.zeros(((2+(w-1)*4+(h-1)*4)*3, 3), numpy.float32)))
	m.vertexCount = (w-1) * (h-1) * 6
	x = (w-1)* scale
	y = (h-1)*-scale
	m._addFace(0,0,0, x,0,0, 0,y,0)
	m._addFace(x,y,0, 0,y,0, x,0,0)
	for n in xrange(0, w-1):
		x = n* scale
		i = w*h-w+n
		m._addFace(x+scale,0,0, x,0,0, x,0,z[n])
		m._addFace(x+scale,0,0, x,0,z[n], x+scale,0,z[n+1])
		m._addFace(x+scale,y,0, x,y,z[i], x,y,0)
		m._addFace(x+scale,y,0, x+scale,y,z[i+1], x,y,z[i])

	x = (w-1)*scale
	for n in xrange(0, h-1):
		y = n*-scale
		i = n*w+w-1
		m._addFace(0,y-scale,0, 0,y,z[n*w], 0,y,0)
		m._addFace(0,y-scale,0, 0,y-scale,z[n*w+w], 0,y,z[n*w])
		m._addFace(x,y-scale,0, x,y,0, x,y,z[i])
		m._addFace(x,y-scale,0, x,y,z[i], x,y-scale,z[i+w])
	obj._postProcessAfterLoad()
	return obj
コード例 #5
0
ファイル: 12978_imageToMesh.py プロジェクト: Angell1/mycura
def convertImage(filename, height=20.0, width=100.0, blur=0, invert=False, baseHeight=1.0):
	image = wx.Image(filename)
	image.ConvertToGreyscale()
	if image.GetHeight() > 512:
		image.Rescale(image.GetWidth() * 512 / image.GetHeight(), 512, wx.IMAGE_QUALITY_HIGH)
	if image.GetWidth() > 512:
		image.Rescale(512, image.GetHeight() * 512 / image.GetWidth(), wx.IMAGE_QUALITY_HIGH)
	if blur > 0:
		image = image.Blur(blur)
	z = numpy.fromstring(image.GetData(), numpy.uint8)
	z = numpy.array(z[::3], numpy.float32)	#Only get the R values (as we are grayscale), and convert to float values
	if invert:
		z = 255 - z
	pMin, pMax = numpy.min(z), numpy.max(z)
	if pMax == pMin:
		pMax += 1.0
	z = ((z - pMin) * height / (pMax - pMin)) + baseHeight

	w, h = image.GetWidth(), image.GetHeight()
	scale = width / (image.GetWidth() - 1)
	n = w * h
	y, x = numpy.mgrid[0:h,0:w]
	x = numpy.array(x, numpy.float32, copy=False) * scale
	y = numpy.array(y, numpy.float32, copy=False) *-scale
	v0 = numpy.concatenate((x.reshape((n, 1)), y.reshape((n, 1)), z.reshape((n, 1))), 1)
	v0 = v0.reshape((h, w, 3))
	v1 = v0[0:-1,0:-1,:]
	v2 = v0[0:-1,1:,:]
	v3 = v0[1:,0:-1,:]
	v4 = v0[1:,1:,:]

	obj = printableObject.printableObject(filename)
	m = obj._addMesh()
	m._prepareFaceCount((w-1) * (h-1) * 2 + 2 + (w-1)*4 + (h-1)*4)
	m.vertexes = numpy.array(numpy.concatenate((v1,v3,v2,v2,v3,v4), 2).reshape(((w-1) * (h-1) * 6, 3)), numpy.float32, copy=False)
	m.vertexes = numpy.concatenate((m.vertexes, numpy.zeros(((2+(w-1)*4+(h-1)*4)*3, 3), numpy.float32)))
	m.vertexCount = (w-1) * (h-1) * 6
	x = (w-1)* scale
	y = (h-1)*-scale
	m._addFace(0,0,0, x,0,0, 0,y,0)
	m._addFace(x,y,0, 0,y,0, x,0,0)
	for n in xrange(0, w-1):
		x = n* scale
		i = w*h-w+n
		m._addFace(x+scale,0,0, x,0,0, x,0,z[n])
		m._addFace(x+scale,0,0, x,0,z[n], x+scale,0,z[n+1])
		m._addFace(x+scale,y,0, x,y,z[i], x,y,0)
		m._addFace(x+scale,y,0, x+scale,y,z[i+1], x,y,z[i])

	x = (w-1)*scale
	for n in xrange(0, h-1):
		y = n*-scale
		i = n*w+w-1
		m._addFace(0,y-scale,0, 0,y,z[n*w], 0,y,0)
		m._addFace(0,y-scale,0, 0,y-scale,z[n*w+w], 0,y,z[n*w])
		m._addFace(x,y-scale,0, x,y,0, x,y,z[i])
		m._addFace(x,y-scale,0, x,y,z[i], x,y-scale,z[i+w])
	obj._postProcessAfterLoad()
	return obj
コード例 #6
0
ファイル: stl.py プロジェクト: JimiHyun/Accordion
def loadScene(filename):
	obj = printableObject.printableObject(filename)
	m = obj._addMesh()

	f = open(filename, "rb")
	if f.read(5).lower() == "solid":
		_loadAscii(m, f)
		if m.vertexCount < 3:
			f.seek(5, os.SEEK_SET)
			_loadBinary(m, f)
	else:
		_loadBinary(m, f)
	f.close()
	obj._postProcessAfterLoad()
	return [obj]
コード例 #7
0
def loadScene(filename):
    obj = printableObject.printableObject(filename)
    m = obj._addMesh()

    f = open(filename, "rb")
    if f.read(5).lower() == "solid":
        _loadAscii(m, f)
        if m.vertexCount < 3:
            f.seek(5, os.SEEK_SET)
            _loadBinary(m, f)
    else:
        _loadBinary(m, f)
    f.close()
    obj._postProcessAfterLoad()
    return [obj]
コード例 #8
0
def loadScene(filename):
    obj = printableObject.printableObject(filename)
    m = obj._addMesh()

    vertexList = []
    faceList = []

    f = open(filename, "r")
    for line in f:
        parts = line.split()
        if len(parts) < 1:
            continue
        if parts[0] == 'v':
            vertexList.append(
                [float(parts[1]),
                 float(parts[2]),
                 float(parts[3])])
        if parts[0] == 'f':
            parts = map(lambda p: p.split('/')[0], parts)
            for idx in xrange(1, len(parts) - 2):
                faceList.append(
                    [int(parts[1]),
                     int(parts[idx + 1]),
                     int(parts[idx + 2])])
    f.close()

    m._prepareFaceCount(len(faceList))
    for f in faceList:
        i = f[0] - 1
        j = f[1] - 1
        k = f[2] - 1
        if i < 0 or i >= len(vertexList):
            i = 0
        if j < 0 or j >= len(vertexList):
            j = 0
        if k < 0 or k >= len(vertexList):
            k = 0
        m._addFace(vertexList[i][0], vertexList[i][1], vertexList[i][2],
                   vertexList[j][0], vertexList[j][1], vertexList[j][2],
                   vertexList[k][0], vertexList[k][1], vertexList[k][2])

    obj._postProcessAfterLoad()
    return [obj]
コード例 #9
0
ファイル: minecraftImport.py プロジェクト: JimiHyun/Accordion
	def OnImport(self, e):
		if self.level is None or self.selectArea is None:
			return

		xMin = min(self.selectArea[0], self.selectArea[2]) + (self.playerPos[0] - 16) * 16
		xMax = max(self.selectArea[0], self.selectArea[2]) + (self.playerPos[0] - 16) * 16
		yMin = min(self.selectArea[1], self.selectArea[3]) + (self.playerPos[1] - 16) * 16
		yMax = max(self.selectArea[1], self.selectArea[3]) + (self.playerPos[1] - 16) * 16

		sx = (xMax - xMin + 1)
		sy = (yMax - yMin + 1)
		blocks = numpy.zeros((sx, sy, 256), numpy.int32)

		cxMin = int(xMin / 16)
		cxMax = int((xMax + 15) / 16)
		cyMin = int(yMin / 16)
		cyMax = int((yMax + 15) / 16)

		for cx in xrange(cxMin, cxMax + 1):
			for cy in xrange(cyMin, cyMax + 1):
				chunk = self.level.getChunk(cx, cy)
				for x in xrange(0, 16):
					bx = x + cx * 16
					if xMin <= bx <= xMax:
						for y in xrange(0, 16):
							by = y + cy * 16
							if yMin <= by <= yMax:
								blocks[bx - xMin, by - yMin] = chunk.Blocks[x, y]
		minZ = 256
		maxZ = 0
		for x in xrange(0, sx):
			for y in xrange(0, sy):
				minZ = min(minZ, numpy.max(numpy.where(blocks[x, y] != 0)))
				maxZ = max(maxZ, numpy.max(numpy.where(blocks[x, y] != 0)))
		minZ += 1

		faceCount = 0
		for x in xrange(0, sx):
			for y in xrange(0, sy):
				for z in xrange(minZ, maxZ + 1):
					if self.isSolid[blocks[x, y, z]]:
						if z == maxZ or not self.isSolid[blocks[x, y, z + 1]]:
							faceCount += 1
						if z == minZ or not self.isSolid[blocks[x, y, z - 1]]:
							faceCount += 1
						if x == 0 or not self.isSolid[blocks[x - 1, y, z]]:
							faceCount += 1
						if x == sx - 1 or not self.isSolid[blocks[x + 1, y, z]]:
							faceCount += 1
						if y == 0 or not self.isSolid[blocks[x, y - 1, z]]:
							faceCount += 1
						if y == sy - 1 or not self.isSolid[blocks[x, y + 1, z]]:
							faceCount += 1

		obj = printableObject.printableObject(None)
		m = obj._addMesh()
		m._prepareFaceCount(faceCount * 2)
		for x in xrange(0, sx):
			for y in xrange(0, sy):
				for z in xrange(minZ, maxZ + 1):
					if self.isSolid[blocks[x, y, z]]:
						if z == maxZ or not self.isSolid[blocks[x, y, z + 1]]:
							m._addFace(x, y, z+1, x+1, y, z+1, x, y+1, z+1)

							m._addFace(x+1, y+1, z+1, x, y+1, z+1, x+1, y, z+1)

						if z == minZ or not self.isSolid[blocks[x, y, z - 1]]:
							m._addFace(x, y, z, x, y+1, z, x+1, y, z)

							m._addFace(x+1, y+1, z, x+1, y, z, x, y+1, z)

						if x == 0 or not self.isSolid[blocks[x - 1, y, z]]:
							m._addFace(x, y, z, x, y, z+1, x, y+1, z)

							m._addFace(x, y+1, z+1, x, y+1, z, x, y, z+1)

						if x == sx - 1 or not self.isSolid[blocks[x + 1, y, z]]:
							m._addFace(x+1, y, z, x+1, y+1, z, x+1, y, z+1)

							m._addFace(x+1, y+1, z+1, x+1, y, z+1, x+1, y+1, z)

						if y == 0 or not self.isSolid[blocks[x, y - 1, z]]:
							m._addFace(x, y, z, x+1, y, z, x, y, z+1)

							m._addFace(x+1, y, z+1, x, y, z+1, x+1, y, z)

						if y == sy - 1 or not self.isSolid[blocks[x, y + 1, z]]:
							m._addFace(x, y+1, z, x, y+1, z+1, x+1, y+1, z)

							m._addFace(x+1, y+1, z+1, x+1, y+1, z, x, y+1, z+1)

		obj._postProcessAfterLoad()
		self.GetParent().scene._scene.add(obj)
コード例 #10
0
ファイル: minecraftImport.py プロジェクト: lulzbackup/cura
	def OnImport(self, e):
		if self.level is None or self.selectArea is None:
			return

		xMin = min(self.selectArea[0], self.selectArea[2]) + (self.playerPos[0] - 16) * 16
		xMax = max(self.selectArea[0], self.selectArea[2]) + (self.playerPos[0] - 16) * 16
		yMin = min(self.selectArea[1], self.selectArea[3]) + (self.playerPos[1] - 16) * 16
		yMax = max(self.selectArea[1], self.selectArea[3]) + (self.playerPos[1] - 16) * 16

		sx = (xMax - xMin + 1)
		sy = (yMax - yMin + 1)
		blocks = numpy.zeros((sx, sy, 256), numpy.int32)

		cxMin = int(xMin / 16)
		cxMax = int((xMax + 15) / 16)
		cyMin = int(yMin / 16)
		cyMax = int((yMax + 15) / 16)

		for cx in xrange(cxMin, cxMax + 1):
			for cy in xrange(cyMin, cyMax + 1):
				chunk = self.level.getChunk(cx, cy)
				for x in xrange(0, 16):
					bx = x + cx * 16
					if xMin <= bx <= xMax:
						for y in xrange(0, 16):
							by = y + cy * 16
							if yMin <= by <= yMax:
								blocks[bx - xMin, by - yMin] = chunk.Blocks[x, y]
		minZ = 256
		maxZ = 0
		for x in xrange(0, sx):
			for y in xrange(0, sy):
				minZ = min(minZ, numpy.max(numpy.where(blocks[x, y] != 0)))
				maxZ = max(maxZ, numpy.max(numpy.where(blocks[x, y] != 0)))
		minZ += 1

		faceCount = 0
		for x in xrange(0, sx):
			for y in xrange(0, sy):
				for z in xrange(minZ, maxZ + 1):
					if self.isSolid[blocks[x, y, z]]:
						if z == maxZ or not self.isSolid[blocks[x, y, z + 1]]:
							faceCount += 1
						if z == minZ or not self.isSolid[blocks[x, y, z - 1]]:
							faceCount += 1
						if x == 0 or not self.isSolid[blocks[x - 1, y, z]]:
							faceCount += 1
						if x == sx - 1 or not self.isSolid[blocks[x + 1, y, z]]:
							faceCount += 1
						if y == 0 or not self.isSolid[blocks[x, y - 1, z]]:
							faceCount += 1
						if y == sy - 1 or not self.isSolid[blocks[x, y + 1, z]]:
							faceCount += 1

		obj = printableObject.printableObject(None)
		m = obj._addMesh()
		m._prepareFaceCount(faceCount * 2)
		for x in xrange(0, sx):
			for y in xrange(0, sy):
				for z in xrange(minZ, maxZ + 1):
					if self.isSolid[blocks[x, y, z]]:
						if z == maxZ or not self.isSolid[blocks[x, y, z + 1]]:
							m._addFace(x, y, z+1, x+1, y, z+1, x, y+1, z+1)

							m._addFace(x+1, y+1, z+1, x, y+1, z+1, x+1, y, z+1)

						if z == minZ or not self.isSolid[blocks[x, y, z - 1]]:
							m._addFace(x, y, z, x, y+1, z, x+1, y, z)

							m._addFace(x+1, y+1, z, x+1, y, z, x, y+1, z)

						if x == 0 or not self.isSolid[blocks[x - 1, y, z]]:
							m._addFace(x, y, z, x, y, z+1, x, y+1, z)

							m._addFace(x, y+1, z+1, x, y+1, z, x, y, z+1)

						if x == sx - 1 or not self.isSolid[blocks[x + 1, y, z]]:
							m._addFace(x+1, y, z, x+1, y+1, z, x+1, y, z+1)

							m._addFace(x+1, y+1, z+1, x+1, y, z+1, x+1, y+1, z)

						if y == 0 or not self.isSolid[blocks[x, y - 1, z]]:
							m._addFace(x, y, z, x+1, y, z, x, y, z+1)

							m._addFace(x+1, y, z+1, x, y, z+1, x+1, y, z)

						if y == sy - 1 or not self.isSolid[blocks[x, y + 1, z]]:
							m._addFace(x, y+1, z, x, y+1, z+1, x+1, y+1, z)

							m._addFace(x+1, y+1, z+1, x+1, y+1, z, x, y+1, z+1)

		obj._postProcessAfterLoad()
		self.GetParent().scene._scene.add(obj)
コード例 #11
0
ファイル: amf.py プロジェクト: JimiHyun/Accordion
def loadScene(filename):
	try:
		zfile = zipfile.ZipFile(filename)
		xml = zfile.read(zfile.namelist()[0])
		zfile.close()
	except zipfile.BadZipfile:
		f = open(filename, "r")
		xml = f.read()
		f.close()
	amf = ElementTree.fromstring(xml)
	if 'unit' in amf.attrib:
		unit = amf.attrib['unit'].lower()
	else:
		unit = 'millimeter'
	if unit == 'millimeter':
		scale = 1.0
	elif unit == 'meter':
		scale = 1000.0
	elif unit == 'inch':
		scale = 25.4
	elif unit == 'feet':
		scale = 304.8
	elif unit == 'micron':
		scale = 0.001
	else:
		print "Unknown unit in amf: %s" % (unit)
		scale = 1.0

	ret = []
	for amfObj in amf.iter('object'):
		obj = printableObject.printableObject(filename)
		for amfMesh in amfObj.iter('mesh'):
			vertexList = []
			for vertices in amfMesh.iter('vertices'):
				for vertex in vertices.iter('vertex'):
					for coordinates in vertex.iter('coordinates'):
						v = [0.0,0.0,0.0]
						for t in coordinates:
							if t.tag == 'x':
								v[0] = float(t.text)
							elif t.tag == 'y':
								v[1] = float(t.text)
							elif t.tag == 'z':
								v[2] = float(t.text)
						vertexList.append(v)

			for volume in amfMesh.iter('volume'):
				m = obj._addMesh()
				count = 0
				for triangle in volume.iter('triangle'):
					count += 1
				m._prepareFaceCount(count)

				for triangle in volume.iter('triangle'):
					for t in triangle:
						if t.tag == 'v1':
							v1 = vertexList[int(t.text)]
						elif t.tag == 'v2':
							v2 = vertexList[int(t.text)]
						elif t.tag == 'v3':
							v3 = vertexList[int(t.text)]
							m._addFace(v1[0], v1[1], v1[2], v2[0], v2[1], v2[2], v3[0], v3[1], v3[2])
		obj._postProcessAfterLoad()
		ret.append(obj)

	return ret
コード例 #12
0
ファイル: amf.py プロジェクト: MOYAERTS/CuraByDagoma
def loadScene(filename):
    try:
        zfile = zipfile.ZipFile(filename)
        xml = zfile.read(zfile.namelist()[0])
        zfile.close()
    except zipfile.BadZipfile:
        f = open(filename, "r")
        xml = f.read()
        f.close()
    amf = ElementTree.fromstring(xml)
    if 'unit' in amf.attrib:
        unit = amf.attrib['unit'].lower()
    else:
        unit = 'millimeter'
    if unit == 'millimeter':
        scale = 1.0
    elif unit == 'meter':
        scale = 1000.0
    elif unit == 'inch':
        scale = 25.4
    elif unit == 'feet':
        scale = 304.8
    elif unit == 'micron':
        scale = 0.001
    else:
        print "Unknown unit in amf: %s" % (unit)
        scale = 1.0

    ret = []
    for amfObj in amf.iter('object'):
        obj = printableObject.printableObject(filename)
        for amfMesh in amfObj.iter('mesh'):
            vertexList = []
            for vertices in amfMesh.iter('vertices'):
                for vertex in vertices.iter('vertex'):
                    for coordinates in vertex.iter('coordinates'):
                        v = [0.0, 0.0, 0.0]
                        for t in coordinates:
                            if t.tag == 'x':
                                v[0] = float(t.text)
                            elif t.tag == 'y':
                                v[1] = float(t.text)
                            elif t.tag == 'z':
                                v[2] = float(t.text)
                        vertexList.append(v)

            for volume in amfMesh.iter('volume'):
                m = obj._addMesh()
                count = 0
                for triangle in volume.iter('triangle'):
                    count += 1
                m._prepareFaceCount(count)

                for triangle in volume.iter('triangle'):
                    for t in triangle:
                        if t.tag == 'v1':
                            v1 = vertexList[int(t.text)]
                        elif t.tag == 'v2':
                            v2 = vertexList[int(t.text)]
                        elif t.tag == 'v3':
                            v3 = vertexList[int(t.text)]
                            m._addFace(v1[0], v1[1], v1[2], v2[0], v2[1],
                                       v2[2], v3[0], v3[1], v3[2])
        obj._postProcessAfterLoad()
        ret.append(obj)

    return ret