OpenVSP API Documentation  3.38.0
Functions
Parm Functions

Every Parm in OpenVSP can be accessed and modified through the functions defined in this API group. Every Parm has an associated ParmContainer. Click here to return to the main page. More...

Functions

std::string vsp::GetParm (const std::string &geom_id, const std::string &name, const std::string &group)
 
bool vsp::ValidParm (const std::string &id)
 
double vsp::SetParmVal (const std::string &parm_id, double val)
 
double vsp::SetParmVal (const std::string &geom_id, const std::string &name, const std::string &group, double val)
 
double vsp::SetParmValLimits (const std::string &parm_id, double val, double lower_limit, double upper_limit)
 
double vsp::SetParmValUpdate (const std::string &parm_id, double val)
 
double vsp::SetParmValUpdate (const std::string &geom_id, const std::string &parm_name, const std::string &parm_group_name, double val)
 
double vsp::GetParmVal (const std::string &parm_id)
 
double vsp::GetParmVal (const std::string &geom_id, const std::string &name, const std::string &group)
 
int vsp::GetIntParmVal (const std::string &parm_id)
 
bool vsp::GetBoolParmVal (const std::string &parm_id)
 
void vsp::SetParmUpperLimit (const std::string &parm_id, double val)
 
double vsp::GetParmUpperLimit (const std::string &parm_id)
 
void vsp::SetParmLowerLimit (const std::string &parm_id, double val)
 
double vsp::GetParmLowerLimit (const std::string &parm_id)
 
int vsp::GetParmType (const std::string &parm_id)
 
std::string vsp::GetParmName (const std::string &parm_id)
 
std::string vsp::GetParmGroupName (const std::string &parm_id)
 
std::string vsp::GetParmDisplayGroupName (const std::string &parm_id)
 
std::string vsp::GetParmContainer (const std::string &parm_id)
 
void vsp::SetParmDescript (const std::string &parm_id, const std::string &desc)
 
std::string vsp::GetParmDescript (const std::string &parm_id)
 
std::string vsp::FindParm (const std::string &parm_container_id, const std::string &parm_name, const std::string &group_name)
 

Detailed Description

Function Documentation

◆ FindParm()

std::string vsp::FindParm ( const std::string &  parm_container_id,
const std::string &  parm_name,
const std::string &  group_name 
)

Find a Parm ID given the Parm Container ID, Parm name, and Parm group

//==== Add Wing Geometry ====//
string wing_id = AddGeom( "WING" );
//==== Turn Symmetry OFF ====//
string sym_id = FindParm( wing_id, "Sym_Planar_Flag", "Sym");
SetParmVal( sym_id, 0.0 ); // Note: bool input not supported in SetParmVal
std::string AddGeom(const std::string &type, const std::string &parent=std::string())
std::string FindParm(const std::string &parm_container_id, const std::string &parm_name, const std::string &group_name)
double SetParmVal(const std::string &parm_id, double val)
Parameters
[in]parm_container_idParm Container ID
[in]parm_nameParm name
[in]group_nameParm group name
Returns
Parm ID

◆ GetBoolParmVal()

bool vsp::GetBoolParmVal ( const std::string &  parm_id)

Get the value of the specified bool type Parm

//==== Add Prop Geometry ====//
string prop_id = AddGeom( "PROP" );
string rev_flag_id = GetParm( prop_id, "ReverseFlag", "Design" );
bool reverse_flag = GetBoolParmVal( rev_flag_id );
std::string GetParm(const std::string &geom_id, const std::string &name, const std::string &group)
bool GetBoolParmVal(const std::string &parm_id)
Parameters
[in]parm_idstring Parm ID
Returns
bool Parm value

◆ GetIntParmVal()

int vsp::GetIntParmVal ( const std::string &  parm_id)

Get the value of the specified int type Parm

//==== Add Prop Geometry ====//
string prop_id = AddGeom( "PROP" );
string num_blade_id = GetParm( prop_id, "NumBlade", "Design" );
int num_blade = GetIntParmVal( num_blade_id );
int GetIntParmVal(const std::string &parm_id)
Parameters
[in]parm_idstring Parm ID
Returns
double Parm value

