I have recently started a quest to find the best free software for generating complex shapes like hydrofoils. Having a good level of experience in CATIA and AutoCAD under my belt I believe that scripted CAD file generation is the way to go for hydrofoils. It makes the import of airfoil shapes from sources like airfoiltools or the UIUC Airfoil Data Site extremely easy given one has some programming experience, preferably but not necessarily in python. In addition changes in the airfoil shape can be propagated fast and easy compared to the tedious point cloud imports in most of the commercial software out there.
To give you an idea of just how painful a point cloud import in CATIA is have a look at this youtube video. Wouldn't it be much nicer to just download the CSV (comma separated values) file from the above named websites, change 1 line in the code and execute a script to regenerate the whole wing? I think it is!
Because it had come up first in discussions about possible solutions with colleagues the first proof of concept was done with CadQuery. The picture below shows a quick and cheap replica of the Axis 1150 wing generated by a python script.
The code (github) is organized in two files.
readPic.py reads the silhouette of the wing from a png file (silhouette.png), interpolates the found data points and provides a function for querying the y-coordinate for the leading edge and the length of a wing segment for a given x-position.
main.py holds the CadQuery script for drawing the wing in the cq-editor.
Also included are:
silhouette.png the wing's silhouette as PNG with 100 pixel/cm resolution (the 100 pixel/cm are not required, it can be any resolution really as long as the code can interpolate properly)
The good thing about CadQuery is that one gets results quickly. But I also had problems, for example the smoothed lofting of several wing profiles. Without the smoothing the transition from one wing profile to the next has a bump (see red arrow).
One way around this issue is to reduce the distance between the wing cross sections similar of how it was done at the wing tips. However, this solution is unsatisfying and slows the generation of the 3D object from code significantly. Another problem I ran into was to import the outline/silhouette of the wing into CadQuery. Generating an outline in a sketch in CATIA/AutoCAD with splines, lines and rounding of the corners is very easy, importing these sketches to CadQuery however took quite some work - but the code to do that is there now (readPic.py).
The next goal is to test FreeCAD, a well established CAD software that also allows python-scripted CAD drawing. It should be noted that FreeCAD has a package for the import of airfoil data from the UIUC database.
Once we found the best solution there will be tutorials on how to draw your own wing on this blog. Stay tuned!