Generate Gyroid structures using Matlab (Meshlab +FreeCAD conversion)

preview_player
Показать описание
Gyroid generation based on Matlab script. The advantage is the capability to manipulate the thickness, position and mesh density. At the end I show how the mesh is exported, and improved in Meshlab and also converted to Solid in FreeCAD.

To calculate approximate volume fraction use:
Solid Netwrok Vf=0.5-0.333*t
Sheet network Vf=0.65*t

Source DOI :10.1177/0278364920907697

The Matlab script is below:

% Clear all previous commands
clear all
close all
clc

% Variables you can change
SizeL = 20; %average length of RVE
Def = 40; %definition

% Variables you shouldn´t change
SFact = (SizeL/2)/pi; %size factor of RVE

A = SFact*pi; %lowest and max coordinates of meshgrid
D = A/Def; %definition factor

% Generation of gyroids
[X,Y,Z] = meshgrid(-A:D:A); %creates mesh grid

% Gyroid equation
OBJ = cos(X/SFact).* sin(Y/SFact) + cos(Y/SFact).* sin(Z/SFact)...
+ cos(Z/SFact).* sin(X/SFact)+(0);
T = 0.5;
OBJ = (OBJ-T).*(OBJ+T);

% Isosurface and isocap
[F1,V1] = isosurface(X,Y,Z,OBJ,0);
[F2,V2] = isocaps(X,Y,Z,OBJ,0,'below');

%Combines isosurface and isocaps into one
F3 = [F1;F2+length(V1(:,1))];
V3 = [V1;V2];

% Visualization
P = patch('Vertices',V3,'Faces',F3,'FaceColor', ...
'red','EdgeColor','none');
view(3)
camlight

% STL export of independet files per gyroid.
% Change current file path with desired file path.
stlwrite(['C:\...filepath...\G1-T05' num2str(1) '.stl'],F3,V3);

%Visualization
axis equal
Рекомендации по теме
Комментарии
Автор

Big Thanks for the wonderful Tutorial! Greetings from a german engineering student😊

Aamor
Автор

Thank you very much! I'm researching different lattice structures for orthopaedic applications. You have saved me a lot of time!

maxgoris
Автор

Thank you so much. I have a question.

% Gyroid equation
OBJ = cos(X/SFact).* sin(Y/SFact) + cos(Y/SFact).* sin(Z/SFact)...
+ cos(Z/SFact).* sin(X/SFact)+(-0.3);
T = 0.5;
OBJ = (OBJ-T).*(OBJ+T);

In this part, how 'OBJ = (OBJ-T).*(OBJ+T);' this part creates 2 surfaces? It there any reference that you used?

신상오원자력공학과한
Автор

Hi sir

I followed your order correctly but there is error in FreeCAD conversion

When I click "convert to solid", I got this error message.

File "<string>", line 2, in <module>
<class 'Part.OCCError'>: Shape is not a shell
20:11:50 Cannot convert because Shape is not a shell.

Did you really succeed to do this order?

Thank you so much

신상오원자력공학과한
Автор

I’m trying to create a lattice structure of gyroids. Each unit cell 3x3x3 mm then using Formlabs 3 to print it. I guess I confused on how to understand what dimensions this code makes the gyroid. Is this something that can be altered in FreeCAD? Also, how would I repeat the gyroids to make the lattice structure?

joerees
Автор

Hello, thank you very much for the tutorial, it is very helpful!
One question: when trying to convert to a solid in the last step, I get this error from FreeCAD: Cannot convert gyroid_T05_601_clean001 because Shape is not a shell. Do you know why?

alejandroalonso
Автор

Hey,
What we created the Gyroid TPMS structure using MS Lattice and have the STL file, any suggestions on how to convert the file to Step or IGES for performing FEA analysis. Im having a hard time cause there are no surfaces in the STL file.

pawanharsha
Автор

Thank you so much for your help. In this same code can I generate the gyroid's complementary volume so that it all sms up to a cube?
How do I proceed

OfufualuaguAugustus
Автор

Thank you. I would like to visualise the uncombined nodes cut at the edges. How do I do that?

OfufualuaguAugustus
Автор

Thanks for your great work
I have a question, if it is possible to have a row of them, for example, 10 gyroid next to each other in a line

fereshteh-tnkk
Автор

Hello! Is it possible for me to alter the triangualtion (deciding if it should be very triangulated or just a little) options for the .stl file?
Thanks.

OfufualuaguAugustus
Автор

Sir could you please tell me the version of this meshlab. In the latest meshlab the convert vertices and compact face is not available.

SubhaNath-mu
Автор

Thanks for your great and helpful video. One question, can you let me know how can I make a foam with certain amount of porosity, for example 90%, please?

fereshteh-tnkk
Автор

One more question ...whenever I try to save as .stl file the program tells me "Error using stlwrite
Input argument must be a triangulation object." how do I solve this?"

OfufualuaguAugustus
Автор

Thank you for useful content! I have a question. How can I make the structure has more finer unit cell??

いーま-vj
Автор

Sir could you please tell me which version or matlab you have used. Actually the stlwrite is not working in my matlab 2024b.I have already addon stl write

SubhaNath-mu
Автор

If it's other TPMS (example Diamond), how can I find Vf equation ?

chaiyasitpoompurk
Автор

Thank you so much! I have a question.

% Gyroid equation
OBJ = cos(X/SFact).* sin(Y/SFact) + cos(Y/SFact).* sin(Z/SFact)...
+ cos(Z/SFact).* sin(X/SFact)+(-0.3);
T = 0.5;
OBJ = (OBJ-T).*(OBJ+T);

In this part, I can't understand how "OBJ = (OBJ-T).*(OBJ+T);" works to create 2 isosurfaces. Is there any reference which you used?

Thank you ^^

신상오원자력공학과한
Автор

I tried to save the file using stl but it requested the triangulation I don't know how to fix it could you please help me?

LorenzoPiccinini-umhd
Автор

Thank you for your support.
I have some doubt in my mind and I will feel grateful if you please resolve these issues.
1. After creation of a part when I am not to select any face, which is required for assembly.
2. I want to simulate the structure in abaqus. Which file format I should save after freeCAD

SubhaNath-mu