dems in blender

Hi,

I am thinking of a small python project, but I’m rusty (haven’t blended in a year or two). Here’s the idea. I start with a square mesh. I subdivide it a few times so there are, lets say 1089 vertices. Now I want to import a text file (using python) in which there is a sequence of numbers indicating how far to extrude these vertices upwards (or downward for negative numbers). The order of these numbers could correspond to the sequence in which the vertices are extruded. Question: does the python interface in Blender have the capacity to access vertices of a mesh like this, and is there a means using python in blender to access an external file. My assumption is yes to both (how else would other python importers work). This task seems really easy, but if anyone has a hint of how to get started, I’d appreciate it.

Thanks,

Nikoy

well in regards to file access

 file = (filename, "w") # w for write r for read
file.write("string")
file.readline()

the whole extrude thing is jsut how you write it to file and read it from file.

MacBlender

Blender has an embedded python interpreter which gives you access to Python’s builtin functionality and features. If you are doing anything fancy, you will want to install Python on your computer. To do binary i/o, you want the struct module

For dealing with Meshes and verts, take a look at the docs for the NMesh module.

http://jmsoler.free.fr/didacticiel/blender/tutor/cpl_pythonraw2mesh.htm

these links might be useful… I’ve been toying with the idea myself… I want to survey some land with a gps and altimeter, convert it to local grid use something like this import script…

http://www.cpearson.com/excel/latlong.htm Some useful formulas for lat/long coversions

http://www2.jpl.nasa.gov/srtm/cbanddataproducts.html Here is the whole world dem data at ~90m resolution. Very nice! You need to use microdem to convert but I bet with microdem alone you could convert to local coordinate system. If not you can at least get it to dxf which you can directly import.

http://www.usna.edu/Users/oceano/pguth/website/microdem.htm

I hope this helps. I will be ironing this out in the distant future myself… Not sure what your particular project is but maybe you could lead the way!