OpenVSP API Documentation 3.51.3
Loading...
Searching...
No Matches
VSPAERO Control Surface Group Functions

This group of functions is available for manipulating VSPAERO control surface groups through the API. Note, VSPAERO also includes rectangle type sub-surfaces as possible control surfaces. Click here to return to the main page. More...

Functions

void vsp::AutoGroupVSPAEROControlSurfaces ()
std::string vsp::AddCpSlice (int cut_type, double location)
int vsp::GetNumCpSlices ()
std::string vsp::GetCpSliceID (int slice_index)
void vsp::DelCpSlice (int slice_index)
void vsp::DeleteAllCpSlices ()
void vsp::AddAllToVSPAEROControlSurfaceGroup (int CSGroupIndex)
void vsp::RemoveAllFromVSPAEROControlSurfaceGroup (int CSGroupIndex)
std::vector< std::string > vsp::GetActiveCSNameVec (int CSGroupIndex)
std::vector< std::string > vsp::GetCompleteCSNameVec ()
std::vector< std::string > vsp::GetAvailableCSNameVec (int CSGroupIndex)
void vsp::SetVSPAEROControlGroupName (const std::string &name, int CSGroupIndex)
std::string vsp::GetVSPAEROControlGroupName (int CSGroupIndex)
void vsp::AddSelectedToCSGroup (const std::vector< int > &selected, int CSGroupIndex)
void vsp::RemoveSelectedFromCSGroup (const std::vector< int > &selected, int CSGroupIndex)
int vsp::GetNumControlSurfaceGroups ()

Detailed Description

Function Documentation

◆ AddAllToVSPAEROControlSurfaceGroup()

void vsp::AddAllToVSPAEROControlSurfaceGroup ( int CSGroupIndex)
extern

Add all available control surfaces to the control surface group at the specified index

string wid = AddGeom( "WING", "" ); // Add Wing
string aileron_id = AddSubSurf( wid, SS_CONTROL ); // Add Control Surface Sub-Surface
int group_index = CreateVSPAEROControlSurfaceGroup(); // Empty control surface group
// The group starts empty and the wing offers one control surface, mirrored
// by the wing's own symmetry.
{
Print( "ERROR: CreateVSPAEROControlSurfaceGroup did not add a group" );
__failure++;
}
int num_avail = int( GetAvailableCSNameVec( group_index ).size() );
if ( num_avail < 1 )
{
Print( "ERROR: no control surfaces are available to add" );
__failure++;
}
if ( GetActiveCSNameVec( group_index ).size() != 0 )
{
Print( "ERROR: a new control surface group is not empty" );
__failure++;
}
// Everything that was available is now active, and nothing is left over.
if ( int( GetActiveCSNameVec( group_index ).size() ) != num_avail )
{
Print( "ERROR: AddAllToVSPAEROControlSurfaceGroup did not add them all" );
__failure++;
}
if ( GetAvailableCSNameVec( group_index ).size() != 0 )
{
Print( "ERROR: control surfaces are still available after adding them all" );
__failure++;
}
std::vector< std::string > GetActiveCSNameVec(int CSGroupIndex)
void AddAllToVSPAEROControlSurfaceGroup(int CSGroupIndex)
std::vector< std::string > GetAvailableCSNameVec(int CSGroupIndex)
int GetNumControlSurfaceGroups()
@ SS_CONTROL
std::string AddGeom(const std::string &type, const std::string &parent=std::string())
std::string AddSubSurf(const std::string &geom_id, int type, int surfindex=0)
Parameters
[in]CSGroupIndexint Index of the control surface group

◆ AddCpSlice()

std::string vsp::AddCpSlice ( int cut_type,
double location )
extern

Add a new VSPAERO control surface group using the default naming convention. The control surface group will not contain any control surfaces until they are added.

string wid = AddGeom( "WING", "" ); // Add Wing
string aileron_id = AddSubSurf( wid, SS_CONTROL ); // Add Control Surface Sub-Surface
int group_index = CreateVSPAEROControlSurfaceGroup(); // Empty control surface group
int num_group = GetNumControlSurfaceGroups();
if ( num_group != 1 ) { Print( "Error: CreateVSPAEROControlSurfaceGroup" ); __failure++; }
See also
AddSelectedToCSGroup
Returns
int Index of the new VSPAERO control surface group

