here is an update to the original code...
it's written more in the Python manner.
you can use it if you wan't...Code:import struct as S dat = open("import.dat", 'rb') obj = open("export.obj", 'w') #mtl = open("export.mtl", 'w') def vert(v): return (float(S.unpack("<h", S.pack("<H", int((v.encode('hex')), 16)))[0]) * 0.01).__str__() #v x y z """ def face (): return #f v1/vt1/vn1 v2/vt2/vn2 v3/vt3/vn3 (tri) #f v1/vt1/vn1 v2/vt2/vn2 v3/vt3/vn3 v4/vt4/vn4 (quad) """ t0 = dat.read(32)#header a = 0 while (a == 0): v = "v "+vert(dat.read(2))+" "+vert(dat.read(2))+" "+vert(dat.read(2)) if (v == 'v 0.0 0.0 0.0'): a = 1 #f = "f "+face()+" "+face()+" "+face() else: print v #obj.write(v+"\n")
you can delete those little notes I've left myself if you want.
yea...
if you havn't figured out yet,
I'm kinda using this forum as an update log...



Reply With Quote








