- stlread: https://www.mathworks.com/help/matlab/ref/stlread.html
- patch: https://www.mathworks.com/help/matlab/ref/patch.html
how to find and highlight inclined and flat surfaces from a cad file.
3 views (last 30 days)
Show older comments
I am trying to identify inclined surface of a cad geometry. I was able to use normal function on an stl file and get horizontal and vertical flat surface, but not able to highlight incline surface.
0 Comments
Answers (1)
Abhishek Chakram
on 9 Nov 2023
Hi Vamsi kiran sure,
It appears to me that you are facing difficulties in finding and highlighting the inclined and flat surfaces from a cad file. To identify inclined surfaces in a CAD geometry, you can use the normal vectors of the surface triangles obtained from an STL file. The normal vectors provide information about the orientation of each triangle, allowing you to determine whether a surface is inclined or not. Here is one of the approach you can follow:
1. Use “stlread” function to read STL files.
2. Calculate the normal vectors of each surface triangle in the CAD geometry. This can be done using methods such as the cross product or averaging the normal of neighbouring triangles.
3. Once you have the surface normal, you can define a threshold angle to identify inclined surfaces. Any surface with a normal vector outside a specific range of angles from the vertical or horizontal can be considered inclined. You can use the dot product or the angle between the normal vector and a reference vector (e.g., [0, 0, 1]) to determine the angle.
4. Depending on your specific requirements, you can highlight the inclined surfaces in various ways. For example, you can color the inclined surfaces differently, apply a different material, or visualize them separately.
5. Finally, you can visualize the CAD geometry with the highlighted inclined surfaces using the “patch” function.
You can refer to the following documentation to know more about the functions used:
Best Regards,
Abhishek Chakram
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!