Delete a VSPAERO control surface group. The control surfaces it held go back to being available, and the groups above it slide down to fill the gap.

string wid = AddGeom( "WING", "" ); // Add Wing
string aileron_id = AddSubSurf( wid, SS_CONTROL ); // Add Control Surface Sub-Surface
int group_index = CreateVSPAEROControlSurfaceGroup(); // Empty control surface group
SetVSPAEROControlGroupName( "Doomed_Group", group_index );
int num_active = GetActiveCSNameVec( group_index ).size();
DeleteVSPAEROControlSurfaceGroup( group_index );
{
Print( "ERROR: DeleteVSPAEROControlSurfaceGroup did not remove the group" );
__failure++;
}
// The surfaces it held are available again in a fresh group.
int new_index = CreateVSPAEROControlSurfaceGroup();
if ( int( GetAvailableCSNameVec( new_index ).size() ) != num_active )
{
Print( "ERROR: the deleted group did not release its control surfaces" );
__failure++;
}
// An index past the end has to be rejected.
DeleteVSPAEROControlSurfaceGroup( GetNumControlSurfaceGroups() );
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: DeleteVSPAEROControlSurfaceGroup accepted an index past the end" );
__failure++;
}
// That error was raised deliberately, so take it back off the queue.
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
void SetVSPAEROControlGroupName(const std::string &name, int CSGroupIndex)
See also
CreateVSPAEROControlSurfaceGroup, GetNumControlSurfaceGroups
Parameters
[in]CSGroupIndexint Index of the control surface group

Add a Cp slice to the VSPAERO Cp Slicer. The CpSlicer analysis has nothing to slice until at least one has been added.

// A fresh model already carries a default slice, so count from there.
int num_before = GetNumCpSlices();
string slice_id = AddCpSlice( X_DIR, 0.5 );
if ( slice_id.length() == 0 || GetNumCpSlices() != num_before + 1 )
{
Print( "ERROR: AddCpSlice did not add a slice" );
__failure++;
}
// The slice is its own Parm Container, so its cut can be read back.
if ( !closeTo( GetParmVal( FindParm( slice_id, "CutPosition", "CpSlice" ) ), 0.5, 1e-9 ) )
{
Print( "ERROR: AddCpSlice did not place the cut" );
__failure++;
}
if ( GetCpSliceID( num_before ) != slice_id )
{
Print( "ERROR: GetCpSliceID does not agree with AddCpSlice" );
__failure++;
}
std::string AddCpSlice(int cut_type, double location)
std::string GetCpSliceID(int slice_index)
int GetNumCpSlices()
@ X_DIR
Definition APIDefines.h:421
std::string FindParm(const std::string &parm_container_id, const std::string &parm_name, const std::string &group_name)
double GetParmVal(const std::string &parm_id)
See also
GetNumCpSlices, GetCpSliceID, DelCpSlice, DeleteAllCpSlices
Parameters
[in]cut_typeint Slice direction enum (X_DIR, Y_DIR or Z_DIR)
[in]locationdouble Location of the cut along that axis
Returns
string Cp slice ID

◆ AddSelectedToCSGroup()

void vsp::AddSelectedToCSGroup ( const std::vector< int > & selected,
int CSGroupIndex )
extern

Add each control surfaces in the array of control surface indexes to the control surface group at the specified index.

Warning
The indexes in input "selected" must be matched with available control surfaces identified by GetAvailableCSNameVec. The "selected" input uses one- based indexing to associate available control surfaces.
string wid = AddGeom( "WING", "" ); // Add Wing
string aileron_id = AddSubSurf( wid, SS_CONTROL ); // Add Control Surface Sub-Surface
int group_index = CreateVSPAEROControlSurfaceGroup(); // Empty control surface group
array < string > cs_name_vec = GetAvailableCSNameVec( group_index );
array < int > cs_ind_vec( cs_name_vec.size() );
for ( int i = 0; i < int( cs_name_vec.size() ); i++ )
{
cs_ind_vec[i] = i + 1;
}
AddSelectedToCSGroup( cs_ind_vec, group_index ); // Add all available control surfaces to the group
// Everything that was named moved from available to active.
if ( int( GetActiveCSNameVec( group_index ).size() ) != int( cs_name_vec.size() ) )
{
Print( "ERROR: AddSelectedToCSGroup did not add them all" );
__failure++;
}
if ( GetAvailableCSNameVec( group_index ).size() != 0 )
{
Print( "ERROR: control surfaces are still available after adding them all" );
__failure++;
}
void AddSelectedToCSGroup(const std::vector< int > &selected, int CSGroupIndex)
See also
GetAvailableCSNameVec
Parameters
[in]selectedvector <int> Array of control surface indexes to add to the group. Note, the integer values are one based.
[in]CSGroupIndexint Index of the control surface group

