getting this error with stlwrite
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
2 comentarios
Adam Danz
el 17 de Feb. de 2020
See the examples in the stlwrite documentation.
Note how the inputs are constructed.
Respuestas (2)
Rami Ali Al-Khulaidi
el 7 de Oct. de 2021
To save it using stlwrite, I should get triangulation from stlread.....
u=stlread('ag455.stl');
stlwrite(u,'mesh.stl','binary')
0 comentarios
DGM
el 2 de Jul. de 2025
Editada: DGM
el 2 de Jul. de 2025
I think @Rami Ali Al-Khulaidi is about right in an oblique way. If you want the object geometry, you already have it. You don't need to save anything.
However, if you want an STL containing the (I presume) tetrahedral mesh generated by generateMesh(), then you're out of luck. The input to the built-in stlwrite() must be a triangulation object. While triangulation() supports both triangular and tetrahedral meshes, stlwrite() only supports plain triangular meshes.
If your model is 3D, what you have is a quadratic tetrahedral mesh represented by a 10xT list. The triangulation class does not support such a thing. As far as I know, there are no STL writers or readers which will support such a thing. I might be missing one, but most STL tools I've seen on the FEX presume that meshes are triangular. A cursory glance at references suggests that that's the specification.
If you were to try to reduce the model to a 4xT tetrahedral mesh using the 'linear' option, you could generate a triangulation object, but you're still not going to write it with stlwrite().
unzip stepholecube.stl.zip
model = createpde;
importGeometry(model,'stepholecube.stl');
pdegplot( model,'FaceLabels',"on");
%u = generateMesh(model) % default is 'quadratic'; tetrahedron list is 10xT
u = generateMesh(model,'geometricorder','linear') % list is 4xT
T = triangulation(u.Elements.',u.Nodes.'); % supports Tx3 or Tx4
stlwrite(T,'mesh.stl','binary') % supports only _triangular_ meshes (Tx3)
If there were an STL writer that can support a quadratic tetrahedral representation of a mesh, are there any external applications that can read such a file? If the answer is "no", then there's no point creating such a file. Save it as a .mat file or something else.
0 comentarios
Ver también
Categorías
Más información sobre Geometry and Mesh en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
