OpenVSPAPI  3.20.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

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

Detailed Description

Function Documentation

◆ FindParm()

string FindParm ( const string &in  parm_container_id,
const string &in  parm_name,
const string &in  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
Parameters
[in]parm_container_idParm Container ID
[in]parm_nameParm name
[in]group_nameParm group name
Returns
Parm ID

◆ GetBoolParmVal()

bool GetBoolParmVal ( const string &in  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 );
Parameters
[in]parm_idParm ID
Returns
Parm value

◆ GetIntParmVal()

int GetIntParmVal ( const string &in  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 );
Parameters
[in]parm_idParm ID
Returns
Parm value

◆ GetParm()

string GetParm ( const string &in  geom_id,
const string &in  name,
const string &in  group 
)

Get Parm ID

//==== Add Pod Geometry ====//
string pid = AddGeom( "POD" );
string lenid = GetParm( pid, "Length", "Design" );
if ( !ValidParm( lenid ) ) { Print( "---> Error: API GetParm " ); }
Parameters
[in]geom_idGeom ID
[in]nameParm name
[in]groupParm group name
Returns
Array of Parm ID

◆ GetParmContainer()

string GetParmContainer ( const string &in  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 wid = GetXSecParm( xsec, "RoundedRect_Width" );
string cid = GetParmContainer( wid );
if ( cid.size() == 0 ) { Print( "---> Error: API GetParmContainer " ); }
Parameters
[in]parm_idParm ID
Returns
Parm Container ID

◆ GetParmDisplayGroupName()

string GetParmDisplayGroupName ( const string &in  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( name_id );
}
Parameters
[in]parm_idParm ID
Returns
Parm display group name

◆ GetParmGroupName()

string GetParmGroupName ( const string &in  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( name_id );
}
Parameters
[in]parm_idParm ID
Returns
Parm group name

◆ GetParmLowerLimit()

double GetParmLowerLimit ( const string &in  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 );
Parameters
[in]parm_idParm ID
Returns
Parm lower limit

◆ GetParmName()

string GetParmName ( const string &in  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 );
}
Parameters
[in]parm_idParm ID
Returns
Parm name

◆ GetParmType()

int GetParmType ( const string &in  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 wid = GetXSecParm( xsec, "RoundedRect_Width" );
if ( GetParmType( wid ) != PARM_DOUBLE_TYPE ) { Print( "---> Error: API GetParmType " ); }
See also
PARM_TYPE
Parameters
[in]parm_idParm ID
Returns
Parm data type enum (i.e. PARM_BOOL_TYPE)

◆ GetParmUpperLimit()

double GetParmUpperLimit ( const string &in  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 );
Parameters
[in]parm_idParm ID
Returns
Parm upper limit

◆ GetParmVal() [1/2]

double GetParmVal ( const string &in  geom_id,
const string &in  name,
const string &in  group 
)

Get the value of the specified double type Parm. This function includes a call to GetParm to identify the Parm ID given the Geom ID, Parm name, and Parm group. The data type of the Parm value will be cast to a double.

//==== Add Pod Geometry ====//
string pod_id = AddGeom( "POD" );
double length = GetParmVal( pod_id, "Length", "Design" );
Parameters
[in]geom_idGeom ID
[in]nameParm name
[in]groupParm group name
Returns
Parm value

◆ GetParmVal() [2/2]

double GetParmVal ( const string &in  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 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_idParm ID
Returns
Parm value

◆ SetParmDescript()

void SetParmDescript ( const string &in  parm_id,
const string &in  desc 
)

Set the description of the specified Parm

string length = AddParm( PARM_DOUBLE_TYPE, "Length", "Design" );
SetParmValLimits( length, 10.0, 0.001, 1.0e12 );
SetParmDescript( length, "Total Length of Custom Geom" );
Parameters
[in]parm_idParm ID
[in]descParm description

◆ SetParmLowerLimit()

void SetParmLowerLimit ( const string &in  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 wid = GetXSecParm( xsec, "RoundedRect_Width" );
SetParmVal( wid, 13.0 );
SetParmLowerLimit( wid, 15.0 );
if ( abs( GetParmVal( wid ) - 15 ) > 1e-6 ) { Print( "---> Error: API SetParmLowerLimit " ); }
See also
SetParmValLimits
Parameters
[in]parm_idParm ID
[in]valParm lower limit

◆ SetParmUpperLimit()

void SetParmUpperLimit ( const string &in  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 wid = GetXSecParm( xsec, "RoundedRect_Width" );
SetParmVal( wid, 23.0 );
SetParmUpperLimit( wid, 13.0 );
if ( abs( GetParmVal( wid ) - 13 ) > 1e-6 ) { Print( "---> Error: API SetParmUpperLimit " ); }
See also
SetParmValLimits
Parameters
[in]parm_idParm ID
[in]valParm upper limit

◆ SetParmVal() [1/2]

double SetParmVal ( const string &in  geom_id,
const string &in  name,
const string &in  group,
double  val 
)

Set the value of the specified Parm. This function includes a call to GetParm to identify the Parm ID given the Geom ID, Parm name, and Parm group.

string wing_id = AddGeom( "WING" );
SetParmVal( wing_id, "ThickChord", "XSecCurve_0", 0.2 );
See also
SetParmValUpdate
Parameters
[in]geom_idGeom ID
[in]nameParm name
[in]groupParm group name
[in]valParm value to set
Returns
Value that the Parm was set to

◆ SetParmVal() [2/2]

double SetParmVal ( const string &in  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 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_idParm ID
[in]valParm value to set
Returns
Value that the Parm was set to

◆ SetParmValLimits()

double SetParmValLimits ( const string &in  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 length = AddParm( PARM_DOUBLE_TYPE, "Length", "Design" );
SetParmValLimits( length, 10.0, 0.001, 1.0e12 );
SetParmDescript( length, "Total Length of Custom Geom" );
See also
SetParmLowerLimit, SetParmUpperLimit
Parameters
[in]parm_idParm 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 SetParmValUpdate ( const string &in  geom_id,
const string &in  parm_name,
const string &in  parm_group_name,
double  val 
)

Set the value of the specified Parm and force an Update. This function includes a call to GetParm to identify the Parm ID given the Geom ID, Parm name, and Parm group.

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

◆ SetParmValUpdate() [2/2]

double SetParmValUpdate ( const string &in  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_idParm ID
[in]valParm value to set
Returns
Value that the Parm was set to

◆ ValidParm()

bool ValidParm ( const string &in  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
ValidParm
bool ValidParm(const string &in id)
GetXSecParm
string GetXSecParm(const string &in xsec_id, const string &in name)
GetParmUpperLimit
double GetParmUpperLimit(const string &in parm_id)
XS_ROUNDED_RECTANGLE
Definition: openvsp_as.h:2116
GetParm
string GetParm(const string &in geom_id, const string &in name, const string &in group)
FindContainerParmIDs
string[] FindContainerParmIDs(const string &in parm_container_id)
GetParmDisplayGroupName
string GetParmDisplayGroupName(const string &in parm_id)
AddParm
string AddParm(int type, const string &in name, const string &in group)
GetParmVal
double GetParmVal(const string &in parm_id)
GetParmName
string GetParmName(const string &in parm_id)
FindParm
string FindParm(const string &in parm_container_id, const string &in parm_name, const string &in group_name)
GetFeaStructName
string GetFeaStructName(const string &in geom_id, int fea_struct_ind)
GetParmGroupName
string GetParmGroupName(const string &in parm_id)
SetParmVal
double SetParmVal(const string &in parm_id, double val)
SetParmValUpdate
double SetParmValUpdate(const string &in parm_id, double val)
SetParmUpperLimit
void SetParmUpperLimit(const string &in parm_id, double val)
GetParmType
int GetParmType(const string &in parm_id)
GetParmLowerLimit
double GetParmLowerLimit(const string &in parm_id)
string
AngelScript ScriptExtension for representing the C++ std::string.
Definition: openvsp_as.h:185
FindContainer
string FindContainer(const string &in name, int index)
SetParmDescript
void SetParmDescript(const string &in parm_id, const string &in desc)
SetParmValLimits
double SetParmValLimits(const string &in parm_id, double val, double lower_limit, double upper_limit)
ChangeXSecShape
void ChangeXSecShape(const string &in xsec_surf_id, int xsec_index, int type)
array
AngelScript ScriptExtension for representing the C++ std::vector.
Definition: openvsp_as.h:244
GetXSecSurf
string GetXSecSurf(const string &in geom_id, int index)
AddGeom
string AddGeom(const string &in type, const string &in parent=string())
Print
void Print(const string &in data, bool new_line=true)
GetParmContainer
string GetParmContainer(const string &in parm_id)
GetBoolParmVal
bool GetBoolParmVal(const string &in parm_id)
SetParmLowerLimit
void SetParmLowerLimit(const string &in parm_id, double val)
GetNumXSec
int GetNumXSec(const string &in xsec_surf_id)
PARM_DOUBLE_TYPE
Definition: openvsp_as.h:1666
GetIntParmVal
int GetIntParmVal(const string &in parm_id)
AddFeaStruct
int AddFeaStruct(const string &in geom_id, bool init_skin=true, int surfindex=0)