◆ AutoGroupVSPAEROControlSurfaces()

void vsp::AutoGroupVSPAEROControlSurfaces ( )
extern

Creates the initial default grouping for the control surfaces. The initial grouping collects all surface copies of the sub-surface into a single group. For example if a wing is defined with an aileron and that wing is symmetrical about the xz plane there will be a surface copy of the master wing surface as well as a copy of the sub-surface. The two sub-surfaces may get deflected differently during analysis routines and can be identified uniquely by their full name.

string wid = AddGeom( "WING", "" ); // Add Wing
string aileron_id = AddSubSurf( wid, SS_CONTROL ); // Add Control Surface Sub-Surface
//==== Add Vertical tail and set some parameters =====//
string vert_id = AddGeom( "WING" );
SetGeomName( vert_id, "Vert" );
SetParmValUpdate( vert_id, "TotalArea", "WingGeom", 10.0 );
SetParmValUpdate( vert_id, "X_Rel_Location", "XForm", 8.5 );
SetParmValUpdate( vert_id, "X_Rel_Rotation", "XForm", 90 );
string rudder_id = AddSubSurf( vert_id, SS_CONTROL ); // Add Control Surface Sub-Surface
Print( "COMPLETE\n" );
string control_group_settings_container_id = FindContainer( "VSPAEROSettings", 0 ); // auto grouping produces parm containers within VSPAEROSettings
//==== Set Control Surface Group Deflection Angle ====//
Print( "\tSetting control surface group deflection angles..." );
// setup asymmetric deflection for aileron
string deflection_gain_id;
// subsurfaces get added to groups with "CSGQualities_[geom_name]_[control_surf_name]"
// subsurfaces gain parm name is "Surf[surfndx]_Gain" starting from 0 to NumSymmetricCopies-1
deflection_gain_id = FindParm( control_group_settings_container_id, "Surf_" + aileron_id + "_0_Gain", "ControlSurfaceGroup_0" );
deflection_gain_id = FindParm( control_group_settings_container_id, "Surf_" + aileron_id + "_1_Gain", "ControlSurfaceGroup_0" );
// deflect aileron
string deflection_angle_id = FindParm( control_group_settings_container_id, "DeflectionAngle", "ControlSurfaceGroup_0" );
// Auto grouping puts each control surface in a group of its own, so the two
// that were added make two groups, and each holds one surface.
{
Print( "ERROR: AutoGroupVSPAEROControlSurfaces did not make a group per surface" );
__failure++;
}
else
{
for ( int i = 0; i < 2; i++ )
{
// Each wing is symmetric, so its control surface arrives as two
// copies and both land in the group.
if ( GetActiveCSNameVec( i ).size() != 2 )
{
Print( "ERROR: group " + i + " does not hold its control surface copies" );
__failure++;
}
if ( GetVSPAEROControlGroupName( i ).length() == 0 )
{
Print( "ERROR: group " + i + " was not named" );
__failure++;
}
}
}
// The Parms the grouping created have to be findable.
if ( deflection_gain_id.length() == 0 || deflection_angle_id.length() == 0 )
{
Print( "ERROR: the control surface group Parms were not created" );
__failure++;
}
std::string GetVSPAEROControlGroupName(int CSGroupIndex)
void AutoGroupVSPAEROControlSurfaces()
void SetGeomName(const std::string &geom_id, const std::string &name)
std::string FindContainer(const std::string &name, int index)
double SetParmValUpdate(const std::string &parm_id, double val)
void Update(bool update_managers=true)
See also
CreateVSPAEROControlSurfaceGroup

◆ DelCpSlice()

void vsp::DelCpSlice ( int slice_index)
extern

Delete a single Cp slice from the VSPAERO Cp Slicer

