Asked by Sadeep Thilakarathna
on 5 Jul 2018

I want to export 3D spheres generated in Matlab to ANSYS or Abaqus. 3D spheres are randomly generated and I want to mesh the 3D spheres and analyse those. Can anyone help me to export the 3D sphere plot to any meshing software like Gmsh or Ansys or Abaqus?

Answer by Anton Semechko
on 6 Jul 2018

Edited by Anton Semechko
on 6 Jul 2018

The builtin 'ellipsoid' and 'sphere' functions produce bad quality meshes (in terms of element shapes and connectivity of the vertices). You can get much better quality meshes using functions from here.

Here are is an example:

% Unit sphere based on subdivision of an icosahedron; triangular mesh

TRa=SubdivideSphericalMesh(IcosahedronMesh,4);

% Unit sphere based on subdivision of a cube; quadrilateral mesh

TRb=SubdivideSphericalMesh(QuadCubeMesh,4);

% Visualize

figure('color','w')

subplot(1,3,1)

h=trimesh(TRa);

set(h,'EdgeColor','k','FaceColor',[0.9 0.9 0.9],'EdgeAlpha',0.5);

axis equal off vis3d

view([30 30])

zoom(1.5)

avp=GetAxesViewProps(gca);

ha=subplot(1,3,2);

h=patch(TRb);

set(h,'EdgeColor','k','FaceColor',[0.9 0.9 0.9],'EdgeAlpha',0.5);

axis equal off vis3d

MatchAxesView(avp,ha)

% Plot sphere generated with built-in 'sphere' function for comparison

ha=subplot(1,3,3);

[X,Y,Z]=sphere(20);

h=surf(X,Y,Z);

set(h,'EdgeColor','k','FaceColor',[0.9 0.9 0.9],'EdgeAlpha',0.5);

axis equal off vis3d

MatchAxesView(avp,ha)

1) When exporting the meshes, do you want the program to recognize the individual spheres or would it be OK if the their face-vertex connectivity lists were merged (so you would have a single mesh containing multiple disconnected spheres)?

2) What type of meshes will you be generating after exporting the spheres; hexahedral or tetrahedral?

Anton Semechko
on 12 Jul 2018

Sadeep Thilakarathna
on 12 Jul 2018

Biltu Mahato
on 17 Oct 2018

Sign in to comment.

Opportunities for recent engineering grads.

Apply Today
## 2 Comments

## Anton Semechko (view profile)

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/409054-how-to-export-3d-spheres-3d-plot-generated-in-matlab-to-ansys-or-abaqus#comment_586288

## Sadeep Thilakarathna (view profile)

## Direct link to this comment

https://www.mathworks.com/matlabcentral/answers/409054-how-to-export-3d-spheres-3d-plot-generated-in-matlab-to-ansys-or-abaqus#comment_586294

Sign in to comment.