Create a 3D printable meshed surface by puncturing each of the facets that make up the surface. For example, surf(z) for some matrix 'z' is a surface made up of four-sided facets, so punctureSurface will create four-sided holes in each facet. In general, the shape of each facet of a surface will define the shape of the hole punched into said facet.
Paul Kassebaum (2020). punctureSurface (https://www.mathworks.com/matlabcentral/fileexchange/43994-puncturesurface), MATLAB Central File Exchange. Retrieved .
Thanks for the detailed response. You are right when you pointed out the image consisted of thin surfaces. It was only for a demonstrative purpose. I've actually tried merging two stl files in meshlab and blender. The only problem that I had was that the merged surface wasn't as smooth as i wanted it to be at the points of intersection. So, I was trying to improve it on that front. I will try Paul's suggestion of concatenating faces and vertices now.
I understand. Thank you for your time, though. I appreciate it. I'm going to try concatenating the vertices now and see if that helps in generating a merged surface.
@Phalgun: I know you've been looking at this problem for a while now. I think we're all a little unsure about *exactly* what you're trying to do. The image you showed is of two thin surfaces, but you describe "printing" them. surf2solid gives a clear description of why "printing infinitely thin surfaces" is not reasonable. Here's my suggestion:
1. Take your first surface, do whatever it is that you want to do to it to make just *this* surface printable, and make an STL file <surface1.stl>
2. Take your second surface and do the same thing but make a *separate* STL file <surface2.stl>
3. Open both your files in some other *visual* software that can read STL files (VisCam, Rhinoceros 3d, Solidworks, Magics, 3D studio, the list is long and some of them are free), and try to work out exactly what you're trying to do.
I _think_ that you may be describing that you want to thicken both surfaces and then merge them into one "union" surface. If so, most of the list above can do that.
If the *reason* you're trying to do that is just that your 3d printer can only take one .stl file at a time, then you probably don't even need to "union" the two volumes into one. Instead, just use Paul's suggestion to concatenate faces/vertices and write a single .stl file.
I was logged in under a different account below this comment, but that was indeed me speaking.
Stitching such intersecting surfaces together for printing would be a rather difficult (though not theoretically impossible) procedure. I'm sorry to say that I don't have the bandwidth to solve this problem as posed. As a more tractable next best option, I recommend printing the relation between the two surfaces that you find meaningful. For example, you could easily print the difference function (f(x,y) - g(x,y)).
What I'm trying to do is have something like this - http://i.imgur.com/ukVxdHT.jpg.
I have data sets that form surfaces. I want to print both of them together.
If I understand you correctly, we cannot have two surfaces with facets that intersect, right? is there a way for me to combine them before generating facets?
You could have two interlocking surfaces, e.g. an upper and lower part of a sphere, so long as the facets form a 'water tight' connection. However I do not think you could not have two surfaces with facets that intersect each other.
For the first case, you could grab the vertices and faces of the two geometries, then concatenate them like so:
allVertices = [vertices1; vertices2];
allFaces = [faces1; faces2 + length(vertices1)];
Did I understand your scenario?
I have successfully generated a thick mesh and created an stl file using Sven's stlwrite code.
I have a question about superimposing more than one surface into the same stl file though. Suppose I have two functions Z1=f(x,y) and Z2=f(x,y) and I want to superimpose both the functions so that I can have intersecting mesh surfaces on a single stl file, is there way for me to do that?
Thanks for the heads up. A good substitute for 'delaunayTriangulation' in versions of MATLAB R2012b is explained here:
<a href='http://www.mathworks.com/help/releases/R2012b/matlab/ref/delaunaytriclass.html'>DelaunayTri class</a>.
I tried running the test regimen - tPunctureSurface.m. It returned the following error - "Undefined function 'delaunayTriangulation' for input arguments of type
Error in tPunctureSurface (line 43)
dt = delaunayTriangulation(x(:),y(:));"
After looking into it deeply, I realized that its because I'm using version r2012b, where as delaunayTriangulation is only included in r2013b. I thought I'll mention it here in case anyone else gets the same error too. It did gave me a solid mesh before the error though.
Now, I'll try to plot a 3d mesh from my excel data to see if that works.
@Paul: I _think_ that it can be done like this:
1. List all edges (ie pairs of 2 vertice inds)
2. Order them from low-to-high inds
3. Take the unique(edges,'rows')
4. Any edges row that appeared only once (which you can check via the 3rd output to unique()) is a boundary edge.
The task of forming that list into a closed loop is a separate issue.
Thanks :) I completely agree with your assessments and will implement them asap.
The problem with the boundVert input is indeed related to my attempt at general meshes. I've been playing around with Voronoi meshes, which have boundaries that are difficult to automatically determine. The Voronoi meshes are also what drove me to write the code to handle the case of a surface described by facets with variable number of edges. This case will drive the improvements on this submission.
Feel free to riff off of this ;)
Excellent. Very nice idea nicely done that also works as prescribed. Paul, perhaps the help could be elaborated to describe that each individual facet will be perforated. And maybe the "boundVert" input is one that could be computed automatically... I'm not 100% sure yet, but it feels like the "odd one out" in the input parameters and at least for triangular face input it could be garnered via the TriRep or triangulation classes. I see though that you handle all types of input not just triangulations, so perhaps it's needed for higher edge counts per face. All in all, very well done.
Updated to MATLAB Toolbox file.
Attempt to clarify the description field.
Added copyright information.