string first = AddCpSlice( X_DIR, 0.5 );
string second = AddCpSlice( Y_DIR, 0.25 );
// Only the indexed slice goes, and the rest slide down.
if ( GetNumCpSlices() != 1 || GetCpSliceID( 0 ) != second )
{
Print( "ERROR: DelCpSlice removed the wrong slice" );
__failure++;
}
// An index past the end has to be rejected.
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: DelCpSlice accepted an index past the end" );
__failure++;
}
// That error was raised deliberately, so take it back off the queue.
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
void DeleteAllCpSlices()
void DelCpSlice(int slice_index)
See also
AddCpSlice, DeleteAllCpSlices
Parameters
[in]slice_indexint Cp slice index

◆ DeleteAllCpSlices()

void vsp::DeleteAllCpSlices ( )
extern

Delete all Cp slices from the VSPAERO Cp Slicer

AddCpSlice( X_DIR, 0.5 );
AddCpSlice( Y_DIR, 0.25 );
if ( GetNumCpSlices() != 0 )
{
Print( "ERROR: DeleteAllCpSlices left slices behind" );
__failure++;
}
// Clearing an empty slicer is not an error.
if ( GetNumTotalErrors() != 0 )
{
Print( "ERROR: DeleteAllCpSlices complained about an empty slicer" );
__failure++;
}
See also
AddCpSlice, DelCpSlice, GetNumCpSlices

◆ GetActiveCSNameVec()

std::vector< std::string > vsp::GetActiveCSNameVec ( int CSGroupIndex)
extern

Get the names of each active (used) control surface in the control surface group at the specified index

string wid = AddGeom( "WING", "" ); // Add Wing
string aileron_id = AddSubSurf( wid, SS_CONTROL ); // Add Control Surface Sub-Surface
int group_index = CreateVSPAEROControlSurfaceGroup(); // Empty control surface group
array<string> @cs_name_vec = GetActiveCSNameVec( group_index );
if ( cs_name_vec.length() == 0 )
{
Print( "ERROR: GetActiveCSNameVec returned nothing" );
__failure++;
}
Print( "Active CS in Group Index #", false );
Print( group_index );
for ( int i = 0; i < int( cs_name_vec.size() ); i++ )
{
Print( cs_name_vec[i] );
}
Parameters
[in]CSGroupIndexint Index of the control surface group
Returns
vector <string> Array of active control surface names

◆ GetAvailableCSNameVec()

std::vector< std::string > vsp::GetAvailableCSNameVec ( int CSGroupIndex)
extern

Get the names of each available (not used) control surface in the control surface group at the specified index

string wid = AddGeom( "WING", "" ); // Add Wing
string aileron_id = AddSubSurf( wid, SS_CONTROL ); // Add Control Surface Sub-Surface
int group_index = CreateVSPAEROControlSurfaceGroup(); // Empty control surface group
array<string> @cs_name_vec = GetAvailableCSNameVec( group_index );
if ( cs_name_vec.length() == 0 )
{
Print( "ERROR: GetAvailableCSNameVec returned nothing" );
__failure++;
}
array < int > cs_ind_vec(1);
cs_ind_vec[0] = 1;
AddSelectedToCSGroup( cs_ind_vec, group_index ); // Add the first available control surface to the group
// One surface moved from available to active.
array < string > active_vec = GetActiveCSNameVec( group_index );
if ( active_vec.size() != 1 || active_vec[0] != cs_name_vec[0] )
{
Print( "ERROR: AddSelectedToCSGroup did not add the surface that was named" );
__failure++;
}
if ( GetAvailableCSNameVec( group_index ).size() != cs_name_vec.size() - 1 )
{
Print( "ERROR: the added surface is still available" );
__failure++;
}
Parameters
[in]CSGroupIndexint Index of the control surface group
Returns
vector <string> Array of active control surface names

◆ GetCompleteCSNameVec()

std::vector< std::string > vsp::GetCompleteCSNameVec ( )
extern

Get the names of all control surfaces. Some may be active (used) while others may be available.

string wid = AddGeom( "WING", "" ); // Add Wing
string aileron_id = AddSubSurf( wid, SS_CONTROL ); // Add Control Surface Sub-Surface
int group_index = CreateVSPAEROControlSurfaceGroup(); // Empty control surface group
array<string> @cs_name_vec = GetCompleteCSNameVec();
if ( cs_name_vec.length() == 0 )
{
Print( "ERROR: GetCompleteCSNameVec returned nothing" );
__failure++;
}
Print( "All Control Surfaces: ", false );
for ( int i = 0; i < int( cs_name_vec.size() ); i++ )
{
Print( cs_name_vec[i] );
}
std::vector< std::string > GetCompleteCSNameVec()
Returns
vector <string> Array of all control surface names

