How to convert a figure of a minimal surface into an STL or OBJ file?

18 views (last 30 days)
Hi, I've got this code for making a Schwartz D structure in MATLAB (credits to https://github.com/pttrsnv2/Minimal_Surfaces_Visualization_Code/blob/master/Minimal_Surfaces_Code_Upload_V2.m).
How could I make this into an STL or OBJ file? I need anything I could put into solidworks or fusion 360. I've tried to go through a ton of mathworks answers regarding this, but I can't seem to make stlwrite work no matter what I try.
f_sd = @(x,y,z) sin(x).*sin(y).*sin(z) + sin(x).*cos(y).*cos(z)+cos(x).*sin(y).*cos(z)...
+ cos(x).*cos(y).*sin(z);
% The limits for a 3-D plot
x_sd_l = 0;
x_sd_u = 2*pi;
y_sd_l = 0;
y_sd_u = 2*pi;
z_sd_l = 0;
z_sd_u = pi;
% Mesh density
MD_sd = 50; % Change as needed
% Face color
C_sd = 'red'; % Change as needed
figure
fimplicit3(f_sd, [x_sd_l x_sd_u y_sd_l y_sd_u z_sd_l z_sd_u], 'meshdensity',MD_sd,'facecolor',C_sd)
title('Schwarz D Plot')
xlabel('X')
ylabel('Y')
zlabel('Z')

Answers (1)

Supraja
Supraja on 12 Mar 2023
The github link you mentioned in the question is unfortunately not working. But assuming you want to convert your file into .stl or .obj file, I am attaching the documentation links below which would help you to achieve your goal.
Conversion to .stl file:
Conversion to .obj file:

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!