◆ GetParm()

std::string vsp::GetParm ( const std::string &  geom_id,
const std::string &  name,
const std::string &  group 
)

Get Parm ID

//==== Add Pod Geometry ====//
string pid = AddGeom( "POD" );
string lenid = GetParm( pid, "Length", "Design" );
if ( !ValidParm( lenid ) ) { Print( "---> Error: API GetParm " ); }
bool ValidParm(const std::string &id)
Parameters
[in]geom_idstring Geom ID
[in]namestring Parm name
[in]groupstring Parm group name
Returns
string Parm ID

◆ GetParmContainer()

std::string vsp::GetParmContainer ( const std::string &  parm_id)

Get Parm Container ID for the specified Parm

// Add Fuselage Geom
string fuseid = AddGeom( "FUSELAGE", "" );
string xsec_surf = GetXSecSurf( fuseid, 0 );
ChangeXSecShape( xsec_surf, GetNumXSec( xsec_surf ) - 1, XS_ROUNDED_RECTANGLE );
string xsec = GetXSec( xsec_surf, GetNumXSec( xsec_surf ) - 1 );
string wid = GetXSecParm( xsec, "RoundedRect_Width" );
string cid = GetParmContainer( wid );
if ( cid.size() == 0 ) { Print( "---> Error: API GetParmContainer " ); }
@ XS_ROUNDED_RECTANGLE
Definition: APIDefines.h:1383
std::string GetParmContainer(const std::string &parm_id)
std::string GetXSecParm(const std::string &xsec_id, const std::string &name)
std::string GetXSecSurf(const std::string &geom_id, int index)
std::string GetXSec(const std::string &xsec_surf_id, int xsec_index)
int GetNumXSec(const std::string &xsec_surf_id)
void ChangeXSecShape(const std::string &xsec_surf_id, int xsec_index, int type)
Parameters
[in]parm_idstring Parm ID
Returns
Parm Container ID

◆ GetParmDescript()

std::string vsp::GetParmDescript ( const std::string &  parm_id)

Get the description of the specified Parm

string pod_id = AddGeom( "POD" );
string length = FindParm( pod_id, "Length", "Design" );
SetParmValLimits( length, 10.0, 0.001, 1.0e12 );
string desc = GetParmDescript( length );
Print( desc );
std::string GetParmDescript(const std::string &parm_id)
double SetParmValLimits(const std::string &parm_id, double val, double lower_limit, double upper_limit)
Parameters
[in]parm_idstring Parm ID
Returns
desc Parm description

◆ GetParmDisplayGroupName()

std::string vsp::GetParmDisplayGroupName ( const std::string &  parm_id)

Get the display group name for the specified Parm

string veh_id = FindContainer( "Vehicle", 0 );
//==== Get and List All Parms in the Container ====//
array<string> parm_ids = FindContainerParmIDs( veh_id );
Print( "Parm Group Display Names and IDs in Vehicle Parm Container: " );
for ( uint i = 0; i < uint(parm_ids.length()); i++ )
{
string group_str = GetParmDisplayGroupName( parm_ids[i] ) + string(": ") + parm_ids[i] + string("\n");
Print( group_str );
}
std::vector< std::string > FindContainerParmIDs(const std::string &parm_container_id)
std::string FindContainer(const std::string &name, int index)
std::string GetParmDisplayGroupName(const std::string &parm_id)
Parameters
[in]parm_idstring Parm ID
Returns
Parm display group name

◆ GetParmGroupName()

std::string vsp::GetParmGroupName ( const std::string &  parm_id)

Get the group name for the specified Parm

string veh_id = FindContainer( "Vehicle", 0 );
//==== Get and List All Parms in the Container ====//
array<string> parm_ids = FindContainerParmIDs( veh_id );
Print( "Parm Groups and IDs in Vehicle Parm Container: " );
for ( uint i = 0; i < uint(parm_ids.length()); i++ )
{
string group_str = GetParmGroupName( parm_ids[i] ) + string(": ") + parm_ids[i] + string("\n");
Print( group_str );
}
std::string GetParmGroupName(const std::string &parm_id)
Parameters
[in]parm_idstring Parm ID
Returns
Parm group name

◆ GetParmLowerLimit()

double vsp::GetParmLowerLimit ( const std::string &  parm_id)

Get the lower limit value for the specified Parm

//==== Add Prop Geometry ====//
string prop_id = AddGeom( "PROP" );
string num_blade_id = GetParm( prop_id, "NumBlade", "Design" );
double min_blade = GetParmLowerLimit( num_blade_id );
double GetParmLowerLimit(const std::string &parm_id)
Parameters
[in]parm_idstring Parm ID
Returns
Parm lower limit

◆ GetParmName()

std::string vsp::GetParmName ( const std::string &  parm_id)

Get the name for the specified Parm

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
//==== Add FeaStructure to Pod ====//
int struct_ind = AddFeaStruct( pod_id );
//==== Get Structure Name and Parm Container ID ====//
string parm_container_name = GetFeaStructName( pod_id, struct_ind );
string parm_container_id = FindContainer( parm_container_name, struct_ind );
//==== Get and List All Parms in the Container ====//
array<string> parm_ids = FindContainerParmIDs( parm_container_id );
for ( uint i = 0; i < uint(parm_ids.length()); i++ )
{
string name_id = GetParmName( parm_ids[i] ) + string(": ") + parm_ids[i] + string("\n");
Print( name_id );
}
std::string GetFeaStructName(const std::string &geom_id, int fea_struct_ind)
int AddFeaStruct(const std::string &geom_id, bool init_skin=true, int surfindex=0)
std::string GetParmName(const std::string &parm_id)
Parameters
[in]parm_idstring Parm ID
Returns
Parm name

◆ GetParmType()

int vsp::GetParmType ( const std::string &  parm_id)

Get the data type for the specified Parm

// Add Fuselage Geom
string fuseid = AddGeom( "FUSELAGE", "" );
string xsec_surf = GetXSecSurf( fuseid, 0 );
ChangeXSecShape( xsec_surf, GetNumXSec( xsec_surf ) - 1, XS_ROUNDED_RECTANGLE );
string xsec = GetXSec( xsec_surf, GetNumXSec( xsec_surf ) - 1 );
string wid = GetXSecParm( xsec, "RoundedRect_Width" );
if ( GetParmType( wid ) != PARM_DOUBLE_TYPE ) { Print( "---> Error: API GetParmType " ); }
@ PARM_DOUBLE_TYPE
Definition: APIDefines.h:926
int GetParmType(const std::string &parm_id)
See also
PARM_TYPE
Parameters
[in]parm_idstring Parm ID
Returns
Parm data type enum (i.e. PARM_BOOL_TYPE)

◆ GetParmUpperLimit()

double vsp::GetParmUpperLimit ( const std::string &  parm_id)

Get the upper limit value for the specified Parm

//==== Add Prop Geometry ====//
string prop_id = AddGeom( "PROP" );
string num_blade_id = GetParm( prop_id, "NumBlade", "Design" );
double max_blade = GetParmUpperLimit( num_blade_id );
double GetParmUpperLimit(const std::string &parm_id)
Parameters
[in]parm_idstring Parm ID
Returns
double Parm upper limit

◆ GetParmVal() [1/2]

double vsp::GetParmVal ( const std::string &  geom_id,
const std::string &  name,
const std::string &  group 
)

Get the value of the specified Parm. The data type of the Parm value will be cast to a double

// Add Fuselage Geom
string fuseid = AddGeom( "FUSELAGE", "" );
string xsec_surf = GetXSecSurf( fuseid, 0 );
ChangeXSecShape( xsec_surf, GetNumXSec( xsec_surf ) - 1, XS_ROUNDED_RECTANGLE );
string xsec = GetXSec( xsec_surf, GetNumXSec( xsec_surf ) - 1 );
string wid = GetXSecParm( xsec, "RoundedRect_Width" );
SetParmVal( wid, 23.0 );
if ( abs( GetParmVal( wid ) - 23 ) > 1e-6 ) { Print( "---> Error: API Parm Val Set/Get " ); }
double GetParmVal(const std::string &parm_id)
Parameters
[in]geom_idstring Geom ID
[in]namestring Parm name
[in]groupstring Parm group name
Returns
double Parm value

