You are welcome Max! Share this video with those who might be interested and let me know If I can further help or what additional video could be useful.
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 "", line 2, in : Shape is not a shell 20:11:50 Cannot convert GyroidD_40_t_0_T_0_5_____50K001 because Shape is not a shell. Did you really succeed to do this order? Thank you so much
Try to adjust the mesh density you generate in matlab , your mesh might have defects in it. As mentioned in the video, the step in Meshlab for mesh optimization is very helpful, and in some cases necessary.
@@신상오원자력공학과한 have you adjusted the t value or are u following the exact same steps in the vid. I would say try Fusion360 to convert mesh to CAD . Maybe the new FreeCAD has a code problem.
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?
Hello. In the OBJ equation multiply or divide "X" , "Y" ,"Z" by 2 and try. That is ine way to have 8 gyroids... The best way is still to generate one and in an STL manipulation software xombine them. Like meshlab.
Been working on this for a little while. Followed your process but have been trying to upload the file into NX Siemens to work on it more. When I upload into NX, each element appears to be its own body.. any suggestion on how to make it one solid body? Is this something I’m messing up in freeCAD
@@joerees9060 Replace the section where the main equation is written with this: % Gyroid equation OBJ = cos(X/2*SFact).* sin(Y/2*SFact) + cos(Y/2*SFact).* sin(Z/2*SFact)... + cos(Z/2*SFact).* sin(X/2*SFact)+(0); Change Def = 80; (Improves mesh quality) Try it. You will get multiple gyroids.
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?
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.
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.
@@RamiRouhana % Clear all previous commands clear all close all clc % Variables you can change Sizex = 1; %average length of RVE Sizey = 1; Sizez = 1; Def = 60; %definition % Variables you shouldn´t change SFactx = (Sizex/2)/pi; %size factor of RVE SFacty = (Sizey/2)/pi; SFactz = (Sizez/2)/pi; A = SFactx*pi; %lowest and max coordinates of meshgrid B = SFacty*pi; C = SFactz*pi; Dx = A/Def;%definition factor Dy = B/Def; Dz = C/Def; % Generation of gyroids [X,Y,Z] = meshgrid(-A:Dx:A, -B:Dy:B, -C:Dz:C); %creates mesh grid % Gyroid equation OBJ =(A*B*C)-(cos(X/SFactx).* sin(Y/SFacty) + cos(Y/SFacty).* sin(Z/SFactz)... + cos(Z/SFactz).* sin(X/SFactx)+(0)); OBJ1=(cos(X/SFactx).* sin(Y/SFacty) + cos(Y/SFacty).* sin(Z/SFactz)... + cos(Z/SFactz).* sin(X/SFactx)+(0)); T = 0.5; OBJ =(OBJ-T); OBJ1=(OBJ1-T); % Isosurface and isocap [F1,V1] = isosurface(X,Y,Z,OBJ,0); [F2,V2] = isocaps(X,Y,Z,OBJ,0,'below'); [F4,V4] = isosurface(X,Y,Z,OBJ1,0); [F5,V5] = isocaps(X,Y,Z,OBJ1,0,'below'); %Combines isosurface and isocaps into one F3 = [F1;F2+length(V1(:,1))]; V3 = [V1;V2]; F6 = [F4;F5+length(V4(:,1))]; V6 = [V1;V4]; % Visualization P = patch('Vertices',V3,'Faces',F3,'FaceColor', ... 'magenta','EdgeColor','none'); view(3) camlight P = patch('Vertices',V6,'Faces',F6,'FaceColor', ... 'green','EdgeColor','none'); view(3) camlight %Visualization axis equal here is the code...i want to represent both the gyroid's and its complement inside the cube but with different colors...The graph is a little strange. Do you have any idea why?
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
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?
@@alejandroalonso2216 hello. I am glad you found the tutorial usefull. Probably you reduced the mesh size too much in meshlab or the mesh was not cleaned.
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?"
it could be that you are using a mesh sensity that is low. Try first to run the code as it is and see if the STL is generated. If it works and then give errors due to the changes you made, then the changes you have made are causing the error.
With this script it would be easier to make on cell and make the repition using the generated STL on another software like meshlab. You could do it by adjusting the paremeters in direction x to compress 10 cells in and then later stretch it but the mesh will not be very homogenous. You could also try to define a larger volume for X direction, but I have not myself tried that.
Respected sir, Thank you for this outstanding video. It helps me lot for my research. I have some doubts regarding this video and it will be grateful if you help me on that. 1. What is the thickness of this sheet type gyroid? 2. How can I create network type gyroid with specific volume fraction?
I am glad this video is helpful. 1-The wall tickness if the sheet gyroid is not constant. You can estimate it by setting X and Y to 0 in the equation and calculate for Z value for the constant set to +t and -t. Example : sinx cosy + sin y cos z + sin z cos x = +0.1 sinx cosy + sin y cos z + sin z cos x = -0.1 These two equations give you a sheet gyroid. To find approximate thickness : sin 0 cos 0 + sin 0 cos z + sin z cos0 =+0.1 sin 0 cos 0 + sin 0 cos z + sin z cos0 =-0.1 Solve for Z and calculate the difference, you will have the sheet thickness in Z. It would be better to do the same for X and then also for Y. The smallest value it the closest to to average. 2-This paper will help you with your questions. journals.sagepub.com/doi/10.1177/0278364920907697
The volume fraction of the sheet-like structure can be controlled by its thickness that is constant throughout the structure and depends on the values chosen for the constant . The relationship between the level set constant and the volume fraction of the solid-network Gyroid reinforcement phase is as follows: Vf = 0.65c
hello, Can I ask you a question? The following error occurs when executing your code. " Input argument must be a triangulation object " Maybe the cause of the problem is 'stlwrite'. How can I solve this problem?
Hello. When the error occurs it indicates usually the line of code where the error is. The forums suggest it is an error related to stlwrite yes. Make sure you install the plugin using Matlab add-ons. It could be dependent on the matlab version you are using also.
Hi Rami, When I get to the last step of converting the surfaces to a solid I run into an error on FreeCAD. I select G1_T05_50K001 > Part > Convert to solid and then the error reads "Cannot convert model because Shape is not a shell. Any recommendations on what to do? I tried exporting it after the fact and my program just frozen indefinitely.
@@RamiRouhana Do you know if meshlab changed some of their settings? I could not find compact faces and vertices in their submenus so I went straight for removing and merging.
Yes there are methods if you export node coordiates you can make what is called SPH in Abaqus. Or you can adjust the script in matlab to generate a sphere at the location of nodes, there are tutorials of that.
@@relab5346 It is not an easy task in matlab. It is better if you import the CAD to abaqus. Look for tutorials to convert the CAD to particles SPH in abaqus. For matlab , this might help arxiv.org/abs/2209.05189
In the code, this is the Gyroid equation. % Gyroid equation OBJ = cos(X/SFact).* sin(Y/SFact) + cos(Y/SFact).* sin(Z/SFact)... + cos(Z/SFact).* sin(X/SFact)+(0); The Diamond Equation is : sin(X/SFact).* sin(Y/SFact).* sin(Z/SFact) + sin(X/SFact).* cos(Y/SFact).* cos(Z/SFact)+ cos(X/SFact).* sin(Y/SFact).* cos(Z/SFact)+ cos(X/SFact).* cos(Y/SFact) .* sin(Z/SFact) - (0); replace it in the code.
Hi, I had two questions and was wondering if you could help me out. 1. How do I generate the gyroids but instead of the walls in the sheet type, I want the paths inside the double gyroids. 2. I want to control the thickness of the paths as well. Thanks in advance!
Hello, 1- you should switch the boundary limits and the volumes you combine at the end of the code. It is doable, if you break down the code and the functions in it. 2-The thickness can always be controlled by the T parameters.
@@RamiRouhana hey really appreciate the quick reply! Just that I am not very good at MATLAB. I fear if I break down the code I’ll end up actually breaking it.
@@kanav1998 just experiment woth the code at the end that combines the surfaces. Keep an oroginal backup of the script. Understanding better the code will allow you to manipulate it easier.
@@RamiRouhana Thank you for your answer! I mean unit cell is a repeated structure of the gyroid structure. So, I want to know if I can make a structure that has many smaller repeated structures. Sorry for confusing you.
@@いーま-v5j That would be possible in the script but very tricky, you will need to adjust the the values in the cos(x) to cos (x/3) and then increase resolution. You will get 3 cells in the x direction.
Hello, This video is awesome and very informative. I saw you posted approximated vf for the sheet as Vf=0.65*t. How did you obtain the equation? Is there a range of t that satisfies the approximation? Could you share the reference for the equation please?
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
@@RamiRouhana I want to assembly two different TPMS structures but when I insert this in FreeCAD software I am not able to select any face of the structures to mate 2 faces
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 ^^
Hello. The equation of a gyroid is equal to a constant. By reducing or increasong the constant, the gyroid surface shifts like an offset but in 3D. So offsetting equally give a symmetric thick shell .
@@RamiRouhana Thank you. Sir And I have one more problem in FreeCAD I followed your order well but when I do this function Part - Convert to Solid There is a error msg : because Shape is not a shell I don't know why.... I really created shape from mesh first but I can't make a solid from shape
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?
@@RamiRouhana Thanks for your reply. Is F3 representative of the surface area of the gyroid, and is V3 the corresponding volume? Is there a direct relationship between the T value and the thickness of the sheet gyroid?
From your previous comment - These two equations give you a sheet gyroid. To find approximate thickness : sin 0 cos 0 + sin 0 cos z + sin z cos0 =+0.1 sin 0 cos 0 + sin 0 cos z + sin z cos0 =-0.1 Solving these 2 equations we get z= arcsin(t) & z= arcsin(-t). so arcsin(t) should be the thickness of the sheet gyroid, right?
The thickness is not a constant, this is the value you get near the center of the cube face. The deviation becomes larger with larger T values.@@SyedArafunNabi
Hello! Rami Rouhana, I think this video is very informative. I want to know more about the volume calculation of gyroid. How I can edit the MATLAB code that you provided in the description to get the volume of the gyroid? I hope this comment finds you well. Thanks.
Thank you so much. Your code was very useful for me 🙏. It is possible modify the code and make a cylinder fill with gyroid tpms unit cells? And if it is possible, how can i do that?
In your code i made some modifications for get that cylinder, with booleans operations, but the result is a little bit bad, because the surface of the units cells are stranges, so i dont know how i can solve that. % Clear all previous commands clear all close all clc % Variables you can change SizeL = 1; %average length of RVE Def = 60; %definition % Variables you shouldn´t change SFact = (SizeL/2)/pi; %size factor of RVE A = 10*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); T = (-0.05*(X.*X + Y.*Y) + 1.25); OBJ = OBJ >= 0 ; % Extrusion ExtrusionHeight = 10 CylinderRadius = 5 extrusionMask = Z CylinderRadius^2; cylindricalShape = cylinderMask & extrusionMask; % Combine gyroid structure with extrusion and cylindrical shape ResultSurface = OBJ | cylinderMask; % Isosurface and isocap [F1, V1] = isosurface(X, Y, Z, ResultSurface, 0); [F2, V2] = isocaps(X, Y, Z, ResultSurface, 0, 'below'); % Combine isosurface and isocaps into one F3 = [F1; F2 + length(V1(:, 1))]; V3 = [V1; V2]; % Visualization figure; P = patch('Vertices', V3, 'Faces', F3, 'FaceColor', 'blue', 'EdgeColor', 'none'); view(3); camlight; % STL export of the entire structure % Change current file path with desired file path. % Visualization axis equal;
@@RamiRouhana This parts (The code is up): A = 10*SFact*pi; %lowest and max coordinates of meshgrid (This for make an a repetition of the unit cells in the space) OBJ = OBJ >= 0 ; % Extrusion ExtrusionHeight = 10 CylinderRadius = 5 extrusionMask = Z CylinderRadius^2; cylindricalShape = cylinderMask & extrusionMask; % Combine gyroid structure with extrusion and cylindrical shape ResultSurface = OBJ | cylinderMask; % Isosurface and isocap [F1, V1] = isosurface(X, Y, Z, ResultSurface, 0); [F2, V2] = isocaps(X, Y, Z, ResultSurface, 0, 'below');
Respected sir, In my research I need to check any point within that TPMS or not? But in that code I am not able to do that. I will be appreciated if you kindly help me to correct that. %clear all previous commands clear all close all clc %variable you can change SizeL = 5; Def = 160; SFact = (SizeL/2)/pi; A = SFact*pi; D = A/Def; [X,Y,Z] = meshgrid(-A:D:A); OBJ = cos (X/SFact)+cos (Y/SFact)+cos (Z/SFact) + (0); T = 0; OBJ = (OBJ); [F1,V1] = isosurface (X,Y,Z,OBJ,0); [F2,V2] = isocaps(X,Y,Z,OBJ,0,'above'); F3 = [F1;F2+length(V1(:,1))]; V3 = [V1;V2]; P = patch ('Vertices',V3, 'Faces',F3,'FaceColor','blue','EdgeColor','none'); K = [0 0 0]; in = intriangulation(V3,F3,K) if in==0 fprintf("outside"); else fprintf("inside"); end view(3) camlight axis equal THANK YOU
I am sorry. I cannot help you at the momet with a specific coding task. You will need to export surface node coordinates and write a script to compare positions (In/Out).
Respected sir, Thank you for such a helpful tutorial. It helps me lot in my research. I am facing two issues regarding gyroid coding: 1. How can I insert the unit of gyroid in this code? 2. I want to create a row of gyroids then what are the changes I need to do? It will be helpful for me if you help me regarding that.
Hello Rami, great video. If I were to 3D print structures like this do you know how to fill the Gyroid walls? The model right now is hollow. Thank you very much :)
Hello Alexandre. For printing you do not need to do any changes to the exported STL file. The slicer for printing fills the volume based on you print settings, number of walls and infil precentage if you are using FDM. If you are using SLM or SLA or SLS additive technology the STL model is assumed a solid in the slicer.
Big Thanks for the wonderful Tutorial! Greetings from a german engineering student😊
Thank you! Ich wünsche Ihnen viel Erfolg bei Ihrem Studium!
Thank you very much! I'm researching different lattice structures for orthopaedic applications. You have saved me a lot of time!
You are welcome Max! Share this video with those who might be interested and let me know If I can further help or what additional video could be useful.
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 "", line 2, in
: Shape is not a shell
20:11:50 Cannot convert GyroidD_40_t_0_T_0_5_____50K001 because Shape is not a shell.
Did you really succeed to do this order?
Thank you so much
Try to adjust the mesh density you generate in matlab , your mesh might have defects in it. As mentioned in the video, the step in Meshlab for mesh optimization is very helpful, and in some cases necessary.
@@RamiRouhana
I input "40" mesh density in matlab.
And I optimized faces into 50000 faces in Meshlab.
However I got this error....TT
@@신상오원자력공학과한 have you adjusted the t value or are u following the exact same steps in the vid. I would say try Fusion360 to convert mesh to CAD . Maybe the new FreeCAD has a code problem.
Obrigado do Brasil, this is amazing!
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?
Hello. In the OBJ equation multiply or divide "X" , "Y" ,"Z" by 2 and try.
That is ine way to have 8 gyroids...
The best way is still to generate one and in an STL manipulation software xombine them. Like meshlab.
And parameterize in STL software too?
@@joerees9060 parametrize in Matlab and then use STL pattern option either in meshlab or better in CAD form in FreeCAD
Been working on this for a little while. Followed your process but have been trying to upload the file into NX Siemens to work on it more. When I upload into NX, each element appears to be its own body.. any suggestion on how to make it one solid body? Is this something I’m messing up in freeCAD
@@joerees9060 Replace the section where the main equation is written with this:
% Gyroid equation
OBJ = cos(X/2*SFact).* sin(Y/2*SFact) + cos(Y/2*SFact).* sin(Z/2*SFact)...
+ cos(Z/2*SFact).* sin(X/2*SFact)+(0);
Change Def = 80; (Improves mesh quality)
Try it. You will get multiple gyroids.
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?
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.
I show these steps in this video. Using FreeCAD , or you could use Fusion 360 or there is an abaqus plugin "STL to solid". Watch until the end.
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.
Hello , that is possible. Try to run the script with "Def = 40" changed to "Def = 80" . That defines the mesh density.
Thank you. I would like to visualise the uncombined nodes cut at the edges. How do I do that?
I am sorry, I cannot help you with that.
@@RamiRouhana I just want to know which part of the code to delete so the gyroïd does not become a smooth uniform surface
@@OfufualuaguAugustus Try commenting out the isosurface section.
@@RamiRouhana But if i delete that isosurface line it will impact the "combine" and "visualisation" parts.
Sir could you please tell me the version of this meshlab. In the latest meshlab the convert vertices and compact face is not available.
Hello, I currently have v2020.07
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
I have done it yes. You can export the other geometry by tweaking the combine code at the end.
@@RamiRouhana % Clear all previous commands
clear all
close all
clc
% Variables you can change
Sizex = 1; %average length of RVE
Sizey = 1;
Sizez = 1;
Def = 60; %definition
% Variables you shouldn´t change
SFactx = (Sizex/2)/pi; %size factor of RVE
SFacty = (Sizey/2)/pi;
SFactz = (Sizez/2)/pi;
A = SFactx*pi; %lowest and max coordinates of meshgrid
B = SFacty*pi;
C = SFactz*pi;
Dx = A/Def;%definition factor
Dy = B/Def;
Dz = C/Def;
% Generation of gyroids
[X,Y,Z] = meshgrid(-A:Dx:A, -B:Dy:B, -C:Dz:C); %creates mesh grid
% Gyroid equation
OBJ =(A*B*C)-(cos(X/SFactx).* sin(Y/SFacty) + cos(Y/SFacty).* sin(Z/SFactz)...
+ cos(Z/SFactz).* sin(X/SFactx)+(0));
OBJ1=(cos(X/SFactx).* sin(Y/SFacty) + cos(Y/SFacty).* sin(Z/SFactz)...
+ cos(Z/SFactz).* sin(X/SFactx)+(0));
T = 0.5;
OBJ =(OBJ-T);
OBJ1=(OBJ1-T);
% Isosurface and isocap
[F1,V1] = isosurface(X,Y,Z,OBJ,0);
[F2,V2] = isocaps(X,Y,Z,OBJ,0,'below');
[F4,V4] = isosurface(X,Y,Z,OBJ1,0);
[F5,V5] = isocaps(X,Y,Z,OBJ1,0,'below');
%Combines isosurface and isocaps into one
F3 = [F1;F2+length(V1(:,1))];
V3 = [V1;V2];
F6 = [F4;F5+length(V4(:,1))];
V6 = [V1;V4];
% Visualization
P = patch('Vertices',V3,'Faces',F3,'FaceColor', ...
'magenta','EdgeColor','none');
view(3)
camlight
P = patch('Vertices',V6,'Faces',F6,'FaceColor', ...
'green','EdgeColor','none');
view(3)
camlight
%Visualization
axis equal
here is the code...i want to represent both the gyroid's and its complement inside the cube but with different colors...The graph is a little strange. Do you have any idea why?
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
I tested on 2024b , it appears to work. Place the STL write code in the same folder where the script is.
Very helpful. Thanks so much!
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?
@@alejandroalonso2216 hello. I am glad you found the tutorial usefull. Probably you reduced the mesh size too much in meshlab or the mesh was not cleaned.
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?"
it could be that you are using a mesh sensity that is low.
Try first to run the code as it is and see if the STL is generated.
If it works and then give errors due to the changes you made, then the changes you have made are causing the error.
@@RamiRouhana The STL is not generated even with your original file. How do I increast the mesh sinsity?
@@OfufualuaguAugustus you need to instal the stl generation plugin in the right folder.
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
With this script it would be easier to make on cell and make the repition using the generated STL on another software like meshlab.
You could do it by adjusting the paremeters in direction x to compress 10 cells in and then later stretch it but the mesh will not be very homogenous. You could also try to define a larger volume for X direction, but I have not myself tried that.
👍🏻🙏
Respected sir,
Thank you for this outstanding video. It helps me lot for my research. I have some doubts regarding this video and it will be grateful if you help me on that.
1. What is the thickness of this sheet type gyroid?
2. How can I create network type gyroid with specific volume fraction?
I am glad this video is helpful.
1-The wall tickness if the sheet gyroid is not constant. You can estimate it by setting X and Y to 0 in the equation and calculate for Z value for the constant set to +t and -t.
Example :
sinx cosy + sin y cos z + sin z cos x = +0.1
sinx cosy + sin y cos z + sin z cos x = -0.1
These two equations give you a sheet gyroid.
To find approximate thickness :
sin 0 cos 0 + sin 0 cos z + sin z cos0 =+0.1
sin 0 cos 0 + sin 0 cos z + sin z cos0 =-0.1
Solve for Z and calculate the difference, you will have the sheet thickness in Z. It would be better to do the same for X and then also for Y. The smallest value it the closest to to average.
2-This paper will help you with your questions.
journals.sagepub.com/doi/10.1177/0278364920907697
The volume fraction of the sheet-like structure can be controlled by its thickness that is constant throughout the structure and depends on the values chosen for the constant . The relationship between the level set constant and the volume fraction
of the solid-network Gyroid reinforcement phase is as follows:
Vf = 0.65c
@@RamiRouhana thank you sir for this information
hello, Can I ask you a question?
The following error occurs when executing your code.
" Input argument must be a triangulation object "
Maybe the cause of the problem is 'stlwrite'.
How can I solve this problem?
Hello. When the error occurs it indicates usually the line of code where the error is. The forums suggest it is an error related to stlwrite yes. Make sure you install the plugin using Matlab add-ons.
It could be dependent on the matlab version you are using also.
@@RamiRouhana oh, I looked at the video carefully again, You've already explained it
thank you so much. I solved the problem :)
Hi Rami,
When I get to the last step of converting the surfaces to a solid I run into an error on FreeCAD. I select G1_T05_50K001 > Part > Convert to solid and then the error reads "Cannot convert model because Shape is not a shell. Any recommendations on what to do? I tried exporting it after the fact and my program just frozen indefinitely.
Hello , try checking mesh quality on meshlab and check if there are holes or bad mesh. Often there are duplicate surfaces or independent nodes.
@@RamiRouhana Do you know if meshlab changed some of their settings? I could not find compact faces and vertices in their submenus so I went straight for removing and merging.
@@jonathanvillada9330 there should be other software for mesh correction. Meshmixer maybe.
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?
Hello. Adjust the mesh density, but also check the other comments. I provided some solutions.
Can I save the file as Tiff rather than STL, also can I change the solid of the gyrode to be made of small particles of spheres
Yes there are methods if you export node coordiates you can make what is called SPH in Abaqus. Or you can adjust the script in matlab to generate a sphere at the location of nodes, there are tutorials of that.
Thanks for your reply please can you explain more, I'm a beginner in Matlab.
@@relab5346 It is not an easy task in matlab. It is better if you import the CAD to abaqus. Look for tutorials to convert the CAD to particles SPH in abaqus.
For matlab , this might help arxiv.org/abs/2209.05189
If it's other TPMS (example Diamond), how can I find Vf equation ?
In the code, this is the Gyroid equation.
% Gyroid equation
OBJ = cos(X/SFact).* sin(Y/SFact) + cos(Y/SFact).* sin(Z/SFact)...
+ cos(Z/SFact).* sin(X/SFact)+(0);
The Diamond Equation is :
sin(X/SFact).* sin(Y/SFact).* sin(Z/SFact) +
sin(X/SFact).* cos(Y/SFact).* cos(Z/SFact)+
cos(X/SFact).* sin(Y/SFact).* cos(Z/SFact)+
cos(X/SFact).* cos(Y/SFact) .* sin(Z/SFact) - (0);
replace it in the code.
thank you so much. Very useful tutorial
You are welcome.
Hi, I had two questions and was wondering if you could help me out.
1. How do I generate the gyroids but instead of the walls in the sheet type, I want the paths inside the double gyroids.
2. I want to control the thickness of the paths as well.
Thanks in advance!
Hello,
1- you should switch the boundary limits and the volumes you combine at the end of the code. It is doable, if you break down the code and the functions in it.
2-The thickness can always be controlled by the T parameters.
@@RamiRouhana hey really appreciate the quick reply! Just that I am not very good at MATLAB. I fear if I break down the code I’ll end up actually breaking it.
@@kanav1998 just experiment woth the code at the end that combines the surfaces. Keep an oroginal backup of the script. Understanding better the code will allow you to manipulate it easier.
Thank you for useful content! I have a question. How can I make the structure has more finer unit cell??
Hello , that is possible. Try to run the script with "Def = 40" changed to "Def = 80" . That defines the mesh density.
@@RamiRouhana Thank you for your answer! I mean unit cell is a repeated structure of the gyroid structure. So, I want to know if I can make a structure that has many smaller repeated structures. Sorry for confusing you.
@@いーま-v5j That would be possible in the script but very tricky, you will need to adjust the the values in the cos(x) to cos (x/3) and then increase resolution. You will get 3 cells in the x direction.
Hello, This video is awesome and very informative. I saw you posted approximated vf for the sheet as Vf=0.65*t. How did you obtain the equation? Is there a range of t that satisfies the approximation? Could you share the reference for the equation please?
Hello. I am glad you found the vid useful. The paper reference DOI is also in another comment. I can only assume that the equation holds until t=1.38
Sir could you please tell me which version of FreeCAD software you r using?
FreeCAD 0.18
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
1-What aeesmbly do you mean ??
2- save as 'SAT" file type
@@RamiRouhana I want to assembly two different TPMS structures but when I insert this in FreeCAD software I am not able to select any face of the structures to mate 2 faces
@@RamiRouhana .sat file option is not available in freecad save types
@@SubhaNath-m5u try IGS and STP
@@RamiRouhana thank you sir.
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 ^^
Hello. The equation of a gyroid is equal to a constant. By reducing or increasong the constant, the gyroid surface shifts like an offset but in 3D. So offsetting equally give a symmetric thick shell .
@@RamiRouhana Thank you. Sir
And I have one more problem in FreeCAD
I followed your order well but when I do this function
Part - Convert to Solid
There is a error msg : because Shape is not a shell
I don't know why.... I really created shape from mesh first but I can't make a solid from shape
@@신상오원자력공학과한 you have to click on the part name on the left sidebar before you do the conversion.
Very useful! Thank you!
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?
That same question was asked below. I added the equation and the reference paper.
Thanks a lot for the video. Is it possible to calculate the surface area and volume of the sheet gyroid in matlab?
The volume it is possible by the equation in the video description. Surface area should be possible but I do it on meshlab.
@@RamiRouhana
Thanks for your reply.
Is F3 representative of the surface area of the gyroid, and is V3 the corresponding volume?
Is there a direct relationship between the T value and the thickness of the sheet gyroid?
From your previous comment -
These two equations give you a sheet gyroid. To find approximate thickness :
sin 0 cos 0 + sin 0 cos z + sin z cos0 =+0.1
sin 0 cos 0 + sin 0 cos z + sin z cos0 =-0.1
Solving these 2 equations we get z= arcsin(t) & z= arcsin(-t). so arcsin(t) should be the thickness of the sheet gyroid, right?
The thickness is not a constant, this is the value you get near the center of the cube face. The deviation becomes larger with larger T values.@@SyedArafunNabi
F is the faces , and V are the vertices. @@SyedArafunNabi
sir could you please tell me how can I can convert it into 3d solid meshed?
Actually I want to apply load on one face and fixed in other end in matlab.
@@SubhaNath-m5u I explain mesh conversion on FreeCAD at the end of the video.
Thank you sir for your guidance. I am looking that is their any way we can convert this to solid in matlab itself? @@RamiRouhana
Hello! Rami Rouhana, I think this video is very informative. I want to know more about the volume calculation of gyroid. How I can edit the MATLAB code that you provided in the description to get the volume of the gyroid?
I hope this comment finds you well.
Thanks.
Hello. In the comments i posted the equation to calculate volume and the reference paper.
I will add that to the video description.
Thank you so much. Your code was very useful for me 🙏. It is possible modify the code and make a cylinder fill with gyroid tpms unit cells? And if it is possible, how can i do that?
In your code i made some modifications for get that cylinder, with booleans operations, but the result is a little bit bad, because the surface of the units cells are stranges, so i dont know how i can solve that.
% Clear all previous commands
clear all
close all
clc
% Variables you can change
SizeL = 1; %average length of RVE
Def = 60; %definition
% Variables you shouldn´t change
SFact = (SizeL/2)/pi; %size factor of RVE
A = 10*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);
T = (-0.05*(X.*X + Y.*Y) + 1.25);
OBJ = OBJ >= 0 ;
% Extrusion
ExtrusionHeight = 10
CylinderRadius = 5
extrusionMask = Z CylinderRadius^2;
cylindricalShape = cylinderMask & extrusionMask;
% Combine gyroid structure with extrusion and cylindrical shape
ResultSurface = OBJ | cylinderMask;
% Isosurface and isocap
[F1, V1] = isosurface(X, Y, Z, ResultSurface, 0);
[F2, V2] = isocaps(X, Y, Z, ResultSurface, 0, 'below');
% Combine isosurface and isocaps into one
F3 = [F1; F2 + length(V1(:, 1))];
V3 = [V1; V2];
% Visualization
figure;
P = patch('Vertices', V3, 'Faces', F3, 'FaceColor', 'blue', 'EdgeColor', 'none');
view(3);
camlight;
% STL export of the entire structure
% Change current file path with desired file path.
% Visualization
axis equal;
@@camilomaturana9011 You are welcome. What is the code you added ?
@@RamiRouhana This parts (The code is up):
A = 10*SFact*pi; %lowest and max coordinates of meshgrid (This for make an a repetition of the unit cells in the space)
OBJ = OBJ >= 0 ;
% Extrusion
ExtrusionHeight = 10
CylinderRadius = 5
extrusionMask = Z CylinderRadius^2;
cylindricalShape = cylinderMask & extrusionMask;
% Combine gyroid structure with extrusion and cylindrical shape
ResultSurface = OBJ | cylinderMask;
% Isosurface and isocap
[F1, V1] = isosurface(X, Y, Z, ResultSurface, 0);
[F2, V2] = isocaps(X, Y, Z, ResultSurface, 0, 'below');
ممكن اتواصل مع حضرتك طلبا للمساعدة في مشروعي ؟
@@haithamshawwa8573 what type of project?
Respected sir,
In my research I need to check any point within that TPMS or not? But in that code I am not able to do that. I will be appreciated if you kindly help me to correct that.
%clear all previous commands
clear all
close all
clc
%variable you can change
SizeL = 5;
Def = 160;
SFact = (SizeL/2)/pi;
A = SFact*pi;
D = A/Def;
[X,Y,Z] = meshgrid(-A:D:A);
OBJ = cos (X/SFact)+cos (Y/SFact)+cos (Z/SFact) + (0);
T = 0;
OBJ = (OBJ);
[F1,V1] = isosurface (X,Y,Z,OBJ,0);
[F2,V2] = isocaps(X,Y,Z,OBJ,0,'above');
F3 = [F1;F2+length(V1(:,1))];
V3 = [V1;V2];
P = patch ('Vertices',V3, 'Faces',F3,'FaceColor','blue','EdgeColor','none');
K = [0 0 0];
in = intriangulation(V3,F3,K)
if in==0
fprintf("outside");
else
fprintf("inside");
end
view(3)
camlight
axis equal
THANK YOU
I am sorry. I cannot help you at the momet with a specific coding task. You will need to export surface node coordinates and write a script to compare positions (In/Out).
Respected sir,
Thank you for such a helpful tutorial. It helps me lot in my research. I am facing two issues regarding gyroid coding:
1. How can I insert the unit of gyroid in this code?
2. I want to create a row of gyroids then what are the changes I need to do?
It will be helpful for me if you help me regarding that.
1-What do you mean by unit?
2- create the stl and copy in a row using fusion software.
Sir unit means I need 20 cm length gyroid
@@subhanath6405 you can scae up the stl to any size you need after genrating it.
Use fusion software or Meshlab.
Hello Rami, great video. If I were to 3D print structures like this do you know how to fill the Gyroid walls? The model right now is hollow.
Thank you very much :)
Hello Alexandre. For printing you do not need to do any changes to the exported STL file. The slicer for printing fills the volume based on you print settings, number of walls and infil precentage if you are using FDM. If you are using SLM or SLA or SLS additive technology the STL model is assumed a solid in the slicer.