Hi all, first time poster
… anyway, I have a question and I’ve looked through the forums and can’t find my answer… all the topics I find dealing with this lead me to what Blender exports when you use the VRML <-- ( think thats what it’s called) export. I’m trying to write a simple python script to export models. I’m trying to create a very simple format much like MilkShaped3d’s. I’m having trouble with the uv coordinates for my textures. The are all the same… I have a simple textured cube… all the texture coordinates I read ( same with the VRML export ) are the same for each face of the cube… something like: 0.0 0.0, 0.0 0.1, 1.0 1.0, 1.0 0.0. Try the VRML export with a textured cube and you’ll see what I mean. Anyway can someone help me with this? I’m making games for GNU/Linux (WILL NOT USE WINDOWS OR ANY CLOSED SOURCE TOOLS!) and I’m really liking what I see in Blender very much other than my issue with this. Thanks for any help 
Jamie.
I myself can’t give you your answer, but I can direct you to Yable, the excellent exporter for the Yafray raytracer. It exports Blender meshes and uv coordinates. You can find the latest iteration of the script here:
Surely someone can tell me just a bit about how to handle uv texture coordinates blender/python? Going through the faces something like this:
for face in mesh.faces:
for v in face.uv:
print("%f %f" % (v[0], v[1]))
isn’t right… can someone help me?
Thanks,
Jamie
HI,
Yes, thats close enough.
Here is a little demo of getting the UV coords:
I made a cube and textured the faces with a convenient image:
Here is the script I used to get the coords for face 3 of the cube:
import Blender
cube = Blender.Object.Get("Cube")
print "____________________________"
cubedata = cube.data
cubefaces = cubedata.faces
U1 = cubefaces[3].uv[0][0]
V1 = cubefaces[3].uv[0][1]
U2 = cubefaces[3].uv[1][0]
V2 = cubefaces[3].uv[1][1]
U3 = cubefaces[3].uv[2][0]
V3 = cubefaces[3].uv[2][1]
U4 = cubefaces[3].uv[3][0]
V4 = cubefaces[3].uv[3][1]
print "Coord 0 [%f,%f]
" % (U1,V1)
print "Coord 1 [%f,%f]
" % (U2,V2)
print "Coord 2 [%f,%f]
" % (U3,V3)
print "Coord 3 [%f,%f]
" % (U4,V4)
Situation 1: the entire image covers the entire face:

Situation 2: A subsection of the image covers the entire face:

Here are the coordinates obtained from the two situations:

I hope this helps explain UV coords.
Stephen
write all the uv coordinates to a file denoted by modelname-uv.txt
def dumpUV( self, obj ):
print obj.name
mesh = Mesh.get( obj.name )
if mesh != None:
filename = obj.name + “-uv.txt”
file = open( filename, “w” )
print "Dumping UV to ", filename
for face in mesh.faces:
for uv in face.uv:
file.write( "%f %f
" % ( uv[0], uv[1] ) )
file.close()
return “Dumped UV coords to file”
else:
return “Cannot Dump UV: Invalid Mesh Selected”
Hi there!
I addapted a script that creates TGA files from the uv information to another file format.
So the new script now exports eps files, with all paths that represents the faces and stuff.
It is very simple, I tested on 2.41 and it is working fine!
for a better use , you can convert it to svg via pstoedit
pstoedit -f plot-svg file.eps file.svg
or to dxf to open it on Qcad
pstoedit -f dxf file.eps file.svg
The greatest thing is that if you work with packaging, you can create the 3d model or you package, use the normal UV procedure to unwrap it and then use the path to create the dieboard of even create a mokup with cut and crease plotters.
The design can be very easy if you first create the package in blender, and then use this script to save the unwrapped faces in eps.
Get the script @
http://opencam.sourceforge.net/scripts/uv_vectexp.py
simply copy it to your blender scripts folder
Regards!
wow! Thnx. Are there any other potential uses besides the ones you explain. They sound too “industrial” to me 
well, since you have the vect data, you can use ilustration programs such inkscape or illustrator or even CAD programs like Qcad, or autocad…
Some features of the illustration softwares are more powerfull 'cause they are not limmited to the bitmap stuff 
Althought texture mapping is a filed to raster programs such as gimp or photoshop, there can be some use have the vectorial data of each edge 
I created it think in the packaging industry and in products design.
Take a look at the screenshots: