OpenVSP API Documentation 3.43.0
 
Loading...
Searching...
No Matches
Attributes Manager Functions

This group is for functions included in the Attributes Manager. The Attributes Manager stores Attributes and provides methods to add, delete, get and set them. Click here to return to the main page. More...

Functions

string vsp::SummarizeAttributes ()
 
string vsp::SummarizeAttributesAsTree ()
 
vector< string > vsp::FindAllAttributes ()
 
vector< string > vsp::FindAttributesByName (const string &search_str)
 
string vsp::FindAttributeByName (const string &search_str, int index)
 
string vsp::FindAttributeInCollection (const string &obj_id, const string &search_str, int index)
 
vector< string > vsp::FindAttributeNamesInCollection (const string &collID)
 
vector< string > vsp::FindAttributesInCollection (const string &collID)
 
vector< string > vsp::FindAttributedObjects ()
 
int vsp::GetObjectType (const string &attachID)
 
string vsp::GetObjectTypeName (const string &attachID)
 
string vsp::GetObjectName (const string &attachID)
 
string vsp::GetObjectParent (const string &id)
 
string vsp::GetChildCollection (const string &attachID)
 
string vsp::GetGeomSetCollection (const int &index)
 
string vsp::GetAttributeName (const string &attrID)
 
string vsp::GetAttributeID (const string &collID, const string &attributeName, int index)
 
string vsp::GetAttributeDoc (const string &attrID)
 
int vsp::GetAttributeType (const string &attrID)
 
string vsp::GetAttributeTypeName (const string &attrID)
 
vector< int > vsp::GetAttributeBoolVal (const string &attrID)
 
vector< int > vsp::GetAttributeIntVal (const string &attrID)
 
vector< double > vsp::GetAttributeDoubleVal (const string &attrID)
 
vector< string > vsp::GetAttributeStringVal (const string &attrID)
 
vector< string > vsp::GetAttributeParmID (const string &attrID)
 
vector< double > vsp::GetAttributeParmVal (const string &attrID)
 
vector< string > vsp::GetAttributeParmName (const string &attrID)
 
vector< vec3dvsp::GetAttributeVec3dVal (const string &attrID)
 
vector< vector< int > > vsp::GetAttributeIntMatrixVal (const string &attrID)
 
vector< vector< double > > vsp::GetAttributeDoubleMatrixVal (const string &attrID)
 
void vsp::SetAttributeName (const string &attrID, const string &name)
 
void vsp::SetAttributeDoc (const string &attrID, const string &doc)
 
void vsp::SetAttributeBool (const string &attrID, bool value)
 
void vsp::SetAttributeInt (const string &attrID, int value)
 
void vsp::SetAttributeDouble (const string &attrID, double value)
 
void vsp::SetAttributeString (const string &attrID, const string &value)
 
void vsp::SetAttributeParmID (const string &attrID, const string &value)
 
void vsp::SetAttributeVec3d (const string &attrID, const vector< vec3d > value)
 
void vsp::SetAttributeIntMatrix (const string &attrID, const vector< vector< int > > value)
 
void vsp::SetAttributeDoubleMatrix (const string &attrID, const vector< vector< double > > value)
 
void vsp::DeleteAttribute (const string &attrID)
 
string vsp::AddAttributeBool (const string &collID, const string &attributeName, bool value)
 
string vsp::AddAttributeInt (const string &collID, const string &attributeName, const int value)
 
string vsp::AddAttributeDouble (const string &collID, const string &attributeName, const double value)
 
string vsp::AddAttributeString (const string &collID, const string &attributeName, const string &value)
 
string vsp::AddAttributeParm (const string &collID, const string &attributeName, const string &parmID)
 
string vsp::AddAttributeVec3d (const string &collID, const string &attributeName, const vector< vec3d > &value)
 
string vsp::AddAttributeIntMatrix (const string &collID, const string &attributeName, const vector< vector< int > > &value)
 
string vsp::AddAttributeDoubleMatrix (const string &collID, const string &attributeName, const vector< vector< double > > &value)
 
string vsp::AddAttributeGroup (const string &collID, const string &attributeName)
 
int vsp::CopyAttribute (const string &attrID)
 
void vsp::CutAttribute (const string &attrID)
 
vector< string > vsp::PasteAttribute (const string &coll_id)
 

Detailed Description

Function Documentation

◆ AddAttributeBool()

string vsp::AddAttributeBool ( const string & collID,
const string & attributeName,
bool value )
extern

Add a boolean attribute by name to an attribute collection

//==== Attribute: AddAttributeBool =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
bool InitVal = true;
string AttrID = AddAttributeBool( CollID, "TestBoolAttr", InitVal );
array < bool > @GetVal = GetAttributeBoolVal( AttrID );
if ( GetVal[0] == InitVal )
{
Print( "Added Bool Attribute" );
}
else
{
Print( "AddAttributeBool error!" );
__failure++;
}
vector< int > GetAttributeBoolVal(const string &attrID)
string GetChildCollection(const string &attachID)
string AddAttributeBool(const string &collID, const string &attributeName, bool value)
std::string GetVehicleID()
Parameters
[in]collIDstring ID of attribute collection
[in]attributeNamestring name of new attribute
[in]valueboolean value of new attribute

◆ AddAttributeDouble()

string vsp::AddAttributeDouble ( const string & collID,
const string & attributeName,
const double value )
extern

Add a double attribute by name to an attribute collection

//==== Attribute: AddAttributeDouble =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
string AttrName = 'Example_Double_Attr';
double DoubleValue = 3.14159;
string AttrID = AddAttributeDouble( CollID, AttrName, DoubleValue );
array < double > @GetVal = GetAttributeDoubleVal( AttrID );
if ( GetVal[0] == DoubleValue )
{
Print( "Added Double Attribute" );
}
else
{
Print( "AddAttributeDouble error!" );
__failure++;
}
vector< double > GetAttributeDoubleVal(const string &attrID)
string AddAttributeDouble(const string &collID, const string &attributeName, const double value)
Parameters
[in]collIDstring ID of attribute collection
[in]attributeNamestring name of new attribute
[in]valuedouble value of new attribute

