If I have a data set in R, what would be a good way to export it so I could get it to a service like Shapeways for 3D printing?
I don't have any "real" CAD software, but I've used Google Sketchup before.
In my case the object can be described by two surface plots, something like this:
x <- y <- seq(0,1,by=0.01)
persp(x, y, outer(x, y, function(x,y) (x+y)^2))
persp(x, y, outer(x, y, function(x,y) rep(0,length(x))), zlim=c(-1,1))
...which I would like to appear together as one object to be printed. Any ideas?
Shapeways says it can take output from MeshLab: http://sourceforge.net/projects/meshlab/files/meshlab
MeshLab, an open-source, free-as-in-beer project, is able to import this file using its .asc
format option:
dat <- data.frame(x=x, # will be recycled 101 times
y=rep(y, each=101),
z=as.vector(outer(x, y, function(x,y) (x+y)^2)))
write.table(dat, file="out.asc", row.names=FALSE, col.names=FALSE)
I probably should have done an sos-search;
library(sos)
findFn("3d printing")
.... did bring up the r2stl
package whose sole function has the same name. It also found other convex hull functions that might be useful to others that want to build other 3D shapes from data.
DWin has already made one suggestion for the mesh. If you need to export the resulting object from Meshlab and manipulate it in an extraordinarily intuitive 3D application that doesn't cost the earth then you should try MoI 3D.
I mention this because MoI has a very competent mesh engine and many of MoI's users seem to be involved in 3D printing (see for example this thread).
The developer Michael Gibson often responds to forum questions in, literally, minutes and other users in the forum are very supportive. There is a full 30-day trial version that allows you to experiment at no cost. MoI can also be scripted using JavaScript.
By its nature 3D printing is irrevocably real so it pays to be sure before you commit!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With