Hey! This thing is still a Work in Progress. Files, instructions, and other stuff might change!

surf2solid.m

0
Downloads
367
Views
Published on March 14, 2011
This thing was Featured on March 15, 2011

Description

This is a Matlab script to convert a surface (technically a function of two variables) into a solid that can be printed.

I wanted a way to visualize (in solid 3D) mathematical functions, and this gives you a way of converting from a mathematical description, directly to a solid.

I haven't uploaded the scripts here, because they are already at mathworks.com/matlabcentral/fileexchange/30709-surf2solidMatlab file central and keeping them up to date at one point seemed more sensible.

Instructions

The idea here is to create a surface in Matlab, and then be able to print it. There is a STL writer for Matlab (see below), but a surface isn't a closed solid, so all I've really done here is write a script that adds walls and a bottom so that the object is printable.

The scripts allow you to change a few parameters like the minimum height of the walls and the scale of the object.

There are two scripts, one for converting a function of cartesian co-ordinates, and the other for polar cylindrical co-ordinates. Pick the one you like, and have a look at the example scripts to see how to call them, or the comments in the code.

But if you want to print the output, you also need Bill McDonald's surf2stl.m function, which can also be obtained from mathworks.com/matlabcentral/fileexchange/4512-surf2stl on Matlab central.

Matlab isn't free, but if you don't have access you might try Octave, which is an almost compatible free set of software, though I haven't tested it works there.
Tags
This Thing has no tags.
Report as inappropriate

You must be logged in to post a comment.

This is exactly what I've been looking for, thank you. My control systems professor joked that I should print my homework on my makerbot; can't wait to see his reaction tomorrow when he sees that I really did...

I always wanted to print the zernike polynomials since i work in interferometry and we need them all the time. With this it should be easy.

Thanks a lot. :)

Cool idea, I might print out a set for myself as well. I wonder whether orthogonality is easier to see when you have a solid representation of the function.

Most people can't afford Matlab .. anyone have a Python version of this ?

There is a free Matlab-like tool called Octave. I haven't checked the script for compatibility, but the basic parts of it should work -- the plot that occurs while outputting may come out funny but I would hope that the STL is generated correctly. Anyone want to test if it works?

I was writing something like this, but you did it better. I used it to make the Matlab logo (above), but before printing it I imported it to OpenSCAD and cut off the parts I didn't want. The best part about editing Matlab STLs with OpenSCAD is you already know the coordinate system, so it's easy to make accurate cuts.

Cool. I like it.

It should be possible to do some more of the processing in Matlab. A some point I will see if I can set up some intersection operations to allow cutting off of bits like this.