◆ AddAttributeDoubleMatrix()

string vsp::AddAttributeDoubleMatrix ( const string & collID,
const string & attributeName,
const vector< vector< double > > & value )
extern

Add an Double Matrix attribute by name to an attribute collection use nested vectors/arrays of ints for matrix argument

//==== Attribute: AddAttributeDoubleMatrix =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
string AttrName = "Example_DoubleMat_Attr";
array < array < double > > DoubleMatrix = {{0.,1.5},{8.4,1.1566}};
string AttrID = AddAttributeDoubleMatrix( CollID, AttrName, DoubleMatrix );
array < array < double > > DoubleMatrixVal = GetAttributeDoubleMatrixVal( AttrID );
if ( DoubleMatrixVal == DoubleMatrix )
{
Print( "Added DoubleMatrix Attribute" );
}
else
{
Print( "AddAttributeDoubleMatrix error!" );
__failure++;
}
vector< vector< double > > GetAttributeDoubleMatrixVal(const string &attrID)
string AddAttributeDoubleMatrix(const string &collID, const string &attributeName, const vector< vector< double > > &value)
Parameters
[in]collIDstring ID of attribute collection
[in]attributeNamestring name of new attribute
[in]valueDouble matrix value of new attribute

◆ AddAttributeGroup()

string vsp::AddAttributeGroup ( const string & collID,
const string & attributeName )
extern

Add an empty Attribute Group-type attribute by name to an attribute collection

//==== Attribute: AddAttributeGroup =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
string AttrName = "Example_Attr_Group";
string AttrID = AddAttributeGroup( CollID, AttrName );
{
Print( "Added Attribute Group" );
}
else
{
Print( "AddAttributeGroup error!" );
__failure++;
}
string AddAttributeGroup(const string &collID, const string &attributeName)
int GetAttributeType(const string &attrID)
@ ATTR_COLLECTION_DATA
Parameters
[in]collIDstring ID of attribute collection
[in]attributeNamestring name of new attribute group

◆ AddAttributeInt()

string vsp::AddAttributeInt ( const string & collID,
const string & attributeName,
const int value )
extern

Add a integer attribute by name to an attribute collection

//==== Attribute: AddAttributeInt =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
int InitVal = 55;
string AttrID = AddAttributeInt( CollID, "TestIntAttr", InitVal );
array < int > @GetVal = GetAttributeIntVal( AttrID );
if ( GetVal[0] == InitVal )
{
Print( "Added Int Attribute" );
}
else
{
Print( "AddAttributeInt error!" );
__failure++;
}
string AddAttributeInt(const string &collID, const string &attributeName, const int value)
vector< int > GetAttributeIntVal(const string &attrID)
Parameters
[in]collIDstring ID of attribute collection
[in]attributeNamestring name of new attribute
[in]valueinteger value of new attribute

◆ AddAttributeIntMatrix()

string vsp::AddAttributeIntMatrix ( const string & collID,
const string & attributeName,
const vector< vector< int > > & value )
extern

Add an Int Matrix attribute by name to an attribute collection use nested vectors/arrays of ints for matrix argument

//==== Attribute: AddAttributeIntMatrix =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
string AttrName = "Example_IntMatrix_Attr";
array < array < int > > IntMatrix = {{1,5},{-8,0}};
string AttrID = AddAttributeIntMatrix( CollID, AttrName, IntMatrix );
array < array < int > > IntMatrixVal = GetAttributeIntMatrixVal( AttrID );
if ( IntMatrixVal == IntMatrix )
{
Print( "Added IntMatrix Attribute" );
}
else
{
Print( "AddAttributeIntMatrix error!" );
__failure++;
}
string AddAttributeIntMatrix(const string &collID, const string &attributeName, const vector< vector< int > > &value)
vector< vector< int > > GetAttributeIntMatrixVal(const string &attrID)
Parameters
[in]collIDstring ID of attribute collection
[in]attributeNamestring name of new attribute
[in]valueint matrix value of new attribute

◆ AddAttributeParm()

string vsp::AddAttributeParm ( const string & collID,
const string & attributeName,
const string & parmID )
extern

Add a parm attribute by name to an attribute collection

//==== Attribute: AddAttributeParm =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
string PodID = AddGeom( "POD", "" );
Print( "---> Test Add Parm Attr" );
array < string > @ParmArray = GetGeomParmIDs( PodID );
string ParmID = ParmArray[0];
string AttrName = "Example_Parm_Attr";
string AttrID = AddAttributeParm( CollID, AttrName, ParmID );
array < string > @GetVal = GetAttributeParmID( AttrID );
if ( GetVal[0] == ParmID )
{
Print( "Added Parm Attribute" );
}
else
{
Print( "AddAttributeParm error!" );
__failure++;
}
vector< string > GetAttributeParmID(const string &attrID)
string AddAttributeParm(const string &collID, const string &attributeName, const string &parmID)
std::vector< std::string > GetGeomParmIDs(const std::string &geom_id)
std::string AddGeom(const std::string &type, const std::string &parent=std::string())
Parameters
[in]collIDstring ID of attribute collection
[in]attributeNamestring name of new attribute
[in]valuestring value of new attribute

◆ AddAttributeString()

string vsp::AddAttributeString ( const string & collID,
const string & attributeName,
const string & value )
extern

Add a string attribute by name to an attribute collection

//==== Attribute: AddAttributeString =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
string AttrName = "Example_String_Attr";
string StringValue = "Example_String_Attr_DataVal";
string AttrID = AddAttributeString( CollID, AttrName, StringValue );
array < string > @GetVal = GetAttributeStringVal( AttrID );
if ( GetVal[0] == StringValue )
{
Print( "Added String Attribute" );
}
else
{
Print( "AddAttributeString error!" );
__failure++;
}
vector< string > GetAttributeStringVal(const string &attrID)
string AddAttributeString(const string &collID, const string &attributeName, const string &value)
Parameters
[in]collIDstring ID of attribute collection
[in]attributeNamestring name of new attribute
[in]valuestring value of new attribute

