I have just found what I wanted in the fileExchange: http://www.mathworks.com/matlabcentral/fileexchange/5562-tubeplot and similar....I will try it out and maybe come back with additional questions... nevertheless thank you!
Can I solidify a curve?
4 views (last 30 days)
Show older comments
Hi guys,
I am looking for a way to solidify a curve and later export this as an .stl file.
I found a function (<http://www.mathworks.com/matlabcentral/fileexchange/42876-surf2solid-make-a-solid-volume-from-a-surface-for-3d-printing>) which solidifies a surface.
I got a pretty complex curve (plotted using ezplot3) in 3D space and now want it to be a solid tube-like strutcture instead of a thin line.
Thank you very much.
Rene
0 Comments
Accepted Answer
Rene Suchantke
on 23 Mar 2015
Moved: DGM
on 5 Apr 2025
1 Comment
DGM
on 5 Apr 2025
Edited: DGM
on 29 Jul 2025
Since tubeplot() produces a closed surface, surf2solid() isn't needed. The output will still be gridded data and will need to be trianglated and written to a file.
Tools like surf2stl() or Sven's old stlwrite() can triangulate the gridded data and write it. Alternatively, surf2patch() can be used to do the triangulation, leaving the user other options for writing the file.
In modern versions, we don't need those third party tools anymore. We can just use surf2patch() and stlwrite().
% get the gridded data
t = linspace(0,2*pi,50);
[x,y,z] = tubeplot([cos(t);sin(t);0.2*(t-pi).^2],0.1); %FEX #5562
% visualize it if desired
surf(x,y,z)
daspect([1,1,1]); camlight;
% circa 2015 (triangulate then encode)
[F V] = surf2patch(x,y,z,'triangles'); % quad to tri
stlWrite('tube1.stl',F,V) % FEX #20922 or #51200
% circa 2015 (let the encoder do both)
%surf2stl('tube2.stl',x,y,z) % FEX #4512
stlWrite('tube2.stl',x,y,z,'triangulation','f') % FEX #20922 or #51200
% modern versions (R2018b+)
[F V] = surf2patch(x,y,z,'triangles'); % quad to tri
T = triangulation(F,V); % put it in a triangulation object
stlwrite(T,'tube3.stl') % this is built-in
More Answers (0)
See Also
Categories
Find more on Octave in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!