From MATLAB to SolidWorks, via Illustrator
![]()
It's easy enough to create equation-driven 2D shapes in MATLAB. It turns out that it's also fairly easy to export such shapes into Solidworks and use them to create pretty nice-looking parts in SolidWorks. In this example, I illustrate how to draw a formula-driven wing shape in MATLAB, export it as a PDF, simplify the outline in Adobe Illustrator, and then import it in Solidworks to create a wing-shaped extrusion.
Step 1: draw an airfoil profile in MATLAB and export as PDF
An equation for an airfoil can be found on Wikipedia: http://en.wikipedia.org/wiki/NACA_airfoil
I wrote a quick function to draw this equation in a MATLAB figure, and, if desired, export it as a PDF. (Find the code listed at the very bottom of this post.)
Step 2: import the PDF in Adobe Illustrator to simplify nodes
The Matlab function produces the shape by drawing lines between however many points you specify. In my case, I used 100 points, which gives a nice, smooth outline of the foil. Having that many points in Solidworks, however, is a pain. As a quick fix, I used the pen tool in Illustrator to outline the shape with a simplified Beltier curve. I placed a guide line along the long axis of the profile, drew the outline of the upper half, and then mirrored it down to get the full profile. This operation results in overlapping nodes at the two sides, which need to be joined. (Grab one of them with the 'A' tool, move it exactly over the other one, and press 'Ctrl'-'J'. A single point will result.) After going through this step, we're down to 10 points, shown below overlaid on the original 100-point outline:
none
Step 3: export illustration as DXF
For the next step, the illustration was exported from Illustrator as an AutoCAD interchange file (DXF).
Step 4: import DXF into Solidworks
- Create new SolidWorks part.
- Choose your plane.
- Go to "Insert", "DXF, DWG.."
Below are a few screen shots of the import process. Click on an image to open a bigger version.
The part below is based on the profile above:
Appendix: MATLAB function to draw or PDF export an airfoil shape
function airfoil_NACA00xx(c,t,res,pf) % % AIRFOIL_NACA00XX Plot a NACA 4-digit airfoil % % Function to plot a NACA 00xx airfoil % Source: Wikipedia: NACA airfoil % % Usage: % % airfoil_NACA00xx(c,t,resolution,pf) % % c chord length % t maximum thickness as a fraction of the chord % (100*t gives last two digits of NACA 4-digit denomination) % res number of points used for plotting the profile outline % pf flag for PDF output. If set to 1, a PDF file of the profile % with 1pt line thickness will be saved in the current directory. % The script will prompt you for a file name. % % Armin Hinterwirth Feb.2011 if nargin<4 pf = 0; % default: no pdf file output end res=100; % resolution, i.e. number of points end end % prepare chord vector: % NACA 00xx airfoil formula (4 digit, symmetrical foil) % source: Wikipedia - NACA airfoil) % 0.3537*(x/c).^2 + 0.2843 * (x/c).^3 - 0.1015*(x/c).^4 ); % c is chord length % x is position along chord from 0 to c % y is half-thickness at given value of x % t is maximum thickness as a fraction of the chord % (100*t gives last two digits of NACA 4-digit denomination) 'NumberTitle', 'off', ... 'Name', 'NACA airfoil'); hold on; hold off; grid on; axis equal; % print to PDF only if pf equals 1: if pf == 1 'visible', 'off', ... 'PaperPosition', [0.5 0.5 10 7.5], ... 'PaperSize', [11 8.5]); hold on; hold off; axis equal; box off; axis off; fname = [fstr1 '.pdf']; else else end else end end end % if end % of it all

.jpg)
.jpg)