Export faces and vertices plugin to CSV - does one exist?
-
Here's what I am looking for...
A way to extract vertices and faces (think this is correct terminology) to a CSV.
Vertices would have X, Y, Z coordinates with a number ID
Faces would be triangulated sets of X, Y, Z coordinatese.g.
Vertices:
1 0, 0, 0
2 1, 0, 0
3 1, 1, 0
4 0, 1, 0Faces
1 2 3
1 3 4 -
I don't know about Faces but you can certainly export Vertices
http://sketchucation.com/forums/viewtopic.php?p=298614#p298614
Also Search the pluginstore and the extension warehouse for csv and see if there is anything to suit. -
Thanks. I think some of the 3D exports will export faces and this information could be reused but I haven't dug into it yet. I'm not enough of a Sketchup expert to know how to write some code to do this.
-
@nyal mellor said:
Thanks. I think some of the 3D exports will export faces and this information could be reused
This is certainly possible - I have done something similar here, exporting as OBJ, then using a custom Ruby script to parse out the vertices and faces.
I think that whatever file type you export from SU, you're going to need to do some processing on the output. You may find the free mesh editor 'MeshLab' useful - this can read and write a huge range of 3D files - many of them are simple text data if you look at them in Notepad, so you can choose whichever gives you the least work to do.
Assuming that you may need to do the editing by hand, the '3D triangulated surface (.GTS)' format looks like a good candidate. This is a simple text format containing lists of numbers - first the vertices (three numbers per line), then edges (indexes of the end vertices), then triangles (three vertex indexes). A line at the file start declares how many of each there are. The vertex index is not explicitly written at the start of each line - they are assumed to be in whatever order they are listed in the file (this is pretty common in all 'text' 3D files). If you can manage without the explicit numbering, then the editing is simple - simply replace space characters with commas in a text editor, and delete the 'edges' section that you don't need.
-
Check Personal Messages for a possible solution.
-
Thanks for the help so far. sdmitch I tried your plugin and it works 95%. There are a couple of triangulated faces that it generates that are reversed and also there are a couple of triangular faces that it generates that are not there in the model. I've ensured the model is solid and has no internal faces, or at least I think I have. It says I don't have enough posts to send you a PM yet.
-
Not sure how I would ever figure out if a face is reversed or how it generates faces that didn't exist. Perhaps there is a break in an edge that is not a corner.
-
I thought that might be the case but I verified the model is solid with the Outer Shell tool. The method Trogluddite proposed seems to produce a cleaner output but the export from MeshLab isn't working properly...only half the vertices are exported from MeshLab for some reason.
-
OK I figured this out and will post here for others who may need to do similar thing.
Here's the method:
- export from sketchup to OBJ format. Even with sketchup OBJ export set to not export lines and textures it still does, which makes the OBJ very hard to understand. I think this is a sketchup bug
- import from OBJ using MeshLab
- do whatever cleanup you need. In my case I need to remove zero area faces
- export from MeshLab to OBJ, deselect all tick boxes during export, result is that OBJ file is now clean..first section is vertices, second is faces. Note GTS export from MeshLab seems to have a bug as it does not export all vertices
- import to Excel as space delimited file
- copy and paste into your other programs
Success!
-
In my limited tests, it seems to me that my plugin works as expected. However I can't know if what I'm testing is anything like reality. So if you could post a model of the sample depicted in your previous post, it would be appreciated.
Advertisement