◆ AddAttributeVec3d()

string vsp::AddAttributeVec3d ( const string & collID,
const string & attributeName,
const vector< vec3d > & value )
extern

Add a Vec3d attribute by name to an attribute collection use vec3d() to create a vec3d object to pass into the args!

//==== Attribute: AddAttributeVec3d =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
string AttrName = "Example_Vec3D_Attr";
vec3d Vec3dVal = vec3d( 0.5, 0.75, -0.4 );
string AttrID = AddAttributeVec3d( CollID, AttrName, { Vec3dVal } );
array < vec3d > @GetVal = GetAttributeVec3dVal( AttrID );
if ( GetVal[0].x() == Vec3dVal.x() and GetVal[0].y() == Vec3dVal.y() and GetVal[0].z() == Vec3dVal.z() )
{
Print( "Added Vec3d Attribute" );
}
else
{
Print( "AddAttributeVec3d error!" );
__failure++;
}
Definition Vec3d.h:235
double y() const
Definition Vec3d.h:472
double x() const
Definition Vec3d.h:435
double z() const
Definition Vec3d.h:509
vector< vec3d > GetAttributeVec3dVal(const string &attrID)
string AddAttributeVec3d(const string &collID, const string &attributeName, const vector< vec3d > &value)
Parameters
[in]collIDstring ID of attribute collection
[in]attributeNamestring name of new attribute
[in]valueVec3d value of new attribute

◆ CopyAttribute()

int vsp::CopyAttribute ( const string & attrID)
extern

Copy an attribute to the clipboard by attributeID

//==== Attribute: CopyAttribute =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
string AttrName = "Example_String_Attr";
string StringValue = "Example_String_Attr_DataVal";
string AttrID = AddAttributeString( CollID, AttrName, StringValue );
int CopyError = CopyAttribute( AttrID );
if ( CopyError == 0 )
{
Print("Successfully copied Attribute");
}
else
{
Print("CopyAttribute Error!");
__failure++;
}
int CopyAttribute(const string &attrID)
Parameters
[in]attrIDstring ID of attribute to be copied

◆ CutAttribute()

void vsp::CutAttribute ( const string & attrID)
extern

Cut an attribute from its collection to the clipboard by attributeID

//==== Attribute: CopyAttribute =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
string AttrName = "Example_String_Attr";
string StringValue = "Example_String_Attr_DataVal";
string AttrID = AddAttributeString( CollID, AttrName, StringValue );
CutAttribute( AttrID );
string NewCollID = GetChildCollection( "_AttrWMGroup" );
array < string > @PastedAttrIDs = PasteAttribute( NewCollID );
bool MatchIDs = PastedAttrIDs[0] == AttrID;
bool AttrInColl = false;
array < string > OldAttrIDs = FindAttributesInCollection( CollID );
for ( int i = 0; i < int( OldAttrIDs.size() ); i++ )
{
if ( AttrID == OldAttrIDs[i] )
{
AttrInColl = true;
}
}
if ( MatchIDs and not AttrInColl )
{
Print( "Successfully Cut Attribute" );
}
else
{
Print( "CutAttribute Error!" );
__failure++;
}
void CutAttribute(const string &attrID)
vector< string > FindAttributesInCollection(const string &collID)
vector< string > PasteAttribute(const string &coll_id)
Parameters
[in]attrIDstring ID of attribute to be copied

◆ DeleteAttribute()

void vsp::DeleteAttribute ( const string & attrID)
extern

Delete attribute by attribute ID

//==== Attribute: DeleteAttribute =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
string InitVal = "This_Attribute_Will_Be_Deleted";
string AttrID = AddAttributeString( CollID, "TestStringAttr", InitVal );
bool AttrAdded = false;
bool AttrDeleted = true;
array < string > @AttrIDs = FindAllAttributes();
for ( int i = 0; i < int( AttrIDs.size() ); i++ )
{
if ( AttrID == AttrIDs[i] )
{
AttrAdded = true;
}
}
DeleteAttribute( AttrID );
array < string > @NewAttrIDs = FindAllAttributes();
for ( int i = 0; i < int( NewAttrIDs.size() ); i++ )
{
if ( AttrID == NewAttrIDs[i] )
{
AttrDeleted = false;
}
}
if ( AttrAdded and AttrDeleted )
{
Print( "Attribute successfully deleted" );
}
else
{
Print( "DeleteAttribute error!" );
__failure++;
}
void DeleteAttribute(const string &attrID)
vector< string > FindAllAttributes()
Parameters
[in]attrIDstring of attribute ID

◆ FindAllAttributes()

vector< string > vsp::FindAllAttributes ( )
extern

Returns a vector of string IDs for all Attributes in the vehicle

//==== Attributes: FindAllAttributes ====//
array < string > @AttrIDs = FindAllAttributes();
for ( int i = 0; i < int( AttrIDs.size() ); ++i )
{
Print( AttrIDs[i] );
}
Returns
Vector of All Attribute IDs

◆ FindAttributeByName()

string vsp::FindAttributeByName ( const string & search_str,
int index )
extern

Searches all attributes that contain the search string, case insensitive, and returns the user-specified index

//==== Attributes: FindAttributeByName ====//
string AttrID = FindAttributeByName( "Watermark", 0 );
Print( AttrID );
string FindAttributeByName(const string &search_str, int index)
Returns
Returns a StringID of the attribute indexed/searched by user, if found
Parameters
[in]search_strstring for filtering attributes in model
[in]indexint for indexing which of the vector of found attributes to select

◆ FindAttributedObjects()

vector< string > vsp::FindAttributedObjects ( )
extern

Get array of IDs of all OpenVSP entities that have populated attributeCollections Includes attributeGroups

//==== Attributes: FindAttributedObjects ====//
array < string > @AttachIDs = FindAttributedObjects();
for ( int i = 0; i < int( AttachIDs.size() ); ++i )
{
Print( AttachIDs[i] );
}
vector< string > FindAttributedObjects()
Returns
Array of IDs of entities in OpenVSP that contain populated attribute collections

