The attached vspscript iterates on 3 wing parameters (sweep, aspect ratio, taper ratio) to output a DegenGeom file for each combination.
The wing sweep parameter is behaving as expected but the other parameters do not appear to be update in the output DegenGeom file. To exercise script, add a single wing component to the VSP session.
Any help or suggestions would be greatly appreciated.
void main()
{
array< string > @type_array = GetGeomTypes();
if( type_array.size() > 0 )
for ( int i = 0 ; i < int(type_array.size()) ; i++ )
{
Print( type_array[i]);
}
array< string > @geom_ids = FindGeoms();
if ( geom_ids.size() < 1 )
{
Print( "---> Did not find Geoms " );
return;
}
// =========================
// === Design Parameters ===
// =========================
array< float > sweep = {0.0, 15.0, 30.0};
array< float > aspectRatio = {1.0, 2.25, 3.5};
array< float > taperRatio = {0.3, 0.45, 0.6};
// ======================
// === Find Wing Geom ===
// ======================
string wingName = "WingGeom";
geom_ids = FindGeomsWithName( wingName );
if ( geom_ids.size() < 1 )
{
Print( "---> Did not find WingGeom " );
return;
}else{
Print("Found WingGeom");
}
string wid = geom_ids[0];
Print(wid);
// File basename
string baseName = "LWD";
// Loop over Sweep
for ( int i = 0 ; i < 3; i++ )
{
SetParmVal( wid, "Sweep", "XSec_1", sweep[i]);
string SW = "_SW_"+formatFloat(i,'1',1);
// Loop over AR
for ( int j = 0 ; j < 3; j++ )
{
SetParmVal( wid, "Aspect", "XSec_1", aspectRatio[j]);
string AR = "_AR_"+formatInt(j,'1',1);
// Loop over TR
for ( int k = 0 ; k < 3; k++ )
{
SetParmVal( wid, "Taper", "XSec_1", taperRatio[k]);
string TR = "_TR_"+formatInt(k,'1',1);
string fileName = baseName+SW+AR+TR+"_DegenGeom.m";
Print (fileName);
// Update model
Update();
//==== Set File Name ====//
SetComputationFileName( DEGEN_GEOM_M_TYPE, fileName);
//==== Run Degen Geom ====//
ComputeDegenGeom( SET_ALL, DEGEN_GEOM_M_TYPE );
}
}
}
}