◆ GetCpSliceID()

std::string vsp::GetCpSliceID ( int slice_index)
extern

Get the ID of the Cp slice at the specified index

int num_before = GetNumCpSlices();
string first = AddCpSlice( X_DIR, 0.5 );
string second = AddCpSlice( Y_DIR, 0.25 );
// Slices come back in the order they were added.
if ( GetCpSliceID( num_before ) != first || GetCpSliceID( num_before + 1 ) != second )
{
Print( "ERROR: GetCpSliceID did not report the slices in order" );
__failure++;
}
// An index past the end has to be rejected.
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: GetCpSliceID accepted an index past the end" );
__failure++;
}
// That error was raised deliberately, so take it back off the queue.
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
See also
AddCpSlice, GetNumCpSlices
Parameters
[in]slice_indexint Cp slice index
Returns
string Cp slice ID

◆ GetNumControlSurfaceGroups()

int vsp::GetNumControlSurfaceGroups ( )
extern

Get the total number of control surface groups

string wid = AddGeom( "WING", "" ); // Add Wing
string aileron_id = AddSubSurf( wid, SS_CONTROL ); // Add Control Surface Sub-Surface
//==== Add Horizontal tail and set some parameters =====//
string horiz_id = AddGeom( "WING", "" );
SetGeomName( horiz_id, "Vert" );
SetParmValUpdate( horiz_id, "TotalArea", "WingGeom", 10.0 );
SetParmValUpdate( horiz_id, "X_Rel_Location", "XForm", 8.5 );
string elevator_id = AddSubSurf( horiz_id, SS_CONTROL ); // Add Control Surface Sub-Surface
int num_group = GetNumControlSurfaceGroups();
if ( num_group != 2 ) { Print( "Error: GetNumControlSurfaceGroups" ); __failure++; }
Returns
int Number of control surface groups

◆ GetNumCpSlices()

int vsp::GetNumCpSlices ( )
extern

Get the number of Cp slices in the VSPAERO Cp Slicer

int num_before = GetNumCpSlices();
AddCpSlice( X_DIR, 0.5 );
AddCpSlice( Y_DIR, 0.25 );
if ( GetNumCpSlices() != num_before + 2 )
{
Print( "ERROR: GetNumCpSlices did not count both slices" );
__failure++;
}
// Every slice the count claims has to be findable.
for ( int i = 0; i < GetNumCpSlices(); i++ )
{
if ( GetCpSliceID( i ).length() == 0 )
{
Print( "ERROR: slice " + i + " cannot be found" );
__failure++;
}
}
See also
AddCpSlice, GetCpSliceID, DelCpSlice, DeleteAllCpSlices
Returns
int Number of Cp slices

◆ GetVSPAEROControlGroupName()

std::string vsp::GetVSPAEROControlGroupName ( int CSGroupIndex)
extern

Get the name of the control surface group at the specified index

string wid = AddGeom( "WING", "" ); // Add Wing
string aileron_id = AddSubSurf( wid, SS_CONTROL ); // Add Control Surface Sub-Surface
int group_index = CreateVSPAEROControlSurfaceGroup(); // Empty control surface group
SetVSPAEROControlGroupName( "Example_CS_Group", group_index );
Print( "CS Group name: ", false );
Print( GetVSPAEROControlGroupName( group_index ) );
if ( GetVSPAEROControlGroupName( group_index ) != "Example_CS_Group" )
{
Print( "ERROR: the control surface group name did not take" );
__failure++;
}
// A group index past the end has to be rejected, and name nothing.
{
Print( "ERROR: an index past the end named a group" );
__failure++;
}
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: an index past the end was accepted" );
__failure++;
}
// That error was raised deliberately, so take it back off the queue.
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
Parameters
[in]CSGroupIndexint Index of the control surface group

◆ RemoveAllFromVSPAEROControlSurfaceGroup()

void vsp::RemoveAllFromVSPAEROControlSurfaceGroup ( int CSGroupIndex)
extern

Remove all used control surfaces from the control surface group at the specified index

