3D ploting stl or cad file from fusion360 to matlab

조회 수: 86 (최근 30일)
Eyal Sasson
Eyal Sasson 2023년 2월 2일
편집: Matteo Verardo 2023년 8월 10일
Hello all, i want to import STL or CAD file that i created using fusion360.
eventually I want to 3D plot on a figure the object and make it rotate according to euler angles or quaternions
I couldnt find example or answer in the form that i could implement and that work.
I'll be greatful for any help :)
  댓글 수: 1
Matteo Verardo
Matteo Verardo 2023년 8월 10일
편집: Matteo Verardo 2023년 8월 10일
Hello, I have all the functions that you need. See attached video.

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

답변 (1개)

Aritra
Aritra 2023년 2월 3일
Hi, 
As per my understanding you aretrying to import a STL/CAD file in MATLAB and make the 3D model rotate as per Euler angles/quaternions.
To import a STL file in MATLAB you can make use of the importGeometry(geometryfile) function. The importGeometry function helps to import geometry from STL/STEP file. You can also refer to the below documentation to learn more about how to STL File Import.
Next to rotate a 3D figure you can make use of the rotate(g,theta) function. The rotate function rotates the geometry g about the z axis by an angle theta. Similarly, you can use the quatrotate(q,r) function to rotate a initial vector r by a quaternion q.
The below code snippet shows how to import a STL file in MATLAB and rotate it by an angle of 45 degrees using the rotate function.
figure
gm = importGeometry("Torus.stl");
pdegplot(gm)
rotate(gm , 45);
figure
pdegplot(gm)
For more details you can refer to the below MATLAB documentation on importGeometry and rotate function:
  댓글 수: 1
Eyal Sasson
Eyal Sasson 2023년 2월 3일
편집: Eyal Sasson 2023년 2월 3일
thanks
when I try the first part of the code with my stl file:
figure
gm = importGeometry("mystl.stl");
pdegplot(gm)
I get this error:
Error using pde.DiscreteGeometry
Failed to create geometry. The stl file is invalid, more than two facets share an edge.
Error in importGeometry (line 53)
gm = pde.DiscreteGeometry(geofilename);
Error in myproject (line 12)
gm = importGeometry("mystl.stl");
The obejct I created the stl from is a component which have multiple bodies that is not connected to each other, but I want to to be plotted the whole thing as one rigid body. any ideas how to make the function treat it as one rigid body?

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

카테고리

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