filmov
tv
Generate Gyroid structures using Matlab (Meshlab +FreeCAD conversion)
Показать описание
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
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
Комментарии