OpenVSPAPI  3.20.0
Functions
Functions for Sets

The following group of API functions deals with set manipulation.

Click here to return to the main page. More...

Functions

int GetNumSets ()
 
void SetSetName (int index, const string &in name)
 
string GetSetName (int index)
 
string[] GetGeomSetAtIndex (int index)
 
string[] GetGeomSet (const string &in name)
 
int GetSetIndex (const string &in name)
 
bool GetSetFlag (const string &in geom_id, int set_index)
 
void SetSetFlag (const string &in geom_id, int set_index, bool flag)
 

Detailed Description

Function Documentation

◆ GetGeomSet()

string [] GetGeomSet ( const string &in  name)

Get an array of Geom IDs for the specified set name

SetSetName( 3, "SetFromScript" );
array<string> @geom_arr1 = GetGeomSetAtIndex( 3 );
array<string> @geom_arr2 = GetGeomSet( "SetFromScript" );
if ( geom_arr1.size() != geom_arr2.size() ) { Print( "---> Error: API GetGeomSet " ); }
Parameters
[in]nameconst string set name
Returns
array<string> array of Geom IDs

◆ GetGeomSetAtIndex()

string [] GetGeomSetAtIndex ( int  index)

Get an array of Geom IDs for the specified set index

SetSetName( 3, "SetFromScript" );
array<string> @geom_arr1 = GetGeomSetAtIndex( 3 );
array<string> @geom_arr2 = GetGeomSet( "SetFromScript" );
if ( geom_arr1.size() != geom_arr2.size() ) { Print( "---> Error: API GetGeomSet " ); }
See also
SET_TYPE
Parameters
[in]indexSet index
Returns
Array of Geom IDs

◆ GetNumSets()

int GetNumSets ( )

Get the total number of defined sets. Named sets are used to group compenents and read/write on them. The number of named sets will be 10 for OpenVSP versions up to 3.17.1 and 20 for later versions.

if ( GetNumSets() <= 0 ) { Print( "---> Error: API GetNumSets " ); }
Returns
Number of sets

◆ GetSetFlag()

bool GetSetFlag ( const string &in  geom_id,
int  set_index 
)

Check if a Geom is in the set at the specified set index

// Add Fuselage Geom
string fuseid = AddGeom( "FUSELAGE", "" );
SetSetFlag( fuseid, 3, true );
if ( !GetSetFlag( fuseid, 3 ) ) { Print( "---> Error: API Set/Get Set Flag " ); }
Parameters
[in]geom_idGeom ID
[in]set_indexSet index
Returns
True if geom is in the set, false otherwise

◆ GetSetIndex()

int GetSetIndex ( const string &in  name)

Get the set index for the specified set name

SetSetName( 3, "SetFromScript" );
if ( GetSetIndex( "SetFromScript" ) != 3 ) { Print( "ERROR: GetSetIndex" ); }
Parameters
[in]nameSet name
Returns
Set index

◆ GetSetName()

string GetSetName ( int  index)

Get the name of a set at specified index

SetSetName( 3, "SetFromScript" );
if ( GetSetName( 3 ) != "SetFromScript" ) { Print( "---> Error: API Get/Set Set Name " ); }
See also
SET_TYPE
Parameters
[in]indexSet index
Returns
Set name

◆ SetSetFlag()

void SetSetFlag ( const string &in  geom_id,
int  set_index,
bool  flag 
)

Set whether or not a Geom is a member of the set at specified set index

// Add Fuselage Geom
string fuseid = AddGeom( "FUSELAGE", "" );
SetSetFlag( fuseid, 3, true );
if ( !GetSetFlag( fuseid, 3 ) ) { Print( "---> Error: API Set/Get Set Flag " ); }
Parameters
[in]geom_idGeom ID
[in]set_indexSet index
[in]flagFlag that indicates set membership

◆ SetSetName()

void SetSetName ( int  index,
const string &in  name 
)

Set the name of a set at specified index

SetSetName( 3, "SetFromScript" );
if ( GetSetName( 3 ) != "SetFromScript" ) { Print( "---> Error: API Get/Set Set Name " ); }
See also
SET_TYPE
Parameters
[in]indexSet index
[in]nameSet name
GetGeomSetAtIndex
string[] GetGeomSetAtIndex(int index)
GetSetIndex
int GetSetIndex(const string &in name)
GetNumSets
int GetNumSets()
GetSetFlag
bool GetSetFlag(const string &in geom_id, int set_index)
SetSetName
void SetSetName(int index, const string &in name)
SetSetFlag
void SetSetFlag(const string &in geom_id, int set_index, bool flag)
GetSetName
string GetSetName(int index)
array
AngelScript ScriptExtension for representing the C++ std::vector.
Definition: openvsp_as.h:244
AddGeom
string AddGeom(const string &in type, const string &in parent=string())
Print
void Print(const string &in data, bool new_line=true)
GetGeomSet
string[] GetGeomSet(const string &in name)