How can I calculate the surface area of a stl file with a cutting plane?

46 visualizaciones (últimos 30 días)
Hi everybody,
I need hepl for this task: I opened a stl file in matlab, but I would like to make calculations such as surface, volume ecc.
In particular, my goal is to calculate the surface area of the stl shown below from the top to a depth of 0,1 mm.
To date, I could basically highligth part of my stl but the code needs improvements. Could you help me?
Thank you very much!
fv = stlread('G05.stl');
patch(fv,'FaceColor', [0.8 0.8 1.0], ...
'EdgeColor', 'none', ...
'FaceLighting', 'gouraud', ...
'AmbientStrength', 0.15);
camlight('headlight');
material('dull');
axis('image');
view([-135 35]);
x1 = -10;
x2 = 10;
y1 = -10;
y2 = 10;
%pks = findpeaks(G05.stl)
%zmax= max(G05.stl);
z1 = 0.2286;
[r] = find((fv.vertices(:,1)>=x1 & fv.vertices(:,1)<=x2) & (fv.vertices(:,2)>=y1 & fv.vertices(:,2)<=y2) & (fv.vertices(:,3)>=z1));
for i = 1:size(r,1)
interest.vertices(i,:) = fv.vertices(r(i,1),:);
% interest.faces(i,:) = fv.faces(r(i,1),:);
end
for i = 1:size(r,1)/3
interest.faces(i,3) = 3*i;
interest.faces(i,2) = 3*i-1;
interest.faces(i,1) =3*i-2;
end
patch(interest,'FaceColor', [1 0 0], 'EdgeColor','none', 'FaceLighting', 'gouraud', 'AmbientStrength', 0.15);
camlight('headlight');
material('dull');
%[x,y,z] = peaks;
%[area,cellAreas,centroid] = surfarea(x,y,z);
  2 comentarios
KSSV
KSSV el 26 de Feb. de 2020
YOu want to calculate the area of the surface which is shwon red?
Flavia Lerra
Flavia Lerra el 26 de Feb. de 2020
Hi,
actually, I would like to automatically highlight the stl zone between the maximum point and a defined depth (like 0,1 mm from the maximum point downward) and calculate that surface.
In the code that I posted I entered the cordinates below but they were found by trials.
x1 = -10;
x2 = 10;
y1 = -10;
y2 = 10;
z1 = 0.2286

Iniciar sesión para comentar.

Respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by