Create a grid mesh from text file
Hi,
In France IGN give for free some .asc files.
https://geoservices.ign.fr/documentation/diffusion/telechargement-donnee...
This is simple .asc files like :
ncols 3
nrows 5
xllcorner 849997.500000000000
yllcorner 6360002.500000000000
cellsize 5.000000000000
NODATA_value -99999.00
133.00 134.00 135.00
133.00 134.00 135.00
133.00 134.00 135.00
133.00 134.00 135.00
133.00 134.00 135.00
Values are separated by spaces.
In reality, ncols =1000 and nrows=1000
(xcorner, ycorner) is the position of the first point (origine).
So I would like to create a mesh grid :
read first line, first value, create a vertex ( or place first vertex of the grid ) at origine with z=first value
read first line, second value, create a vertex ( or place second vertex of the grid ) at origine + cell size with z=second value
(...)
Same for each line.
As there is a lot of data, I would like to be able to skip some values : ncol divided by a value. Same for nrows.
As 3dsmax don't like very big model, I would like to be able to "move" origine value.
I made an ugly UI to give an idea.
Thanks. I think it could help a few people.
Next step is a batch importer, as there can be a lot of files... ;-)
Attachment | Size |
---|---|
request1.jpg | 91.31 KB |
Comments
what about existing converters?
like this one
In fact I saw this page
In fact I saw this page already, but I didn't understand really what it is...
The file I want to use is more "easy" as it is a ortho 2d grid with a z value for each point.
My first problem is that I saw tutorials to read value of a text file line, but I don't know how to read one value at a time of each lines.
My second problem is that I'm not very comfortable with arrays :-)
My main problem is that I'm a ass...le in scripting as soon as there is maths...
.
you can do it the ugly way
1. read all lines
2. split each line by space character into three parts
3. convert each part into float and ensure that result is actually a float value
4. do whatever you need with the values
Thanks for answer jahman but
Thanks for answer jahman but dotnet... can't even open my file.
.
... can't even open my file.
then try writing simple importer similar to the example from maxscript reference
Hi, I succeed with undo off
Hi,
I succeed with undo off to keep memory very low ! :-)
And I added a progress bar ( my first one !)
But the script is too slow, and beyond 500x500, it took forever...
I make a script. It don't
I make a script. It don't work with the full IGN file as it is 1000x1000.
But if I overwrite the value to 200x200 it works and create a grid mesh with z values (but it don't make the good mesh as the values are shifted)
Here is the .ms and the original IGN file as text.
I'll continue to invertigate :-)
I succeed to make my grid,
I succeed to make my grid, move my grid vertex, but I can't enter my value in VTX:
polyop.moveVert PL VERT [(COL*CELLSIZE),(ROW*CELLSIZE),TX]
because it is a STRING !!!
It is ok for few rows and columns but with NCOLLO=NROWWO= 1000, 3dsmax eats all memory and freeze...
.
but I can't enter my value in VTX because it is a STRING !!!
convert it like in the example I posted above
Hi, This is my last try as I
Hi,
This is my last try as I don't know how to optimize it more...
Virtually it works. But as it is too slow, I never see the 1000x1000 mesh.
:-(