Delete internal faces from 3D plot

7 views (last 30 days)
Trang Hu Jia
Trang Hu Jia on 3 Feb 2022
Commented: Trang Hu Jia on 4 Feb 2022
Hello everyone,
I'm try to export the finite element into the STL file by using "stlwrite" function
The corrdinates and corresponding face are attached in "Coords" and "faces" files.
Now, I'm trying to plot 3D geometry by
fv.faces = Faces;
fv.vertices = Coords;
patch(fv,'FaceColor', [0.8 0.8 1.0], ...
'EdgeColor', 'b', ...
'FaceLighting', 'gouraud', ...
'AmbientStrength', 0.15);
camlight('headlight');
material('dull');
The result of plot are depicted as
However, when i zoomed the 3D geometry, the result appeared internal faces as
I want to eliminate all of the internal faces inside this geometry to get the continuous homogeneous solid.
Any comments or suggestion are appreciated.
Thanks in advances.

Answers (1)

Kevin Holly
Kevin Holly on 4 Feb 2022
Edited: Kevin Holly on 4 Feb 2022
You could manually remove the faces as such:
Coords = [ 0 2 0
0 2 1
0 3 0
0 3 1
0 4 0
0 4 1
1 2 0
1 2 1
1 3 0
1 3 1
1 4 0
1 4 1
2 2 0
2 2 1
2 3 0
2 3 1
2 4 0
2 4 1
3 2 0
3 2 1
3 3 0
3 3 1
3 4 0
3 4 1
4 2 0
4 2 1
4 3 0
4 3 1
4 4 0
4 4 1];
Faces = [ 1 3 4
1 4 2
1 7 8
1 8 2
1 7 9
1 9 3
2 8 10
2 10 4
3 5 6
3 6 4
3 9 10
3 10 4
3 9 11
3 11 5
4 10 12
4 12 6
5 11 12
5 12 6
7 9 10
7 10 8
7 13 14
7 14 8
7 13 15
7 15 9
8 14 16
8 16 10
9 11 12
9 12 10
9 15 16
9 16 10
9 15 17
9 17 11
10 16 18
10 18 12
11 17 18
11 18 12
13 15 16
13 16 14
13 19 20
13 20 14
13 19 21
13 21 15
14 20 22
14 22 16
15 17 18
15 18 16
15 21 22
15 22 16
15 21 23
15 23 17
16 22 24
16 24 18
17 23 24
17 24 18
19 21 22
19 22 20
19 25 26
19 26 20
19 25 27
19 27 21
20 26 28
20 28 22
21 23 24
21 24 22
21 27 28
21 28 22
21 27 29
21 29 23
22 28 30
22 30 24
23 29 30
23 30 24
25 27 28
25 28 26
27 29 30
27 30 28];
fv.faces = Faces;
fv.vertices = Coords;
p = patch(fv,'FaceColor', [0.8 0.8 1.0], ...
'EdgeColor', 'b', ...
'FaceLighting', 'gouraud', ...
'AmbientStrength', 0.15, ...
'FaceAlpha',0.5);
camlight('headlight');
material('dull');
p.Faces([11,12,19,20,27,28,29,30,37,38,45,46,47,48,55,56,63,64,65,66],:)=[];
view(-20,35)
  1 Comment
Trang Hu Jia
Trang Hu Jia on 4 Feb 2022
Thank you very much for your replying this question.
According to your suggestion,
p.Faces([11,12,19,20,27,28,29,30,37,38,45,46,47,48,55,56,63,64,65,66],:)=[];
It can manually delete internal faces in the geometry.
However, Do we need to check face by face to classified that is appeared inside ?
Suppose we have a larger geometry( have more internal faces), this would be really hard to do this.
Do we have automatically method ?
Thanks in advace.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!