Example #1
0
def scaleAirfoil(
    airFoil: AirfoilSeq,
    chord: float,
    teThickness: float,
    percentChordToFatten: float = 0.20,
) -> AirfoilList:
    """
    Normalize, Scale, fattenTe an airfoil
    """
    scaleFactor: float = 1 / airFoil[0][0]
    nAirfoil: List[Tuple[float,
                         float]] = scaleListOfTuple(airFoil, scaleFactor)
    sAirfoil: List[Tuple[float, float]] = scaleListOfTuple(nAirfoil, chord)
    fAirfoil: AirfoilList = cast(
        AirfoilList,
        fattenTe(
            af=sAirfoil,
            t=teThickness,
            chord=chord,
            percentChordToFatten=percentChordToFatten,
        ),
    )

    return fAirfoil
Example #2
0
from wing_utils import setCtx, show

setCtx(globals())

print(f"sys.path={sys.path}")

import os

print(f'PYTHONPATH={os.environ.get("PYTHONPATH")}')

chord: float = 50
h = 100

# Normalize, Scale, fattenTe
scaleFactor = 1 / naca5305[0][0]
nNaca5305 = scaleListOfTuple(naca5305, scaleFactor)
sNaca5305 = scaleListOfTuple(nNaca5305, chord)
fNaca5305 = fattenTe(sNaca5305, 0.25, 10, 0.20)
# fNaca5305 = sNaca5305

# Create the 2D airfoil then extrude
# airfoil = cq.Workplane("YZ").spline(fNaca5305).close()
airfoil = cq.Workplane("YZ").polyline(fNaca5305).close()
halfWing = airfoil.extrude(h)
halfWingBb: cq.BoundBox = cast(cq.Shape, halfWing.val()).BoundingBox()

# If workplane is >= 0.9902054 FAILS
# splitWing = halfWing.faces("<Y").workplane(-chord*0.9902054).split(keepTop=True, keepBottom=False)
splitWingA = (halfWing.faces("<Y").workplane(-chord * 0.50).split(
    keepTop=True, keepBottom=False))
# show(splitWingA)
Example #3
0
import sys
log(sys.path)

from mh49 import mh49
from scale import scaleListOfTuple
from fattenTe import fattenTe
#from pprint import pprint
import cadquery as cq # type: ignore

from typing import Tuple, List

chord: float = 50
span: float = 50

# Normalize mh49 to 1. Assumes first point is
# the length of the chord and will scale all
# of the points to 1/mh49[0][0]
scaleFactor: float = 1/mh49[0][0]
#print(f'scaleFactor={scaleFactor}')
nMh49 = scaleListOfTuple(mh49, scaleFactor)

# Scale the normalized mh49 to the size of the chord
# and turn it into a list
sMh49: List[Tuple[float, float]] = scaleListOfTuple(nMh49, chord)
#print(f'SKINNY   sMh49={sMh49}')
fMh49: List[Tuple[float, float]] = fattenTe(sMh49, 0.5, 10)
#print(f'FATTENed fMh49={fMh49}')

result = cq.Workplane("XY").polyline(fMh49).close().extrude(span)
#pprint(vars(result))
Example #4
0
    (0.824724, -0.009772),
    (0.853553, -0.008378),
    (0.880203, -0.007048),
    (0.904508, -0.005798),
    (0.926320, -0.004645),
    (0.945503, -0.003607),
    (0.961940, -0.002699),
    (0.975528, -0.001934),
    (0.986185, -0.001326),
    (0.993844, -0.000884),
    (0.998459, -0.000615),  # Point TE 2
    (1.000000, -0.000525),
])
# s1 = cq.Workplane("YZ").polyline(translate_2d(scaleListOfTuple(t, 10.0), (-30, 30))).close()
s1 = (cq.Workplane("YZ").polyline(
    translate_2d(scaleListOfTuple(naca0005, 100.0), (-30, 30))).close())
# s1 = cq.Workplane("YZ").polyline(translate_2d(scaleListOfTuple(naca0020, 10.0), (-30, 30))).close()
# s1 = cq.Workplane("YZ").polyline(translate_2d(scaleListOfTuple([(1, 0), (0.4, 0.2), (0, 0), (0.4, -0.2)], 100.0), (-30, 30))).close()
show(s1, name="s1")

# Sketch 2

# Causes a Standard_Null error n sweep if circle
# radius is <= 0.5 and s1 is t, naca0005 or naca002
# s2 = cq.Workplane("XY").moveTo(30, 0).circle(0.5)

# s2 = cq.Workplane("XY").moveTo(30, 0).circle(10)
# s2 = cq.Workplane("XY").moveTo(30, 0).ellipse(5, 20)
s2 = (cq.Workplane("YX").polyline(
    translate_2d(scaleListOfTuple(naca0020, 100.0), (-30, 30))).close())
show(s2, name="s2")
Example #5
0
from mh49 import mh49
from naca0009 import naca0009
from scale import scaleListOfTuple
from fattenTe import fattenTe
import cadquery as cq  # type: ignore

from typing import Tuple, List

chord: float = 50
span: float = 150

# Normalize mh49, scale to chord and then fatten trailing edge
scaleFactor: float = 1 / mh49[0][0]
nMh49 = scaleListOfTuple(mh49, scaleFactor)
sMh49: List[Tuple[float, float]] = scaleListOfTuple(nMh49, chord)
fMh49: List[Tuple[float, float]] = fattenTe(sMh49, 0.5, 10)
#result = cq.Workplane("XY").spline(fMh49).close().extrude(span)

# Normalize naca0009, scale to chord and then fatten trailing edge
scaleFactor = 1 / naca0009[0][0]
nNaca0009 = scaleListOfTuple(naca0009, scaleFactor)
sNaca0009: List[Tuple[float, float]] = scaleListOfTuple(nNaca0009, chord)
fNaca0009: List[Tuple[float, float]] = fattenTe(sNaca0009, 0.5, 10)
#result = cq.Workplane("XY").spline(fNaca0009).close().extrude(span)

# For some reason second spline is shifted
#result = (cq.Workplane("XY")
#    .spline(fMh49).close()
#    .workplane(offset=span * 0.5)
#    .center(x=-chord/2.0, y=0) # Correct for shift (not exactly chord/2.0!)
#    .circle(5) #.spline(fMh49).close()