Can I solidify a curve?

4 visualizzazioni (ultimi 30 giorni)
Rene Suchantke
Rene Suchantke il 23 Mar 2015
Modificato: DGM il 29 Lug 2025
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

Risposta accettata

Rene Suchantke
Rene Suchantke il 23 Mar 2015
Spostato: DGM il 5 Apr 2025
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!
  1 Commento
DGM
DGM il 5 Apr 2025
Modificato: DGM il 29 Lug 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

Accedi per commentare.

Più risposte (0)

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by