◆ FindAttributeInCollection()

string vsp::FindAttributeInCollection ( const string & obj_id,
const string & search_str,
int index )
extern

Searches all attributes in an OpenVSP object or AttributeCollection that contain the search string, case insensitive, and returns the user-specified index. Works either with the ID of an object that contains an attributeCollection or just the ID of an attributeCollection.

//==== Attributes: FindAttributeInCollection ====//
string VehID = GetVehicleID();
string AttrID = FindAttributeInCollection( VehID, "Watermark", 0 );
Print( AttrID );
string FindAttributeInCollection(const string &obj_id, const string &search_str, int index)
Returns
Returns a StringID of the attribute indexed/searched by user, if found
Parameters
[in]obj_idid of object to search within for attributes
[in]search_strstring for filtering attributes in object
[in]indexint for indexing which of the vector of found attributes to select

◆ FindAttributeNamesInCollection()

vector< string > vsp::FindAttributeNamesInCollection ( const string & collID)
extern

Return a list of all attribute Names within an attribute collection

//==== Attributes: FindAttributeNamesInCollection ====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
array < string > @AttrNames = FindAttributeNamesInCollection( CollID );
for ( int i = 0; i < int( AttrNames.size() ); ++i )
{
Print( AttrNames[i] );
}
vector< string > FindAttributeNamesInCollection(const string &collID)
Returns
Array of result names
Parameters
[in]collIDstring ID of an attribute collection

◆ FindAttributesByName()

vector< string > vsp::FindAttributesByName ( const string & search_str)
extern

Returns all attributes that contain the string search_str within their name, case insensitive

//==== Attributes: FindAttributesByName ====//
array < string > @AttrIDs = FindAttributesByName( "Watermark" );
for ( int i = 0; i < int( AttrIDs.size() ); ++i )
{
Print( AttrIDs[i] );
}
vector< string > FindAttributesByName(const string &search_str)
Returns
Vector of string IDs of matching Attributes
Parameters
[in]search_strstring for filtering attributes in model

◆ FindAttributesInCollection()

vector< string > vsp::FindAttributesInCollection ( const string & collID)
extern

Get all attribute IDs within a single AttributeCollection, referenced by collID

//==== Attributes: FindAttributesInCollection ====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
array < string > @AttrIDs = FindAttributesInCollection( CollID );
for ( int i = 0; i < int( AttrIDs.size() ); ++i )
{
Print( AttrIDs[i] );
}
Returns
Vector of attribute IDs in an attribute collection.
Parameters
[in]collIDstring ID of an attribute collection

◆ GetAttributeBoolVal()

vector< int > vsp::GetAttributeBoolVal ( const string & attrID)
extern

Get the boolean value of a bool-type attribute

//==== Attribute: GetAttributeBoolVal =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
bool InitVal = true;
string AttrID = AddAttributeBool( CollID, "TestBoolAttr", InitVal );
array < bool > @GetVal = GetAttributeBoolVal( AttrID );
if ( GetVal[0] == InitVal )
{
Print( "Got matching Bool Value from Attribute" );
}
else
{
Print( "GetAttributeBoolVal error!" );
__failure++;
}
Returns
Bool value of attribute
Parameters
[in]attrIDstring ID of attribute

◆ GetAttributeDoc()

string vsp::GetAttributeDoc ( const string & attrID)
extern

Return string doc of attribute by its ID

//==== Attributes: GetAttributeDoc =====//
array < string > @AttrIDs = FindAllAttributes();
string AttrID = AttrIDs[0];
string AttrDoc = GetAttributeDoc( AttrID );
Print( AttrDoc );
string GetAttributeDoc(const string &attrID)
Returns
Return string doc of attribute by its ID
Parameters
[in]attrIDstring ID of attribute

◆ GetAttributeDoubleMatrixVal()

vector< vector< double > > vsp::GetAttributeDoubleMatrixVal ( const string & attrID)
extern

Get the Double Matrix of an Double-matrix-type attribute

//==== Attribute: GetAttributeDoubleMatrixVal =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
array < array < double > > InitVal = {{0., 1.},{-4., -1000.}};
string AttrID = AddAttributeDoubleMatrix( CollID, "TestDoubleMatrixAttr", InitVal );
array < array < double > > DblMatrixVal = GetAttributeDoubleMatrixVal( AttrID );
if ( DblMatrixVal == InitVal )
{
Print( "Got matching DoubleMatrix Value from Attribute" );
}
else
{
Print( "GetAttributeDoubleMatrixVal error!" );
__failure++;
}
Returns
Double Matrix value of attribute as vector < vector < Double > >
Parameters
[in]attrIDstring ID of attribute

◆ GetAttributeDoubleVal()

vector< double > vsp::GetAttributeDoubleVal ( const string & attrID)
extern

Get the double value of a double-type attribute

//==== Attribute: GetAttributeDoubleVal =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
double InitVal = 3.14159;
string AttrID = AddAttributeDouble( CollID, "TestDoubleAttr", InitVal );
array < double > @GetVal = GetAttributeDoubleVal( AttrID );
if ( GetVal[0] == InitVal )
{
Print( "Got matching Double Value from Attribute" );
}
else
{
Print( "GetAttributeDoubleVal error!" );
__failure++;
}
Returns
Double value of attribute
Parameters
[in]attrIDstring ID of attribute

◆ GetAttributeID()

string vsp::GetAttributeID ( const string & collID,
const string & attributeName,
int index )
extern

Return the ID of an attribute by its name and collection ID

//==== Attributes: GetAttributeID =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
array < string > @AttrNames = FindAttributeNamesInCollection( CollID );
for ( int i = 0; i < int( AttrNames.size() ); ++i )
{
string AttrID = GetAttributeID( CollID, AttrNames[i], 0 );
Print( AttrID );
}
string GetAttributeID(const string &collID, const string &attributeName, int index)
Returns
String ID of attribute based on collectionID and name
Parameters
[in]collIDstring ID of an attribute collection
[in]attributeNamename of an attribute in that collection