◆ GetParmVal() [2/2]

double vsp::GetParmVal ( const std::string &  parm_id)

Get the value of the specified Parm. The data type of the Parm value will be cast to a double

// Add Fuselage Geom
string fuseid = AddGeom( "FUSELAGE", "" );
string xsec_surf = GetXSecSurf( fuseid, 0 );
ChangeXSecShape( xsec_surf, GetNumXSec( xsec_surf ) - 1, XS_ROUNDED_RECTANGLE );
string xsec = GetXSec( xsec_surf, GetNumXSec( xsec_surf ) - 1 );
string wid = GetXSecParm( xsec, "RoundedRect_Width" );
SetParmVal( wid, 23.0 );
if ( abs( GetParmVal( wid ) - 23 ) > 1e-6 ) { Print( "---> Error: API Parm Val Set/Get " ); }
Parameters
[in]parm_idstring Parm ID
Returns
Parm value

◆ SetParmDescript()

void vsp::SetParmDescript ( const std::string &  parm_id,
const std::string &  desc 
)

Set the description of the specified Parm

string pod_id = AddGeom( "POD" );
string length = FindParm( pod_id, "Length", "Design" );
SetParmValLimits( length, 10.0, 0.001, 1.0e12 );
SetParmDescript( length, "Total Length of Geom" );
void SetParmDescript(const std::string &parm_id, const std::string &desc)
Parameters
[in]parm_idstring Parm ID
[in]descParm description

◆ SetParmLowerLimit()

void vsp::SetParmLowerLimit ( const std::string &  parm_id,
double  val 
)

Set the lower limit value for the specified Parm

// Add Fuselage Geom
string fuseid = AddGeom( "FUSELAGE", "" );
string xsec_surf = GetXSecSurf( fuseid, 0 );
ChangeXSecShape( xsec_surf, GetNumXSec( xsec_surf ) - 1, XS_ROUNDED_RECTANGLE );
string xsec = GetXSec( xsec_surf, GetNumXSec( xsec_surf ) - 1 );
string wid = GetXSecParm( xsec, "RoundedRect_Width" );
SetParmVal( wid, 13.0 );
SetParmLowerLimit( wid, 15.0 );
if ( abs( GetParmVal( wid ) - 15 ) > 1e-6 ) { Print( "---> Error: API SetParmLowerLimit " ); }
void SetParmLowerLimit(const std::string &parm_id, double val)
See also
SetParmValLimits
Parameters
[in]parm_idstring Parm ID
[in]valParm lower limit

◆ SetParmUpperLimit()

void vsp::SetParmUpperLimit ( const std::string &  parm_id,
double  val 
)

Set the upper limit value for the specified Parm

// Add Fuselage Geom
string fuseid = AddGeom( "FUSELAGE", "" );
string xsec_surf = GetXSecSurf( fuseid, 0 );
ChangeXSecShape( xsec_surf, GetNumXSec( xsec_surf ) - 1, XS_ROUNDED_RECTANGLE );
string xsec = GetXSec( xsec_surf, GetNumXSec( xsec_surf ) - 1 );
string wid = GetXSecParm( xsec, "RoundedRect_Width" );
SetParmVal( wid, 23.0 );
SetParmUpperLimit( wid, 13.0 );
if ( abs( GetParmVal( wid ) - 13 ) > 1e-6 ) { Print( "---> Error: API SetParmUpperLimit " ); }
void SetParmUpperLimit(const std::string &parm_id, double val)
See also
SetParmValLimits
Parameters
[in]parm_idstring Parm ID
[in]valdouble Parm upper limit

◆ SetParmVal() [1/2]

double vsp::SetParmVal ( const std::string &  geom_id,
const std::string &  name,
const std::string &  group,
double  val 
)

Set the value of the specified Parm.

