예제 #1
0
 def readElement(self):
     "Gets next element."
     while True:
         line = self.getline().strip()
         if (line.startswith("solid")):
             break
     while True:
         line = self.getline().strip()
         if (line.startswith("endsolid")):
             return
         assert line.startswith("facet")
         line = self.getline().strip()
         assert line == "outer loop"
         coord = []
         for i in xrange(3):
             line = self.getline().strip()
             assert line.startswith("vertex ")
             nodeList = line.split()
             nodeList.pop(0)
             coord.append(nodeList)
         line = self.getline().strip()
         assert line == "endloop" or line == "end loop"
         line = self.getline().strip()
         assert line == "endfacet" or line == "end facet"
         yield generic.element("Tri3", coord)
예제 #2
0
	def readElement(self):
		"Gets next element."
		while True:
			line = self.getline().strip()
			if (line.startswith("solid")):
				break
		while True:
			line = self.getline().strip()
			if (line.startswith("endsolid")):
				return
			assert line.startswith("facet")
			line = self.getline().strip()
			assert line == "outer loop"
			coord = []
			for i in xrange(3):
				line = self.getline().strip()
				assert line.startswith("vertex ")
				nodeList = line.split()
				nodeList.pop(0)
				coord.append(nodeList)
			line = self.getline().strip()
			assert line == "endloop" or line == "end loop"
			line = self.getline().strip()
			assert line == "endfacet" or line == "end facet"
			yield generic.element("Tri3", coord)
예제 #3
0
	def readElement(self):
		"Gets next element"
		while True:
			buf = self.f.read(50)
			if (len(buf) == 0):
				break
			coord = []
			for i in range(3):
				coord.append([x for x in struct.unpack_from("3f", buf, (i+1)*12)])
			color = str(struct.unpack_from("h", buf, 48)[0])
			print color
			yield generic.element("Tri3", list=coord, color=color)
예제 #4
0
 def readElement(self):
     "Gets next element"
     while True:
         buf = self.f.read(50)
         if (len(buf) == 0):
             break
         coord = []
         for i in range(3):
             coord.append(
                 [x for x in struct.unpack_from("3f", buf, (i + 1) * 12)])
         color = str(struct.unpack_from("h", buf, 48)[0])
         print color
         yield generic.element("Tri3", list=coord, color=color)