◆ GetAttributeIntMatrixVal()

vector< vector< int > > vsp::GetAttributeIntMatrixVal ( const string & attrID)
extern

Get the Int Matrix of an Int-matrix-type attribute

//==== Attribute: GetAttributeIntMatrixVal =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
array < array < int > > InitVal = { {0, 1} , {-4, -1000} };
string AttrID = AddAttributeIntMatrix( CollID, "TestIntMatrixAttr", InitVal );
array < array < int > > IntMatrixVal = GetAttributeIntMatrixVal( AttrID );
// can also get object handle to the int array with an @ handle declaration!
array < array < int > > @IntMatrixValJHandle = GetAttributeIntMatrixVal( AttrID );
if ( IntMatrixVal == InitVal )
{
Print( "Got matching IntMatrix Value from Attribute" );
}
else
{
Print( "GetAttributeIntMatrixVal error!" );
__failure++;
}
Returns
Int Matrix value of attribute as vector < vector < int > >
Parameters
[in]attrIDstring ID of attribute

◆ GetAttributeIntVal()

vector< int > vsp::GetAttributeIntVal ( const string & attrID)
extern

Get the integer value of an int-type attribute

//==== Attribute: GetAttributeIntVal =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
int InitVal = 55;
string AttrID = AddAttributeInt( CollID, "TestIntAttr", InitVal );
array < int > @GetVal = GetAttributeIntVal( AttrID );
if ( GetVal[0] == InitVal )
{
Print( "Got matching Int Value from Attribute" );
}
else
{
Print( "GetAttributeIntVal error!" );
__failure++;
}
Returns
Int value of attribute
Parameters
[in]attrIDstring ID of attribute

◆ GetAttributeName()

string vsp::GetAttributeName ( const string & attrID)
extern

Return the name of an attribute by its ID

//==== Attributes: GetAttributeName =====//
array < string > @AttrIDs = FindAllAttributes();
for ( int i = 0; i < int( AttrIDs.size() ); ++i )
{
string AttrName = GetAttributeName( AttrIDs[i] );
Print( AttrName );
}
string GetAttributeName(const string &attrID)
Returns
String ID of attribute based on collectionID and name
Parameters
[in]collIDstring ID of an attribute collection
[in]attributeNamename of an attribute in that collection

◆ GetAttributeParmID()

vector< string > vsp::GetAttributeParmID ( const string & attrID)
extern

Get the parm value of a parm-type attribute

//==== Attribute: GetAttributeParmID =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
string PodID = AddGeom( "POD", "" );
Print( "---> Test Get Parm Val" );
array < string > @ParmArray = GetGeomParmIDs( PodID );
string ParmID = ParmArray[0];
string AttrID = AddAttributeParm( CollID, "TestParmAttr", ParmID );
array < string > @GetID = GetAttributeParmID( AttrID );
if ( GetID[0] == ParmID )
{
Print( "Got matching Parm ID from Attribute" );
}
else
{
Print( "GetAttributeParmID error!" );
__failure++;
}
Returns
Parm value of attribute
Parameters
[in]attrIDstring ID of attribute

◆ GetAttributeParmName()

vector< string > vsp::GetAttributeParmName ( const string & attrID)
extern

Get the name of the referenced parm of a parm-type attribute

//==== Attribute: GetAttributeParmName =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
string PodID = AddGeom( "POD", "" );
Print( "---> Test Get Parm Val" );
array < string > @ParmArray = GetGeomParmIDs( PodID );
string AttrName = "Example_Parm_Attr";
string ParmID = ParmArray[0];
AddAttributeParm( CollID, AttrName, ParmID );
string AttrID = GetAttributeID( CollID, AttrName, 0 );
string ParmName = GetAttributeParmName( AttrID )[0];
if ( ParmName == GetParmName( ParmID ) )
{
Print( "Got matching Parm Name from Attribute" );
}
else
{
Print( "GetAttributeParmName error!" );
__failure++;
}
vector< string > GetAttributeParmName(const string &attrID)
std::string GetParmName(const std::string &parm_id)
Returns
Parm name of attribute
Parameters
[in]attrIDstring ID of attribute

◆ GetAttributeParmVal()

vector< double > vsp::GetAttributeParmVal ( const string & attrID)
extern

Get the parm value of a parm-type attribute

//==== Attribute: GetAttributeParmVal =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
string PodID = AddGeom( "POD", "" );
Print( "---> Test Get Parm Val" );
array < string > @ParmArray = GetGeomParmIDs( PodID );
string ParmID = ParmArray[0];
string AttrID = AddAttributeParm( CollID, "TestParmAttr", ParmID );
double InitVal = GetParmVal( ParmID );
array < double > @GetVal = GetAttributeParmVal( AttrID );
if ( GetVal[0] == InitVal )
{
Print( "Got matching Parm Value from Attribute" );
}
else
{
Print( "GetAttributeParmVal error!" );
__failure++;
}
vector< double > GetAttributeParmVal(const string &attrID)
double GetParmVal(const std::string &parm_id)
Returns
Parm value of attribute
Parameters
[in]attrIDstring ID of attribute

◆ GetAttributeStringVal()

vector< string > vsp::GetAttributeStringVal ( const string & attrID)
extern

Get the string value of a string-type attribute

//==== Attribute: GetAttributeStringVal =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
string InitVal = "Hello_World_of_Attributes";
string AttrID = AddAttributeString( CollID, "TestStringAttr", InitVal );
array < string > @GetVal = GetAttributeStringVal( AttrID );
if ( GetVal[0] == InitVal )
{
Print( "Got matching String Value from Attribute" );
}
else
{
Print( "GetAttributeStringVal error!" );
__failure++;
}
Returns
String value of attribute
Parameters
[in]attrIDstring ID of attribute

◆ GetAttributeType()

int vsp::GetAttributeType ( const string & attrID)
extern

