Exporting geometries from MATLAB to SOLIDWORKS
Exports a series of cross sections at z coordinates to a solidworks part constructed using lofts.
To use:
- open loft.m
- Create an array of the z coordinates of your cross sections - line 12
- Import your cross sections. These must be as polyshapes - see the MATLAB documentation. For this, you can use import_aerofoil.m to import aerofoils from airfoiltools.com
- For variable cross sections, you can define the cross section to use by modifying the choose_xc function
- Define your centre of transformation
- Transformations of the cross section (enlargements and rotations) occur on line 57 - modify the parameters to those desired.
- Set all file directories to those desired
- Run the program
- Open SOLIDWORKS, and create a new part
- Go to Tools --> Macros --> New and create a new macro
- Replace the code in the new macro with the code in the macro.txt file
- Save and run the macro
Note: you cannot directly export a macro from MATLAB to SOLIDWORKS. You must create a new macro in SOLIDWORKS and copy and paste the code created by this program.
Some sections may not create a loft in between due to an unknown error, these can be created manually after the rest of the part has been created. The guide curves will still be present.