Export Figure to CAD

조회 수: 5 (최근 30일)
Richard McCulloch
Richard McCulloch 2014년 3월 4일
답변: Rahul 2025년 5월 12일
I have a figure with multiple spheres. I have the locations of the centers of the spheres and I plot the Matlab figure by the following code:
[xx yy zz]=sphere;
for np=1:N
surf(D(np)*xx/2+x(np),D(np)*yy/2+y(np),D(np)*zz/2+z(np),ones(size(zz)));
hold on
end
Where D is the diameter of that particular sphere, (x,y,z) is the center of that particular sphere, and (xx,yy,zz) is used to make the surface of each sphere. It would be awesome if I could somehow save the resulting figure to a CAD file like stl or something similar. I have seen some really good files on the File Exchange, however all that I have seen only take one surface matrix as the input. Thank you for your help!
Richard
  댓글 수: 2
Akshay Kumar Pakala
Akshay Kumar Pakala 2022년 3월 23일
Hi Richard
Were you able to figure it out?
Richard McCulloch
Richard McCulloch 2022년 3월 24일
Sorry, but no I wasn’t able to end up making it work.

댓글을 달려면 로그인하십시오.

답변 (1개)

Rahul
Rahul 2025년 5월 12일
I understand that you wish to obtain a '.stl' file of multiple spheres. There are multiple options that you can consider here, which would work with multple surface matrices.
  • Consider using the 'stlwrite' function introduced in MATLAB R2018b version. This function enables the user to obtain the required '.stl' file. This function would require to combine all the spheres in a single group of faces and vertices using a 'triangulation' object.
  • Another 'stlwrite' function is available on MATLAB File Exchange which is able to achieve this.
Note: Since both functions are called 'stlwrite' the File Exchange one would not work directly. Hence modifying its name manually from the downloaded folder would allow the user to use it.
Another function 'surf2stl' availble on MATLAB File Exchange submission helps to export to '.stl' files, however it is not able to export multiple 3D objects at once.
The following MathWorks documentation and File Exchange submission can be referred:
Thanks.

카테고리

Help CenterFile Exchange에서 STL (STereoLithography)에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by