Get int enum type of attribute by ID Use in conjunction with GetAttributeTypeName for getting strings or with the following enums BOOL_DATA INT_DATA DOUBLE_DATA STRING_DATA VEC3D_DATA INT_MATRIX_DATA DOUBLE_MATRIX_DATA NAMEVAL_COLLECTION_DATA ATTR_COLLECTION_DATA

//==== Attributes: GetAttributeType =====//
array < string > @AttrIDs = FindAllAttributes();
string AttrID = AttrIDs[0];
int AttrType = GetAttributeType( AttrID );
Print( AttrType );
// not implemented
Returns
Int type of attribute
Parameters
[in]attrIDstring ID of attribute

◆ GetAttributeTypeName()

string vsp::GetAttributeTypeName ( const string & attrID)
extern

Get the attribute's type as a string

//==== Attributes: GetAttributeTypeName =====//
array < string > @AttrIDs = FindAllAttributes();
string AttrID = AttrIDs[0];
string AttrTypeName = GetAttributeTypeName( AttrID );
Print( AttrTypeName );
string GetAttributeTypeName(const string &attrID)
Returns
Type of attribute as string
Parameters
[in]attrIDstring ID of attribute

◆ GetAttributeVec3dVal()

vector< vec3d > vsp::GetAttributeVec3dVal ( const string & attrID)
extern

Get the vec3d value of a string-type attribute

//==== Attribute: GetAttributeVec3dVal =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
vec3d InitVal = vec3d( 1., 0.5, -4. );
string AttrID = AddAttributeVec3d( CollID, "TestVec3dAttr", {InitVal} );
array < vec3d > @Vec3dVal = GetAttributeVec3dVal( AttrID );
if ( Vec3dVal[0].x() == InitVal.x() and Vec3dVal[0].y() == InitVal.y() and Vec3dVal[0].z() == InitVal.z() )
{
Print( "Got matching Vec3d Value from Attribute" );
}
else
{
Print( "GetAttributeVec3dVal error!" );
__failure++;
}
Returns
Vec3d value of attribute
Parameters
[in]attrIDstring ID of attribute

◆ GetChildCollection()

string vsp::GetChildCollection ( const string & attachID)
extern

Get collection ID from any OpenVSP object If ID is an attribute collection, return the same ID back If ID is an attribute group, return its nested collection

//==== Attributes: GetChildCollection =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
Print( CollID );
Returns
String ID of attribute collection associated with the attachID
Parameters
[in]attachIDstring ID of an OpenVSP object

◆ GetGeomSetCollection()

string vsp::GetGeomSetCollection ( const int & index)
extern

Get collection ID from a vehicle's GeomSet

//==== Attributes: GetGeomSetCollection =====//
string CollID = GetGeomSetCollection( 0 );
Print( CollID );
string GetGeomSetCollection(const int &index)
Returns
String ID of attribute collection associated with the geom set
Parameters
[in]attachIDstring ID of an OpenVSP object

◆ GetObjectName()

string vsp::GetObjectName ( const string & attachID)
extern

Get the name of an OpenVSP Entity by ID

//==== Attributes: GetObjectName ====//
array < string > @AttachIDs = FindAttributedObjects();
for ( int i = 0; i < int( AttachIDs.size() ); ++i )
{
string ObjName = GetObjectName( AttachIDs[i] );
Print( ObjName );
}
string GetObjectName(const string &attachID)
Returns
return string of object name
Parameters
[in]attachIDstring ID of an OpenVSP object

◆ GetObjectParent()

string vsp::GetObjectParent ( const string & id)
extern

Get the string ID of the entity's parent Attributes -> Attribute Collections Attribute Collections -> Objects that contain attribute Collections Geoms->Parent Geoms Parms->ParmContainers etc.

//==== Attributes: GetObjectParent ====//
string WingID = AddGeom( "WING" );
string PodID = AddGeom( "POD", WingID );
string ParentID = GetObjectParent( PodID );
if ( ParentID == WingID )
{
Print( "Parent of Pod is Wing");
}
// Get first attribute in vehicle as an example
array < string > @AttrIDs = FindAllAttributes();
string AttrID = AttrIDs[0];
string CollID = GetObjectParent( AttrID );
string CollParentObjID = GetObjectParent( CollID );
Print( CollParentObjID );
string GetObjectParent(const string &id)
Returns
string ID of object parent

◆ GetObjectType()

int vsp::GetObjectType ( const string & attachID)
extern

Get the type of an OpenVSP Entity by ID

//==== Attributes: GetObjectType ====//
array < string > @AttachIDs = FindAttributedObjects();
for ( int i = 0; i < int( AttachIDs.size() ); ++i )
{
int ObjType = GetObjectType( AttachIDs[i] );
Print( ObjType );
}
int GetObjectType(const string &attachID)
Returns
return string of object name
Parameters
[in]attachIDstring ID of an OpenVSP object

◆ GetObjectTypeName()

string vsp::GetObjectTypeName ( const string & attachID)
extern

Get the named type of an OpenVSP Entity by ID

//==== Attributes: GetObjectTypeName ====//
array < string > @AttachIDs = FindAttributedObjects();
for ( int i = 0; i < int( AttachIDs.size() ); ++i )
{
string ObjTypeName = GetObjectTypeName( AttachIDs[i] );
Print( ObjTypeName );
}
string GetObjectTypeName(const string &attachID)
Returns
return string of object name
Parameters
[in]attachIDstring ID of an OpenVSP object

◆ PasteAttribute()

vector< string > vsp::PasteAttribute ( const string & coll_id)
extern

Paste the attribute clipboard to the specified objectID ObjectID can be any OpenVSP entity that contains a AttributeCollection or simply the attributeCollectionID Returns a vector of pasted attributes IDs, if any

