archz2
December 2, 2020, 8:38am
1
I’m exploring the docofossor plugin (https://www.food4rhino.com/app/docofossor ) which is used for terrain analysis. Unfortunately it only accepts xyz asc files in order to import a terrain. Given below is a screenshot of the example file.
Is there a way in Grasshopper to convert a mesh to xyz file?
dfCutFillInPath.gh (6.5 KB) example_DTM.xyz (248.6 KB)
wim
(Wim Dekeyser)
December 2, 2020, 12:05pm
2
Hi -
Volvox seems to be able to do that.
-wim
1 Like
archz2
December 2, 2020, 12:24pm
3
I did exactly as per your instructions.
I do get the xyz file, but docofossor doesn’t read it and gives error.
WEDNESDAY TESTING.XYZ (86.0 KB)
Grasshopper file is the same as the one in original post, therefore I didn’t attach it again.
wim
(Wim Dekeyser)
December 2, 2020, 12:38pm
4
Hi - I don’t use docofossor and don’t know what that error is about. You could try contacting Ilmar Hurkxkens directly - his eMail address is on the Food4Rhino page.
-wim
1 Like
stammalv
(Stammalv)
December 2, 2020, 1:09pm
5
I believe the error is because the coordinates of each point are not comma delimited
1 Like
archz2
December 2, 2020, 2:53pm
6
How do I convert them to comma delimited?
wim
(Wim Dekeyser)
December 2, 2020, 3:32pm
7
From the documentation, that does not seem to be the case…
The Import XZY component imports a text file to a df list that has topographic data stored as a list of x, y, and z values separated by whitespace characters. Each point should start at a new line.
docofossor/DOCUMENTATION.md at master · dbt-ethz/docofossor · GitHub
That would be easy enough to test. Open the xyz file in Notepad and replace spaces with a comma.
-wim
stammalv
(Stammalv)
December 2, 2020, 3:35pm
8
This is also a simple way in grasshopper
comma delimitation.gh (4.7 KB)
1 Like
archz2
December 3, 2020, 8:32am
9
Doesn’t work. I copied the data in a notepad file, saved it as xyz and still getting error.
3RD_DEC_TEST FILE.XYZ (143.4 KB)
WIth mesh, comma delimitation.gh (177.0 KB)
Hello,
The error seems to be on the final line 2668 - maybe try deleting the blank line at the end and/or replacing ", "
with ","
(just a comma and no space)
Good luck !
Graham
2 Likes
archz2
December 3, 2020, 11:24am
11
Tried it, removed the space after commas and removed the last blank entry of 2669. Exactly the same error. Ditto. No change.
without spaces after commas_3RD_DEC_TEST FILE.XYZ (138.2 KB)
diff-arch
(diff-arch)
December 3, 2020, 6:37pm
12
Hi @archz2 ,
Here’s a custom GHPython component of mine that writes a list of data strings to whatever file you specify. I’ve tested it with your file and it seems to work fine:
If you are using Rhino 5 and don’t have GHPython installed, you need to download it form food4rhino!
WIth mesh, comma delimitation 2.gh (167.1 KB)
1 Like
I think the file has to be a regular uniform grid in x and y - is that the case for your mesh?
diff-arch
(diff-arch)
December 4, 2020, 5:05am
14
I’ve looked up the XYZ-format that I was previously unfamiliar with on wikipedia, and it seems like it should be structured like this:
<number of atoms>
comment line
<element> <X> <Y> <Z>
Tab separation instead of commas and it needs a header containing the maximum number of items.
1 Like
archz2
December 4, 2020, 6:18am
15
I used your script to generate an xyz file. I have Rhino 6 and 7 installed.
In docofossor plugin you mean?
I’m getting the same error 2668.
3RD_DEC_TEST FILE.XYZ (143.4 KB)
diff-arch
(diff-arch)
December 4, 2020, 7:39am
16
No, I meant that I tested my GHPython component with your Grasshopper file.
Yes, as I mentioned in my previous comment, XYZ-files probably need to be formatted like this:
<number of atoms>
comment line
<element> <X> <Y> <Z>
I’ve quickly added another GHPython component that parses the XYZ-file information,
I don’t know if it works with docofossor, since I don’t have that add-on, however the new output looks promising:
WIth mesh, comma delimitation 3.gh (170.2 KB)
1 Like
Hello again,
Yes I’m afraid it does need to be a regular grid - your grid is not regular. See the comments and questions on the docofossor page:
1 Like
archz2
December 5, 2020, 12:19pm
18
Thanks. This time is error is different.
dfCutFillInPath.gh (9.3 KB)
How do I convert my mesh into a regular grid xyz file?
diff-arch
(diff-arch)
December 5, 2020, 3:33pm
19
Sorry, I have no clue, but I guess it was worth a shot.
1 Like
archz2
December 6, 2020, 6:44am
20
It was indeed. I’m grateful for your efforts. I think from having a 100% error file, now the error is reduced to just 1% that’s causing trouble. Just a gut feeling.
1 Like