How create a 3d model then save as step file format (stp) ?

300 visualizaciones (últimos 30 días)
Dear All,
Could anyone know how to create a 3d model then save as stp file ?
for example: a spare box with edge a =10cm.
Thanks and Regards
Han

Respuesta aceptada

Gayatri Rathod
Gayatri Rathod el 1 de Mzo. de 2023
Hi Jenifer,
In MATLAB, the patch function can be used to generate a 3D model by specifying the vertices and faces of the object. This function provides a convenient way to plot and visualize 3D objects in MATLAB.
Here's an example code to create a box with edges of length 10 cm:
% Define box edges
a = 0.1; % meters
% Create box vertices
vertices = [0 0 0; a 0 0; a a 0; 0 a 0; 0 0 a; a 0 a; a a a; 0 a a];
% Create box faces
faces = [1 2 3 4; 2 6 7 3; 4 3 7 8; 1 5 8 4; 1 2 6 5; 5 6 7 8];
% Plot box
patch('Vertices', vertices, 'Faces', faces, 'FaceColor','red');
You can read more about the patch function from the following documentation: Patch Function.
To save the model as .stp file: -
  • Right now, MATLAB does not support the conversion of MATLAB files to CAD files in STEP format (STP/STEP file is a 3D CAD file format).
  • Instead, you can make use of "stlwrite" function in MATLAB to export the figure as an STL file, which is a commonly used 3D CAD file format.
  • For creating stl file: In the Matlab command window, type "stlwrite(filename,vertices,faces)". where "filename" is the name, you want to give to the STL file, "vertices" is the vertices data from the figure, and "faces" is the face data from the figure.
  • The STL file will be saved in the current Matlab working directory.
  • Then, this STL file can be imported into a 3D CAD software and can be saved as an STP file.
You can read more about the stlwrite function from the following documentation: stlwrite Function.
Hope it helps!
Regards,
Gayatri Rathod

Más respuestas (0)

Etiquetas

Productos


Versión

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by