OpenVSP API Documentation 3.41.2
 
Loading...
Searching...
No Matches
Functions for Sets

The following group of API functions deals with set manipulation. Click here to return to the main page. More...

Functions

int vsp::GetNumSets ()
 
void vsp::SetSetName (int index, const std::string &name)
 
std::string vsp::GetSetName (int index)
 
std::vector< std::string > vsp::GetGeomSetAtIndex (int index)
 
std::vector< std::string > vsp::GetGeomSet (const std::string &name)
 
int vsp::GetSetIndex (const std::string &name)
 
bool vsp::GetSetFlag (const std::string &geom_id, int set_index)
 
void vsp::SetSetFlag (const std::string &geom_id, int set_index, bool flag)
 
void vsp::CopyPasteSet (int copyIndex, int pasteIndex)
 

Detailed Description

Function Documentation

◆ CopyPasteSet()

void vsp::CopyPasteSet ( int copyIndex,
int pasteIndex )
extern

Copies all the states of a geom set and pastes them into a specific set based on passed in indexs

// Add Fuselage Geom
string fuseid = AddGeom( "FUSELAGE", "" );
//set fuseid's state for set 3 to true
SetSetFlag( fuseid, 3, true );
//Copy set 3 and Paste into set 4
CopyPasteSet( 3, 4 );
//get fuseid's state for set 4
bool flag_value = GetSetFlag( fuseid, 4 );
if ( flag_value != true) { Print( "---> Error: API CopyPasteSet " ); }
std::string AddGeom(const std::string &type, const std::string &parent=std::string())
void CopyPasteSet(int copyIndex, int pasteIndex)
bool GetSetFlag(const std::string &geom_id, int set_index)
void SetSetFlag(const std::string &geom_id, int set_index, bool flag)
Parameters
[in]copyIndexCopy Index
[in]pasteIndexPaste Index

◆ GetGeomSet()

std::vector< std::string > vsp::GetGeomSet ( const std::string & name)
extern

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 " ); }
void SetSetName(int index, const std::string &name)
std::vector< std::string > GetGeomSet(const std::string &name)
std::vector< std::string > GetGeomSetAtIndex(int index)
Parameters
[in]nameconst string set name
Returns
array<string> array of Geom IDs

◆ GetGeomSetAtIndex()

std::vector< std::string > vsp::GetGeomSetAtIndex ( int index)
extern

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 vsp::GetNumSets ( )
extern

Get the total number of defined sets. Named sets are used to group components 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 " ); }
int GetNumSets()
Returns
Number of sets

◆ GetSetFlag()

bool vsp::GetSetFlag ( const std::string & geom_id,
int set_index )
extern

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_idstring Geom ID
[in]set_indexSet index
Returns
True if geom is in the set, false otherwise

◆ GetSetIndex()

int vsp::GetSetIndex ( const std::string & name)
extern

Get the set index for the specified set name

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

◆ GetSetName()

std::string vsp::GetSetName ( int index)
extern

Get the name of a set at specified index

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

◆ SetSetFlag()

void vsp::SetSetFlag ( const std::string & geom_id,
int set_index,
bool flag )
extern

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_idstring Geom ID
[in]set_indexSet index
[in]flagFlag that indicates set membership

◆ SetSetName()

void vsp::SetSetName ( int index,
const std::string & name )
extern

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