Propeller Blade Curve Functions

The following group of API functions may be used to control parametric propeller blade curves (PCurves).

SetPCurve(geom_id, pcurveid, tvec, valvec, ...)

Set the parameters, values, and curve type of a propeller blade curve (P Curve)

PCurveConvertTo(geom_id, pcurveid, newtype)

Change the type of a propeller blade curve (P Curve)

PCurveGetType(geom_id, pcurveid)

Get the type of a propeller blade curve (P Curve)

PCurveGetTVec(geom_id, pcurveid)

Get the parameters of a propeller blade curve (P Curve).

PCurveGetValVec(geom_id, pcurveid)

Get the values of a propeller blade curve (P Curve).

PCurveDeletePt(geom_id, pcurveid, indx)

Delete a propeller blade curve (P Curve) point

PCurveSplit(geom_id, pcurveid, tsplit)

Split a propeller blade curve (P Curve) at the specified 1D parameter

ApproximateAllPropellerPCurves(geom_id)

Approximate all propeller blade curves with cubic Bezier curves.

ResetPropellerThicknessCurve(geom_id)

Reset propeller T/C curve to match basic thickness of file-type airfoils.

Details

openvsp.SetPCurve(geom_id, pcurveid, tvec, valvec, newtype)[source]

Set the parameters, values, and curve type of a propeller blade curve (P Curve)

prop_id = AddGeom( "PROP" )

Update()

tvec = PCurveGetTVec( prop_id, PROP_CHORD )
valvec = PCurveGetValVec( prop_id, PROP_CHORD )

SetPCurve( prop_id, PROP_CHORD, tvec, valvec, PCurveGetType( prop_id, PROP_CHORD ) )

Update()

assert len( PCurveGetTVec( prop_id, PROP_CHORD ) ) == len( tvec ), "SetPCurve did not take"

See also: PCURV_TYPE :param [in]: geom_id string Parent Geom ID :param [in]: pcurveid int P Curve index :param [in]: tvec vector <double> Array of parameter values :param [in]: valvec vector <double> Array of values :param [in]: newtype int Curve type enum (i.e. CEDIT)

openvsp.PCurveConvertTo(geom_id, pcurveid, newtype)[source]

Change the type of a propeller blade curve (P Curve)

prop_id = AddGeom( "PROP" )

Update()

PCurveConvertTo( prop_id, PROP_CHORD, LINEAR )

Update()

assert PCurveGetType( prop_id, PROP_CHORD ) == LINEAR, "PCurveConvertTo did not change the type"

See also: PCURV_TYPE :param [in]: geom_id string Parent Geom ID :param [in]: pcurveid int P Curve index :param [in]: newtype int Curve type enum (i.e. CEDIT)

openvsp.PCurveGetType(geom_id, pcurveid)[source]

Get the type of a propeller blade curve (P Curve)

prop_id = AddGeom( "PROP" )

Update()

t = PCurveGetType( prop_id, PROP_CHORD )

assert t >= 0, "PCurveGetType returned a bad type"

See also: PCURV_TYPE :param [in]: geom_id string Parent Geom ID :param [in]: pcurveid int P Curve index :rtype: int :return: int Curve type enum (i.e. CEDIT)

openvsp.PCurveGetTVec(geom_id, pcurveid)[source]

Get the parameters of a propeller blade curve (P Curve). Each parameter is a fraction of propeller radius.

prop_id = AddGeom( "PROP" )

Update()

tvec = PCurveGetTVec( prop_id, PROP_CHORD )

assert len( tvec ) > 0, "PCurveGetTVec returned nothing"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – pcurveid int P Curve index

Return type:

std::vector< double,std::allocator< double > >

Returns:

vector <double> Array of parameters

openvsp.PCurveGetValVec(geom_id, pcurveid)[source]

Get the values of a propeller blade curve (P Curve). What the values represent id dependent on the curve type (i.e. twist, chord, etc.).

prop_id = AddGeom( "PROP" )

Update()

valvec = PCurveGetValVec( prop_id, PROP_CHORD )

assert len( valvec ) > 0, "PCurveGetValVec returned nothing"

assert len( valvec ) == len( PCurveGetTVec( prop_id, PROP_CHORD ) ), "PCurveGetValVec disagrees with the T vector"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – pcurveid int P Curve index

Return type:

std::vector< double,std::allocator< double > >

Returns:

vector <double> Array of values

openvsp.PCurveDeletePt(geom_id, pcurveid, indx)[source]

Delete a propeller blade curve (P Curve) point

prop_id = AddGeom( "PROP" )

Update()

# A cubic edit curve holds its points in groups and will not give one up on its own, so put
# the curve into a form where a single point can go.
PCurveConvertTo( prop_id, PROP_CHORD, LINEAR )