// Add Fuselage Geom
string fuseid = AddGeom( "FUSELAGE", "" );
string xsec_surf = GetXSecSurf( fuseid, 0 );
ChangeXSecShape( xsec_surf, GetNumXSec( xsec_surf ) - 1, XS_ROUNDED_RECTANGLE );
string xsec = GetXSec( xsec_surf, GetNumXSec( xsec_surf ) - 1 );
string wid = GetXSecParm( xsec, "RoundedRect_Width" );
SetParmVal( wid, 23.0 );
if ( abs( GetParmVal( wid ) - 23 ) > 1e-6 ) { Print( "---> Error: API Parm Val Set/Get " ); }
See also
SetParmValUpdate
Parameters
[in]geom_idstring Geom ID
[in]namestring Parm name
[in]groupstring Parm group name
[in]valdouble Parm value to set
Returns
double Value that the Parm was set to

◆ SetParmVal() [2/2]

double vsp::SetParmVal ( const std::string &  parm_id,
double  val 
)

Set the value of the specified Parm.

// Add Fuselage Geom
string fuseid = AddGeom( "FUSELAGE", "" );
string xsec_surf = GetXSecSurf( fuseid, 0 );
ChangeXSecShape( xsec_surf, GetNumXSec( xsec_surf ) - 1, XS_ROUNDED_RECTANGLE );
string xsec = GetXSec( xsec_surf, GetNumXSec( xsec_surf ) - 1 );
string wid = GetXSecParm( xsec, "RoundedRect_Width" );
SetParmVal( wid, 23.0 );
if ( abs( GetParmVal( wid ) - 23 ) > 1e-6 ) { Print( "---> Error: API Parm Val Set/Get " ); }
See also
SetParmValUpdate
Parameters
[in]parm_idstring Parm ID
[in]valParm value to set
Returns
Value that the Parm was set to

◆ SetParmValLimits()

double vsp::SetParmValLimits ( const std::string &  parm_id,
double  val,
double  lower_limit,
double  upper_limit 
)

Set the value along with the upper and lower limits of the specified Parm

string pod_id = AddGeom( "POD" );
string length = FindParm( pod_id, "Length", "Design" );
SetParmValLimits( length, 10.0, 0.001, 1.0e12 );
SetParmDescript( length, "Total Length of Geom" );
See also
SetParmLowerLimit, SetParmUpperLimit
Parameters
[in]parm_idstring Parm ID
[in]valParm value to set
[in]lower_limitParm lower limit
[in]upper_limitParm upper limit
Returns
Value that the Parm was set to

◆ SetParmValUpdate() [1/2]

double vsp::SetParmValUpdate ( const std::string &  geom_id,
const std::string &  parm_name,
const std::string &  parm_group_name,
double  val 
)

Set the value of the specified Parm and force an Update.

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
string parm_id = GetParm( pod_id, "X_Rel_Location", "XForm" );
SetParmValUpdate( parm_id, 5.0 );
double SetParmValUpdate(const std::string &parm_id, double val)
See also
SetParmVal
Parameters
[in]geom_idstring Geom ID
[in]parm_namestring Parm name
[in]parm_group_namestring Parm group name
[in]valdouble Parm value to set
Returns
double Value that the Parm was set to

◆ SetParmValUpdate() [2/2]

double vsp::SetParmValUpdate ( const std::string &  parm_id,
double  val 
)

Set the value of the specified Parm and force an Update.

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
string parm_id = GetParm( pod_id, "X_Rel_Location", "XForm" );
SetParmValUpdate( parm_id, 5.0 );
See also
SetParmVal
Parameters
[in]parm_idstring Parm ID
[in]valParm value to set
Returns
Value that the Parm was set to

◆ ValidParm()

bool vsp::ValidParm ( const std::string &  id)

Check if given Parm is valid

//==== Add Pod Geometry ====//
string pid = AddGeom( "POD" );
string lenid = GetParm( pid, "Length", "Design" );
if ( !ValidParm( lenid ) ) { Print( "---> Error: API GetParm " ); }
Parameters
[in]idParm ID
Returns
True if Parm ID is valid, false otherwise