B-Spline from Airfoil
Forum rules
and Helpful information
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help
Also, be nice to others! Read the FreeCAD code of conduct!
Also, be nice to others! Read the FreeCAD code of conduct!
B-Spline from Airfoil
I have a set of NACA airfoil coordinates that I am importing into FreeCAD. However, when I convert the points to a wire and subsequently work through the process to create an actual wing, I end up with some 200+ individual faces. I am thinking (and please, correct me if I am wrong) that if I use a B-spline, I will end up with a single face. However, creating a B-spline from the individual points is not as easy as I had originally thought. I was attempting to create a spline by clicking each individual point, but with so many points it was not a very effective process. I also tried converting the points to a sketch and then converting the sketch into splines, but that still resulted in 200+ individual splines. Does anyone have experience with this? Or have suggestions on how I can do this more efficiently? I did try converting the input airfoil to an SVG, but the conversion process still resulted in multiple faces.
Re: B-Spline from Airfoil
Try airplane design from Addon manager...
Re: B-Spline from Airfoil
There are also these macros that can be installed from the Addon Manager as well:
Macro AeroFoil
Macro Airfoil Import & Scale
Macro ImportAirfoil
Macro AeroFoil
Macro Airfoil Import & Scale
Macro ImportAirfoil
Re: B-Spline from Airfoil
there is also this attempt for this specific task:
https://vimeo.com/user881402
https://github.com/looooo/freecad.airfoil
https://vimeo.com/user881402
https://github.com/looooo/freecad.airfoil
Re: B-Spline from Airfoil
I installed the Import & Scale, but I keep getting an 'invalid .dat file' error. I tried using the .dat file downloaded from AirfoilTools (original), but also a couple of variants with the header removed and with the points all in order. Some of the original is:Roy_043 wrote: ↑Sat Dec 31, 2022 7:54 pm There are also these macros that can be installed from the Addon Manager as well:
Macro AeroFoil
Macro Airfoil Import & Scale
Macro ImportAirfoil
NASA SC(2)-0402 AIRFOIL
103. 103.
0.000000 0.000000
0.002000 0.001350
0.005000 0.002050
0.010000 0.002800
0.020000 0.003750
0.030000 0.004450
0.040000 0.005000
0.050000 0.005500
0.060000 0.005900
0.070000 0.006250
0.080000 0.006600
Re: B-Spline from Airfoil
I get the same error although the imported geometry seems correct.
I can't get Macro_AeroFoil to work. Some installation files seem to be missing.
The code for Macro_ImportAirfoil in the Wiki is incomplete, but the full code is available here:
https://raw.githubusercontent.com/VAZMF ... il.FCMacro
With this code I was able to import https://m-selig.ae.illinois.edu/ads/coord/sc20402.dat
I can't get Macro_AeroFoil to work. Some installation files seem to be missing.
The code for Macro_ImportAirfoil in the Wiki is incomplete, but the full code is available here:
https://raw.githubusercontent.com/VAZMF ... il.FCMacro
With this code I was able to import https://m-selig.ae.illinois.edu/ads/coord/sc20402.dat
Re: B-Spline from Airfoil
Thank you very much! I discovered that the .dat file didn't close the shape, so I made a small edit to put the last points of the top and bottom at the midpoint between the original points. FreeCAD threw an error, but there was no problem with the import, and I was able to create a single-surface loft between two copies of the spline.Roy_043 wrote: ↑Sat Dec 31, 2022 11:54 pm I get the same error although the imported geometry seems correct.
I can't get Macro_AeroFoil to work. Some installation files seem to be missing.
The code for Macro_ImportAirfoil in the Wiki is incomplete, but the full code is available here:
https://raw.githubusercontent.com/VAZMF ... il.FCMacro
With this code I was able to import https://m-selig.ae.illinois.edu/ads/coord/sc20402.dat
- grandcross
- Posts: 362
- Joined: Sun Oct 11, 2015 3:08 pm
- Contact:
Re: B-Spline from Airfoil
Code I use for generating symmetric airfoils in the Rocket Workbench. If you're creating asymmetric foils, I strongly advise splitting the outline in sections (top and bottom is often sufficient), otherwise it may have difficulties fitting the curves
Code: Select all
def _airfoilY(self, x, maxThickness):
# NACA symmetrical airfoil https://en.wikipedia.org/wiki/NACA_airfoil
# y = 5 * maxThickness * ((0.2969 * math.sqrt(x)) - (0.1260 * x) - (0.3516 * x * x) + (0.2843 * x * x * x) - (0.1015 * x * x * x * x))
# Apply Horner's rule
y = 5 * maxThickness * (0.2969 * math.sqrt(x) + x * (-0.1260 + x * (-0.3516 + x * (0.2843 - x * 0.1015))))
return y
def _airfoilCurve(self, foreX, chord, thickness, height, resolution):
points = []
points1 = []
for i in range(0, resolution):
x = float(i) / float(resolution)
y = self._airfoilY(x, thickness)
points.append(FreeCAD.Vector(foreX - (x * chord), y, height))
points1.append(FreeCAD.Vector(foreX - (x * chord), -y, height))
points.append(FreeCAD.Vector(foreX - chord, 0.0, height))
points1.append(FreeCAD.Vector(foreX - chord, 0.0, height))
# Creating separate splines for each side of the airfoil adds extra reference
# points for lofting, reducing geometry errors
splines = []
splines.append(self._makeSpline(points).toShape())
splines.append(self._makeSpline(points1).toShape())
return splines
def _makeSpline(self, points):
spline = Part.BSplineCurve()
spline.buildFromPoles(points)
return spline
Re: B-Spline from Airfoil
I found this on GitHub, which required a little playing with, but I was able to generate complete propellers and run OpenFOAM on them:
https://github.com/nelinnemann/of-cases ... eller/Mesh
https://github.com/nelinnemann/of-cases ... eller/Mesh