//==== Attribute: PasteAttribute =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
string AttrName = "Example_String_Attr";
string StringValue = "Example_String_Attr_DataVal";
string AttrID = AddAttributeString( CollID, AttrName, StringValue );
CutAttribute( AttrID );
string NewCollID = GetChildCollection( "_AttrWMGroup" );
array < string > @NewAttrIDs = PasteAttribute( NewCollID );
bool MatchIDs = false;
bool AttrInOldColl = false;
bool AttrInNewColl = false;
array < string > OldCollAttrs = FindAttributesInCollection( CollID );
array < string > NewCollAttrs = FindAttributesInCollection( NewCollID );
MatchIDs = NewAttrIDs[0] == AttrID;
for ( int i = 0; i < int( OldCollAttrs.size() ); i++ )
{
if ( AttrID == OldCollAttrs[i] )
{
AttrInOldColl = true;
}
}
for ( int i = 0; i < int( NewCollAttrs.size() ); i++ )
{
if ( AttrID == NewCollAttrs[i] )
{
AttrInNewColl = true;
}
}
if ( MatchIDs and !AttrInOldColl and AttrInNewColl )
{
Print("Successfully pasted Attribute");
}
else
{
Print("PasteAttribute Error!");
__failure++;
}
Parameters
[in]coll_idstring ID of destination for pasting attribute into

◆ SetAttributeBool()

void vsp::SetAttributeBool ( const string & attrID,
bool value )
extern

Set the Bool value of a bool-type Attribute by ID

//==== Attribute: SetAttributeBool =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
bool InitVal = true;
string AttrID = AddAttributeBool( CollID, "TestBoolAttr", InitVal );
bool SetVal = false;
SetAttributeBool( AttrID, SetVal );
array < bool > @GetVal = GetAttributeBoolVal( AttrID );
if ( GetVal[0] == SetVal )
{
Print( "Set matching Bool Value from Attribute" );
}
else
{
Print( "SetAttributeBoolVal error!" );
__failure++;
}
void SetAttributeBool(const string &attrID, bool value)
Parameters
[in]attrIDstring of attribute ID
[in]valueboolean value for attribute

◆ SetAttributeDoc()

void vsp::SetAttributeDoc ( const string & attrID,
const string & doc )
extern

Set the docstring of an Attribute by ID

//==== Attribute: SetAttributeDoc =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
string InitVal = "Hello_World_of_Attributes";
string AttrID = AddAttributeString( CollID, "TestStringAttr", InitVal );
string DocString = "New_docstring_for_attribute";
SetAttributeDoc( AttrID, DocString );
string NewDocString = GetAttributeDoc( AttrID );
if ( NewDocString == DocString )
{
Print( "Got matching DocString from Attribute" );
}
else
{
Print( "SetAttributeDoc error!" );
__failure++;
}
void SetAttributeDoc(const string &attrID, const string &doc)
Parameters
[in]attrIDstring of attribute ID
[in]docstring of documentation for attribute

◆ SetAttributeDouble()

void vsp::SetAttributeDouble ( const string & attrID,
double value )
extern

Set the Double value of a double-type Attribute by ID

//==== Attribute: SetAttributeDouble =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
double InitVal = 3.14159;
string AttrID = AddAttributeDouble( CollID, "TestDoubleAttr", InitVal );
double DoubleVal = 3.15;
SetAttributeDouble( AttrID, DoubleVal );
array < double > @GetVal = GetAttributeDoubleVal( AttrID );
if ( GetVal[0] == DoubleVal )
{
Print( "Set matching Double Value from Attribute" );
}
else
{
Print( "SetAttributeDoubleVal error!" );
__failure++;
}
void SetAttributeDouble(const string &attrID, double value)
Parameters
[in]attrIDstring of attribute ID
[in]valuedouble value for attribute

◆ SetAttributeDoubleMatrix()

void vsp::SetAttributeDoubleMatrix ( const string & attrID,
const vector< vector< double > > value )
extern

Set the double matrix of a double-matrix-type Attribute by ID

//==== Attribute: SetAttributeDoubleMatrix =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
array < array < double > > InitVal = {{0., 1.},{-4., -1000.}};
string AttrID = AddAttributeDoubleMatrix( CollID, "TestDoubleMatrixAttr", InitVal );
array < array < double > > NewDmatVal = {{0.,1.5},{8.4,1.1566}};
SetAttributeDoubleMatrix( AttrID, NewDmatVal );
array < array < double > > DblMatrixVal = GetAttributeDoubleMatrixVal( AttrID );
if ( DblMatrixVal == NewDmatVal )
{
Print( "Got matching Double Matrix Value from Attribute" );
}
else
{
Print( "GetAttributeDoubleMatrixVal error!" );
__failure++;
}
void SetAttributeDoubleMatrix(const string &attrID, const vector< vector< double > > value)
Parameters
[in]attrIDstring of attribute ID
[in]valuedouble matrix value for attribute

◆ SetAttributeInt()

void vsp::SetAttributeInt ( const string & attrID,
int value )
extern

Set the Int value of an int-type Attribute by ID

//==== Attribute: SetAttributeInt =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
int InitVal = 55;
string AttrID = AddAttributeInt( CollID, "TestIntAttr", InitVal );
int NewIntVal = -55;
SetAttributeInt( AttrID, NewIntVal );
array < int > @GetVal = GetAttributeIntVal( AttrID );
if ( GetVal[0] == NewIntVal )
{
Print( "Set matching Int Value from Attribute" );
}
else
{
Print( "SetAttributeIntVal error!" );
__failure++;
}
void SetAttributeInt(const string &attrID, int value)
Parameters
[in]attrIDstring of attribute ID
[in]valueint value for attribute

◆ SetAttributeIntMatrix()

void vsp::SetAttributeIntMatrix ( const string & attrID,
const vector< vector< int > > value )
extern
Set the int matrix of a int-matrix-type Attribute by ID

\code{.cpp}
//==== Write Some Fake Test Results =====//
// not implemented
\endcode

==== Attribute: SetAttributeIntMatrix =====//

string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
array < array < int > > InitVal = {{0, 1},{-4, -1000}};
string AttrID = AddAttributeIntMatrix( CollID, "TestIntMatrixAttr", InitVal );

