How to write multiple object surfaces/solids to a single .stl file?

15 views (last 30 days)
I have multiple object surfaces (refer to the image attached below) in Matlab defined by X,Y,Z coordinate data and Triangle connectivity (T). I am using stlwrite function to create a stl file from triangulation object. It can write only one triangulation object surface to a stl file. So if I have 100's of objects, I will have to create that many stl files. But, Is there a way to write all object surfaces into a single stl file? Thank you.

Answers (1)

Pratyush Swain
Pratyush Swain on 18 Apr 2024
Hi Vinit,
I understand you want to write multiple object surfaces to a single stl file. I believe this MATLAB answer thread will be helpful for your usecase: https://www.mathworks.com/matlabcentral/answers/701737-how-could-i-generate-several-ellipsoids-in-a-single-stl-file#comment_1227172.
In the above case , the user has successfully written two ellipsoid figures into an stl file. He creates triangulation object and applies alphaShape function for each ellipsoid after which the boundary faces are extracted and new set of triangulation is established,then creates a structure to store faces and vertices of each ellipsoid and a final triangulation of all figures is forged and written to file.
I am hopeful going through above thread will provide you with helpful insights for your task.

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!