string wid = AddGeom( "WING", "" ); // Add Wing
string aileron_id = AddSubSurf( wid, SS_CONTROL ); // Add Control Surface Sub-Surface
int group_index = CreateVSPAEROControlSurfaceGroup(); // Empty control surface group
int num_active = int( GetActiveCSNameVec( group_index ).size() );
if ( num_active < 1 )
{
Print( "ERROR: nothing was added to the group to remove" );
__failure++;
}
RemoveAllFromVSPAEROControlSurfaceGroup( group_index ); // Empty control surface group
// Everything that was active goes back to being available.
if ( GetActiveCSNameVec( group_index ).size() != 0 )
{
Print( "ERROR: RemoveAllFromVSPAEROControlSurfaceGroup left surfaces in the group" );
__failure++;
}
if ( int( GetAvailableCSNameVec( group_index ).size() ) != num_active )
{
Print( "ERROR: the removed surfaces did not become available again" );
__failure++;
}
void RemoveAllFromVSPAEROControlSurfaceGroup(int CSGroupIndex)
Parameters
[in]CSGroupIndexint Index of the control surface group

◆ RemoveSelectedFromCSGroup()

void vsp::RemoveSelectedFromCSGroup ( const std::vector< int > & selected,
int CSGroupIndex )
extern

Remove each control surfaces in the array of control surface indexes from the control surface group at the specified index.

Warning
The indexes in input "selected" must be matched with active control surfaces identified by GetActiveCSNameVec. The "selected" input uses one-based indexing to associate available control surfaces.
string wid = AddGeom( "WING", "" ); // Add Wing
string aileron_id = AddSubSurf( wid, SS_CONTROL ); // Add Control Surface Sub-Surface
int group_index = CreateVSPAEROControlSurfaceGroup(); // Empty control surface group
array < string > cs_name_vec = GetAvailableCSNameVec( group_index );
array < int > cs_ind_vec( cs_name_vec.size() );
for ( int i = 0; i < int( cs_name_vec.size() ); i++ )
{
cs_ind_vec[i] = i + 1;
}
AddSelectedToCSGroup( cs_ind_vec, group_index ); // Add the available control surfaces to the group
array < int > remove_cs_ind_vec( 1 );
remove_cs_ind_vec[0] = 1;
int num_active = int( GetActiveCSNameVec( group_index ).size() );
if ( num_active != int( cs_name_vec.size() ) )
{
Print( "ERROR: not everything was added to the group" );
__failure++;
}
RemoveSelectedFromCSGroup( remove_cs_ind_vec, group_index ); // Remove the first control surface
// One surface moved back from active to available.
if ( int( GetActiveCSNameVec( group_index ).size() ) != num_active - 1 )
{
Print( "ERROR: RemoveSelectedFromCSGroup did not remove a surface" );
__failure++;
}
if ( GetAvailableCSNameVec( group_index ).size() != 1 )
{
Print( "ERROR: the removed surface did not become available again" );
__failure++;
}
void RemoveSelectedFromCSGroup(const std::vector< int > &selected, int CSGroupIndex)
See also
GetActiveCSNameVec
Parameters
[in]selectedvector <int> Array of control surface indexes to remove from the group. Note, the integer values are one based.
[in]CSGroupIndexint Index of the control surface group

◆ SetVSPAEROControlGroupName()

void vsp::SetVSPAEROControlGroupName ( const std::string & name,
int CSGroupIndex )
extern

Set the name for the control surface group at the specified index

string wid = AddGeom( "WING", "" ); // Add Wing
string aileron_id = AddSubSurf( wid, SS_CONTROL ); // Add Control Surface Sub-Surface
int group_index = CreateVSPAEROControlSurfaceGroup(); // Empty control surface group
SetVSPAEROControlGroupName( "Example_CS_Group", group_index );
if ( GetVSPAEROControlGroupName( group_index ) != "Example_CS_Group" )
{
Print( "ERROR: SetVSPAEROControlGroupName did not take" );
__failure++;
}
Print( "CS Group name: ", false );
Print( GetVSPAEROControlGroupName( group_index ) );
if ( GetVSPAEROControlGroupName( group_index ) != "Example_CS_Group" )
{
Print( "ERROR: the control surface group name did not take" );
__failure++;
}
// A group index past the end has to be rejected, and name nothing.
{
Print( "ERROR: an index past the end named a group" );
__failure++;
}
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: an index past the end was accepted" );
__failure++;
}
// That error was raised deliberately, so take it back off the queue.
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
Parameters
[in]namestring Name to set for the control surface group
[in]CSGroupIndexint Index of the control surface group