array < array < int > > NewImatVal = [[1,5],[-8,0]];
SetAttributeIntMatrix( AttrID, NewImatVal );

array < array < int > > IntMatrixVal = GetAttributeIntMatrixVal( AttrID );

if ( IntMatrixVal == NewImatVal )
{
    Print( "Set matching IntMatrix Value from Attribute" );
}
else
{
    Print( "SetAttributeIntMatrixVal error!" );
    __failure++;
}

\code{.py}
##==== Attribute: SetAttributeIntMatrix  =====##

VehID = GetVehicleID()
CollID = GetChildCollection( VehID )
InitVal = [[0, 1,],[-4, -1000]]
AttrID = AddAttributeIntMatrix( CollID, "TestIntMatrixAttr", InitVal )

ImatVal = [[1,5],[-8,0]]
SetAttributeIntMatrix( AttrID, ImatVal )

IntMatrixVal = GetAttributeIntMatrixVal( AttrID )
IntMatrixVal = [list(row) for row in IntMatrixVal]

if IntMatrixVal == ImatVal:
    print( "Set matching IntMatrix Value from Attribute" )
else:
    print( "SetAttributeIntMatrixVal error!" )

\endcode
\endif
\param [in] attrID string of attribute ID
\param [in] value int matrix value for attribute

◆ SetAttributeName()

void vsp::SetAttributeName ( const string & attrID,
const string & name )
extern

Set the name of an Attribute by ID

//==== Attribute: SetAttributeName =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
string InitVal = "Hello_World_of_Attributes";
string AttrID = AddAttributeString( CollID, "TestStringAttr", InitVal );
string NameString = "NewName_Example";
SetAttributeName( AttrID, NameString );
string AttrName = GetAttributeName( AttrID );
if ( NameString == AttrName )
{
Print( "Got matching name from Attribute" );
}
else
{
Print( "SetAttributeName error!" );
__failure++;
}
//==== Write Some Fake Test Results =====//
// not implemented
void SetAttributeName(const string &attrID, const string &name)
Parameters
[in]attrIDstring of attribute ID
[in]docstring of documentation for attribute

◆ SetAttributeParmID()

void vsp::SetAttributeParmID ( const string & attrID,
const string & value )
extern

Set the ParmID value of a Parm-type Attribute by ID

//==== Attribute: SetAttributeParmID =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
string PodID = AddGeom( "POD", "" );
Print( "---> Test Get Parm Val" );
array < string > @ParmArray = GetGeomParmIDs( PodID );
string ParmID = ParmArray[0];
string AttrID = AddAttributeParm( CollID, "TestParmAttr", ParmID );
string NewParmID = ParmArray[1];
SetAttributeParmID( AttrID, NewParmID );
array < string > @GetID = GetAttributeParmID( AttrID );
if ( GetID[0] == NewParmID )
{
Print( "Set matching Parm ID from Attribute" );
}
else
{
Print( "SetAttributeParmID error!" );
__failure++;
}
void SetAttributeParmID(const string &attrID, const string &value)
Parameters
[in]attrIDstring of attribute ID
[in]valuestring value for attribute

◆ SetAttributeString()

void vsp::SetAttributeString ( const string & attrID,
const string & value )
extern

Set the String value of a string-type Attribute by ID

//==== Attribute: SetAttributeString =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
string InitVal = "Hello_World_of_Attributes";
string AttrID = AddAttributeString( CollID, "TestStringAttr", InitVal );
string StringVal = "Du bist supergeil!";
SetAttributeString( AttrID, StringVal );
array < string > @GetVal = GetAttributeStringVal( AttrID );
if ( GetVal[0] == StringVal )
{
Print( "Got matching String Value from Attribute" );
}
else
{
Print( "GetAttributeStringVal error!" );
__failure++;
}
void SetAttributeString(const string &attrID, const string &value)
Parameters
[in]attrIDstring of attribute ID
[in]valuestring value for attribute

◆ SetAttributeVec3d()

void vsp::SetAttributeVec3d ( const string & attrID,
const vector< vec3d > value )
extern

Set the Vec3d value of a Vec3d-type Attribute by ID

//==== Attribute: SetAttributeVec3d =====//
string VehID = GetVehicleID();
string CollID = GetChildCollection( VehID );
vec3d InitVal = vec3d( 1., 0.5, -4. );
string AttrID = AddAttributeVec3d( CollID, "TestVec3dAttr", { InitVal } );
vec3d Vec3dVal = vec3d( 0.5, 0.75, -0.4 );
SetAttributeVec3d( AttrID, {Vec3dVal} );
array < vec3d > @GetVal = GetAttributeVec3dVal( AttrID );
if ( GetVal[0].x() == Vec3dVal.x() and GetVal[0].y() == Vec3dVal.y() and GetVal[0].z() == Vec3dVal.z() )
{
Print( "Set matching Vec3d Value from Attribute" );
}
else
{
Print( "SetAttributeVec3dVal error!" );
__failure++;
}
void SetAttributeVec3d(const string &attrID, const vector< vec3d > value)
Parameters
[in]attrIDstring of attribute ID
[in]valuevec3d value for attribute

◆ SummarizeAttributes()

string vsp::SummarizeAttributes ( )
extern

Print a tab-delimited summary of all Attributes in the vehicle, denoting Name, Type, Data, Description, and path from Root of vehicle to Attribute

//==== Attributes: SummarizeAttributes ====//
string SummaryText = SummarizeAttributes();
Print( SummaryText );
string SummarizeAttributes()
Returns
Tab-delimited summary of all Attributes in vehicle

◆ SummarizeAttributesAsTree()

string vsp::SummarizeAttributesAsTree ( )
extern

Print a plain-text tree summary of all Attribute in the vehicle, each branch node showing the name and ID of the VSP object in the path to the attribute

//==== Attributes: SummarizeAttributesAsTree ====//
string SummaryTextTree = SummarizeAttributesAsTree();
Print( SummaryTextTree );
string SummarizeAttributesAsTree()
Returns
Plain-text attribute tree of vehicle