Clear Filters
Clear Filters

Export 3D MATLAB figure to EM Simulation Software (CST).

15 views (last 30 days)
Hello,
I would like to create a cone using a square mesh and export it to CST software. I am familiar with using the triangulation function to create an STL file for a triangular mesh, but I'm unsure how to proceed with a polygonal mesh. Could you please guide me on how to generate an OBJ file for a cone made of a square mesh that can be imported into CST software?
Here is a code for a cone I want to export:
clear all
clc
res=0.5;
x=-5:res:5;
y=-5:res:5;
Z0=10;
alpha=20;
[X,Y]=meshgrid(x,y);
R=sqrt(X.^2+Y.^2);
Z=Z0-R*cotd(alpha);
figure()
f=surf(X,Y,Z)
f =
Surface with properties: EdgeColor: [0 0 0] LineStyle: '-' FaceColor: 'flat' FaceLighting: 'flat' FaceAlpha: 1 XData: [21×21 double] YData: [21×21 double] ZData: [21×21 double] CData: [21×21 double] Use GET to show all properties
axis equal
Thank you in advance!

Answers (1)

Pratyush Swain
Pratyush Swain on 15 Mar 2024
Hi Michael,
Exporting 3D MATLAB Figure to the .obj file format is not directly supported.Please refer to this third-party library from FILE Exchange on MATLAB Central: https://www.mathworks.com/matlabcentral/fileexchange/27982-wavefront-obj-toolbox which has a function write_wobj(OBJ,filename)” that can export 3D figure as an .obj file.
Additionally you can also refer to following resources:
Hope this helps.

Tags

Community Treasure Hunt

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

Start Hunting!