Files
OpenVSP/examples/scripts/Wing.vspscript
2017-06-16 21:34:23 -07:00

53 lines
1.6 KiB
Plaintext

//==== Create A Multi Section Wing and Change Some Parameters ====//
void main()
{
//==== Add Wing ====//
string wid = AddGeom( "WING", "" );
//===== Insert A Couple More Sections =====//
InsertXSec( wid, 1, XS_FOUR_SERIES );
InsertXSec( wid, 1, XS_FOUR_SERIES );
InsertXSec( wid, 1, XS_FOUR_SERIES );
//===== Cut The Original Section =====//
CutXSec( wid, 1 );
//===== Change Driver =====//
SetDriverGroup( wid, 1, AREA_WSECT_DRIVER, ROOTC_WSECT_DRIVER, TIPC_WSECT_DRIVER );
SetParmVal( wid, "RotateAirfoilMatchDideralFlag", "WingGeom", 1.0 );
//===== Change Some Parameters 1st Section ====//
SetParmVal( wid, "Root_Chord", "XSec_1", 7.0 );
SetParmVal( wid, "Tip_Chord", "XSec_1", 3.0 );
SetParmVal( wid, "Area", "XSec_1", 45.0 );
SetParmVal( wid, "Sweep", "XSec_1", 40.0 );
//==== Because Sections Are Connected Change One Section At A Time Then Update ====//
Update();
//===== Change Some Parameters 2nd Section ====//
SetParmVal( wid, "Tip_Chord", "XSec_2", 2.0 );
SetParmVal( wid, "Sweep", "XSec_2", 60.0 );
SetParmVal( wid, "Dihedral", "XSec_2", 30.0 );
Update();
//===== Change Some Parameters 3rd Section ====//
SetParmVal( wid, "Sweep", "XSec_3", 60.0 );
SetParmVal( wid, "Dihedral", "XSec_3", 80.0 );
Update();
//==== Change Airfoil ====//
SetParmVal( wid, "Camber", "XSecCurve_0", 0.02 );
Update();
//==== Check For API Errors ====//
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
Print( err.GetErrorString() );
}
}