Update()

n = len( PCurveGetTVec( prop_id, PROP_CHORD ) )

PCurveDeletePt( prop_id, PROP_CHORD, 1 )

Update()

assert len( PCurveGetTVec( prop_id, PROP_CHORD ) ) < n, "PCurveDeletePt did not remove a point"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – pcurveid int P Curve index

  • [in] – indx int Point index

openvsp.PCurveSplit(geom_id, pcurveid, tsplit)[source]

Split a propeller blade curve (P Curve) at the specified 1D parameter

prop_id = AddGeom( "PROP" )

Update()

n = len( PCurveGetTVec( prop_id, PROP_CHORD ) )

PCurveSplit( prop_id, PROP_CHORD, 0.55 )

Update()

assert len( PCurveGetTVec( prop_id, PROP_CHORD ) ) > n, "PCurveSplit did not add a point"
Parameters:
  • [in] – geom_id string Parent Geom ID

  • [in] – pcurveid int P Curve index

  • [in] – tsplit double 1D parameter split location

Return type:

int

Returns:

int Index of new control point

openvsp.ApproximateAllPropellerPCurves(geom_id)[source]

Approximate all propeller blade curves with cubic Bezier curves.

# Add Propeller
prop = AddGeom( "PROP", "" )

# Take the blade curves off Bezier so the approximation has something to do.
PCurveConvertTo( prop, PROP_CHORD, PCHIP )
PCurveConvertTo( prop, PROP_TWIST, PCHIP )
PCurveConvertTo( prop, PROP_THICK, PCHIP )

Update()

assert PCurveGetType( prop, PROP_CHORD ) == PCHIP, "the blade curves would not convert to PCHIP"

ApproximateAllPropellerPCurves( prop )

# Every blade curve is now a cubic Bezier.
assert PCurveGetType( prop, PROP_CHORD ) == CEDIT, "ApproximateAllPropellerPCurves did not convert the curves"
assert PCurveGetType( prop, PROP_TWIST ) == CEDIT, "ApproximateAllPropellerPCurves did not convert the curves"
assert PCurveGetType( prop, PROP_THICK ) == CEDIT, "ApproximateAllPropellerPCurves did not convert the curves"

# A cubic Bezier is stored in groups of three, so the control point count is
# one more than a multiple of three.
tvec = PCurveGetTVec( prop, PROP_CHORD )

assert len( tvec ) >= 4 and ( len( tvec ) - 1 ) % 3 == 0, "the converted curve is not a cubic Bezier"
Parameters:

[in] – geom_id string Geom ID

openvsp.ResetPropellerThicknessCurve(geom_id)[source]

Reset propeller T/C curve to match basic thickness of file-type airfoils. Typically only used for a propeller that has been constructed with file-type airfoils across the blade. The new thickness curve will be a PCHIP curve with t/c matching the propeller’s XSecs – unless it is a file XSec, then the Base thickness is used.

# Add Propeller
prop = AddGeom( "PROP", "" )

ResetPropellerThicknessCurve( prop )

Update()

# The curve is rebuilt from the blade XSecs: one PCHIP station per XSec, each
# carrying that XSec's thickness to chord ratio.
tvec = PCurveGetTVec( prop, PROP_THICK )
vvec = PCurveGetValVec( prop, PROP_THICK )

xsec_surf = GetXSecSurf( prop, 0 )

num_xsec = GetNumXSec( xsec_surf )

assert PCurveGetType( prop, PROP_THICK ) == PCHIP, "ResetPropellerThicknessCurve did not make a PCHIP curve"
assert len( vvec ) == num_xsec, "ResetPropellerThicknessCurve did not follow the XSecs"
assert len( tvec ) == len( vvec ), "ResetPropellerThicknessCurve did not follow the XSecs"

for i in range( num_xsec ):
    tc = GetXSecParm( GetXSec( xsec_surf, i ), "ThickChord" )

    # A circular XSec carries no thickness Parm; its base thickness is used
    # instead.
    if len( tc ) > 0:
        assert abs( vvec[i] - GetParmVal( tc ) ) < 1e-6, "station " + str( i ) + " does not match its XSec"

# The stations run out along the blade.
for i in range( 1, len( tvec ) ):
    assert tvec[i] > tvec[i - 1], "the thickness stations are not increasing"

# Looking up the circular XSec's thickness raises an error on purpose, so take
# it back off the queue.
err_mgr = ErrorMgrSingleton.getInstance()

while err_mgr.GetNumTotalErrors() > 0 :
    err = err_mgr.PopLastError()
Parameters:

[in] – geom_id string Geom ID