Error Importing STL into PDE model using importGeometry()

93 visualizzazioni (ultimi 30 giorni)
Hello
I have seen a few tickets on this problem but no resolution was found. When I try to import an STL, I get the following error
model=createpde('structural')
importGeometry(model,'Gyro.stl')
'Error using pde.DiscreteGeometry'
'Failed to create geometry. The stl file is invalid, more than two facets share an edge.'
'Error in pde.EquationModel/importGeometry (line 60)'
'gm = pde.DiscreteGeometry(geofilename);'
'Error in Soft_Lattice_Struct_Analysis (line 4)'
'importGeometry(model,''Gyro.stl')
I found an explanation saying that Matlab versions after 2019b, no longer support import STL's with "multidomain geometries". If true, this feels extremely limiting on the part of Mathworks.
In addition, I have found some people suggesting to use "stlread()", then use the resulting triangulation to create a geometry using "geometryFromMesh()". However geometryFromMesh requires nodes and indices which seem impossible to know when your STL has many nodes.
Any help would be greatly appreciated!!
Thanks!
  1 Commento
ADSW121365
ADSW121365 il 1 Giu 2020
As a work-around, you can make use of gmsh (I posted an answer to a question which needed a similar approach here: https://uk.mathworks.com/matlabcentral/answers/483115-reading-msh-files-3d-in-matlab).
If you import your .stl file into gmsh and mesh it, as well as assigning physical groups for each subdomain you can utalise geometryFromMesh to import the entire mesh.
If you're performing FEM, gmsh also has a bunch of mesh optimisation tools which may help improve results/code running time. As an example for a 3D DC Conductivity problem in the PDE Toolbox, a linear optimised mesh can achieve better results than a quadratic mesh (which fills my RAM) generated by MATLABs approach of just filling the volume with elements.

Accedi per commentare.

Risposte (0)

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by