OpenVSP API Documentation 3.41.2
 
Loading...
Searching...
No Matches
Advanced Link Functions

The following functions are available for the Advanced Link tool. Click here to return to the main page. More...

Functions

std::vector< std::string > vsp::GetAdvLinkNames ()
 
int vsp::GetLinkIndex (const string &name)
 
void vsp::DelAdvLink (int index)
 
void vsp::DelAllAdvLinks ()
 
void vsp::AddAdvLink (const string &name)
 
void vsp::AddAdvLinkInput (int index, const string &parm_id, const string &var_name)
 
void vsp::AddAdvLinkOutput (int index, const string &parm_id, const string &var_name)
 
void vsp::DelAdvLinkInput (int index, const string &var_name)
 
void vsp::DelAdvLinkOutput (int index, const string &var_name)
 
std::vector< std::string > vsp::GetAdvLinkInputNames (int index)
 
std::vector< std::string > vsp::GetAdvLinkInputParms (int index)
 
std::vector< std::string > vsp::GetAdvLinkOutputNames (int index)
 
std::vector< std::string > vsp::GetAdvLinkOutputParms (int index)
 
bool vsp::ValidateAdvLinkParms (int index)
 
void vsp::SetAdvLinkCode (int index, const string &code)
 
std::string vsp::GetAdvLinkCode (int index)
 
void vsp::SearchReplaceAdvLinkCode (int index, const string &from, const string &to)
 
bool vsp::BuildAdvLinkScript (int index)
 

Detailed Description

Function Documentation

◆ AddAdvLink()

void vsp::AddAdvLink ( const string & name)
extern

Add an advanced link

string pod = AddGeom( "POD", "" );
string length = FindParm( pod, "Length", "Design" );
string x_pos = GetParm( pod, "X_Rel_Location", "XForm" );
AddAdvLink( "ExampleLink" );
int indx = GetLinkIndex( "ExampleLink" );
AddAdvLinkInput( indx, length, "len" );
AddAdvLinkOutput( indx, x_pos, "x" );
SetAdvLinkCode( indx, "x = 10.0 - len;" );
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)
std::string GetParm(const std::string &geom_id, const std::string &name, const std::string &group)
Parameters
[in]namestring Name for advanced link

◆ AddAdvLinkInput()

void vsp::AddAdvLinkInput ( int index,
const string & parm_id,
const string & var_name )
extern

Add an input variable to an advanced link

string pod = AddGeom( "POD", "" );
string length = FindParm( pod, "Length", "Design" );
string x_pos = GetParm( pod, "X_Rel_Location", "XForm" );
AddAdvLink( "ExampleLink" );
int indx = GetLinkIndex( "ExampleLink" );
AddAdvLinkInput( indx, length, "len" );
AddAdvLinkOutput( indx, x_pos, "x" );
SetAdvLinkCode( indx, "x = 10.0 - len;" );
Parameters
[in]indexint Advanced link index
[in]parm_idstring Parameter ID for advanced link input variable
[in]var_namestring Name for advanced link input variable

◆ AddAdvLinkOutput()

void vsp::AddAdvLinkOutput ( int index,
const string & parm_id,
const string & var_name )
extern

Add an output variable to an advanced link

string pod = AddGeom( "POD", "" );
string length = FindParm( pod, "Length", "Design" );
string x_pos = GetParm( pod, "X_Rel_Location", "XForm" );
AddAdvLink( "ExampleLink" );
int indx = GetLinkIndex( "ExampleLink" );
AddAdvLinkInput( indx, length, "len" );
AddAdvLinkOutput( indx, x_pos, "x" );
SetAdvLinkCode( indx, "x = 10.0 - len;" );
Parameters
[in]indexint Advanced link index
[in]parm_idstring Parameter ID for advanced link output variable
[in]var_namestring Name for advanced link output variable

◆ BuildAdvLinkScript()

bool vsp::BuildAdvLinkScript ( int index)
extern

Build (ready for execution and perform syntax check) an advanced link.

string pod = AddGeom( "POD", "" );
string length = FindParm( pod, "Length", "Design" );
string x_pos = GetParm( pod, "X_Rel_Location", "XForm" );
AddAdvLink( "ExampleLink" );
int indx = GetLinkIndex( "ExampleLink" );
AddAdvLinkInput( indx, length, "len" );
AddAdvLinkOutput( indx, x_pos, "x" );
SetAdvLinkCode( indx, "x = 10.0 - len;" );
bool success = BuildAdvLinkScript( indx );
if ( success )
{
Print( "Advanced link build successful." );
}
else
{
Print( "Advanced link build not successful." );
}
Parameters
[in]indexint Index for advanced link
Returns
Flag indicating whether advanced link build was successful

◆ DelAdvLink()

void vsp::DelAdvLink ( int index)
extern

Delete an advanced link specified by index

string pod = AddGeom( "POD", "" );
string length = FindParm( pod, "Length", "Design" );
string x_pos = GetParm( pod, "X_Rel_Location", "XForm" );
AddAdvLink( "ExampleLink" );
int indx = GetLinkIndex( "ExampleLink" );
AddAdvLinkInput( indx, length, "len" );
AddAdvLinkOutput( indx, x_pos, "x" );
SetAdvLinkCode( indx, "x = 10.0 - len;" );
DelAdvLink( indx );
array< string > @link_array = GetAdvLinkNames();
// Should print nothing.
for( int n = 0 ; n < int( link_array.length() ) ; n++ )
{
Print( link_array[n] );
}
Parameters
[in]indexIndex for advanced link

◆ DelAdvLinkInput()

void vsp::DelAdvLinkInput ( int index,
const string & var_name )
extern

Delete an input variable from an advanced link

string pod = AddGeom( "POD", "" );
string length = FindParm( pod, "Length", "Design" );
string x_pos = GetParm( pod, "X_Rel_Location", "XForm" );
string y_pos = GetParm( pod, "Y_Rel_Location", "XForm" );
AddAdvLink( "ExampleLink" );
int indx = GetLinkIndex( "ExampleLink" );
AddAdvLinkInput( indx, length, "len" );
AddAdvLinkOutput( indx, x_pos, "x" );
AddAdvLinkInput( indx, y_pos, "y" );
SetAdvLinkCode( indx, "x = 10.0 - len;" );
DelAdvLinkInput( indx, "y" );
Parameters
[in]indexint Advanced link index
[in]var_namestring Name for advanced link input variable to delete

◆ DelAdvLinkOutput()

void vsp::DelAdvLinkOutput ( int index,
const string & var_name )
extern

Delete an output variable from an advanced link

string pod = AddGeom( "POD", "" );
string length = FindParm( pod, "Length", "Design" );
string x_pos = GetParm( pod, "X_Rel_Location", "XForm" );
string y_pos = GetParm( pod, "Y_Rel_Location", "XForm" );
AddAdvLink( "ExampleLink" );
int indx = GetLinkIndex( "ExampleLink" );
AddAdvLinkInput( indx, length, "len" );
AddAdvLinkOutput( indx, x_pos, "x" );
AddAdvLinkOutput( indx, y_pos, "y" );
SetAdvLinkCode( indx, "x = 10.0 - len;" );
DelAdvLinkOutput( indx, "y" );
Parameters
[in]indexint Advanced link index
[in]var_namestring Name for advanced link output variable to delete

◆ DelAllAdvLinks()

void vsp::DelAllAdvLinks ( )
extern

Delete all advanced links

string pod = AddGeom( "POD", "" );
string length = FindParm( pod, "Length", "Design" );
string x_pos = GetParm( pod, "X_Rel_Location", "XForm" );
AddAdvLink( "ExampleLink" );
int indx = GetLinkIndex( "ExampleLink" );
AddAdvLinkInput( indx, length, "len" );
AddAdvLinkOutput( indx, x_pos, "x" );
SetAdvLinkCode( indx, "x = 10.0 - len;" );
array< string > @link_array = GetAdvLinkNames();
// Should print nothing.
for( int n = 0 ; n < int( link_array.length() ) ; n++ )
{
Print( link_array[n] );
}

◆ GetAdvLinkCode()

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

Get the code from an advanced link

string pod = AddGeom( "POD", "" );
string length = FindParm( pod, "Length", "Design" );
string x_pos = GetParm( pod, "X_Rel_Location", "XForm" );
AddAdvLink( "ExampleLink" );
int indx = GetLinkIndex( "ExampleLink" );
AddAdvLinkInput( indx, length, "len" );
AddAdvLinkOutput( indx, x_pos, "x" );
SetAdvLinkCode( indx, "x = 10.0 - len;" );
string code = GetAdvLinkCode( indx );
Print( code );
Parameters
[in]indexint Index for advanced link
Returns
String containing advanced link code

◆ GetAdvLinkInputNames()

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

Get the name of all the inputs to a specified advanced link index

string pod = AddGeom( "POD", "" );
string length = FindParm( pod, "Length", "Design" );
string x_pos = GetParm( pod, "X_Rel_Location", "XForm" );
AddAdvLink( "ExampleLink" );
int indx = GetLinkIndex( "ExampleLink" );
AddAdvLinkInput( indx, length, "len" );
AddAdvLinkOutput( indx, x_pos, "x" );
SetAdvLinkCode( indx, "x = 10.0 - len;" );
array< string > @name_array = GetAdvLinkInputNames( indx );
for( int n = 0 ; n < int( name_array.length() ) ; n++ )
{
Print( name_array[n] );
}
Parameters
[in]indexint Advanced link index
Returns
Array of advanced link input names

◆ GetAdvLinkInputParms()

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

Get the Parm IDs of all the inputs to a specified advanced link index

string pod = AddGeom( "POD", "" );
string length = FindParm( pod, "Length", "Design" );
string x_pos = GetParm( pod, "X_Rel_Location", "XForm" );
AddAdvLink( "ExampleLink" );
int indx = GetLinkIndex( "ExampleLink" );
AddAdvLinkInput( indx, length, "len" );
AddAdvLinkOutput( indx, x_pos, "x" );
SetAdvLinkCode( indx, "x = 10.0 - len;" );
array< string > @parm_array = GetAdvLinkInputParms( indx );
for( int n = 0 ; n < int( parm_array.length() ) ; n++ )
{
Print( parm_array[n] );
}
Parameters
[in]indexint Advanced link index
Returns
Array of advanced link input Parm IDs

◆ GetAdvLinkNames()

std::vector< std::string > vsp::GetAdvLinkNames ( )
extern

Get an array of all advanced link names

array< string > @link_array = GetAdvLinkNames();
for( int n = 0 ; n < int( link_array.length() ) ; n++ )
{
Print( link_array[n] );
}
Returns
Array of advanced link names

◆ GetAdvLinkOutputNames()

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

Get the Parm IDs of all the outputs to a specified advanced link index

string pod = AddGeom( "POD", "" );
string length = FindParm( pod, "Length", "Design" );
string x_pos = GetParm( pod, "X_Rel_Location", "XForm" );
AddAdvLink( "ExampleLink" );
int indx = GetLinkIndex( "ExampleLink" );
AddAdvLinkInput( indx, length, "len" );
AddAdvLinkOutput( indx, x_pos, "x" );
SetAdvLinkCode( indx, "x = 10.0 - len;" );
array< string > @name_array = GetAdvLinkOutputNames( indx );
for( int n = 0 ; n < int( name_array.length() ) ; n++ )
{
Print( name_array[n] );
}
Parameters
[in]indexint Advanced link index
Returns
Array of advanced link output names

◆ GetAdvLinkOutputParms()

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

Get the Parm IDs of all the outputs to a specified advanced link index

string pod = AddGeom( "POD", "" );
string length = FindParm( pod, "Length", "Design" );
string x_pos = GetParm( pod, "X_Rel_Location", "XForm" );
AddAdvLink( "ExampleLink" );
int indx = GetLinkIndex( "ExampleLink" );
AddAdvLinkInput( indx, length, "len" );
AddAdvLinkOutput( indx, x_pos, "x" );
SetAdvLinkCode( indx, "x = 10.0 - len;" );
array< string > @parm_array = GetAdvLinkOutputParms( indx );
for( int n = 0 ; n < int( parm_array.length() ) ; n++ )
{
Print( parm_array[n] );
}
Parameters
[in]indexint Advanced link index
Returns
Array of advanced link output Parm IDs

◆ GetLinkIndex()

int vsp::GetLinkIndex ( const string & name)
extern

Find the index of a specific advanced link.

string pod = AddGeom( "POD", "" );
string length = FindParm( pod, "Length", "Design" );
string x_pos = GetParm( pod, "X_Rel_Location", "XForm" );
AddAdvLink( "ExampleLink" );
int indx = GetLinkIndex( "ExampleLink" );
AddAdvLinkInput( indx, length, "len" );
AddAdvLinkOutput( indx, x_pos, "x" );
SetAdvLinkCode( indx, "x = 10.0 - len;" );
Parameters
[in]namestring Name for advanced link
Returns
index for advanced link

◆ SearchReplaceAdvLinkCode()

void vsp::SearchReplaceAdvLinkCode ( int index,
const string & from,
const string & to )
extern

Search and replace strings in the advanced link code

string pod = AddGeom( "POD", "" );
string length = FindParm( pod, "Length", "Design" );
string x_pos = GetParm( pod, "X_Rel_Location", "XForm" );
AddAdvLink( "ExampleLink" );
int indx = GetLinkIndex( "ExampleLink" );
AddAdvLinkInput( indx, length, "len" );
AddAdvLinkOutput( indx, x_pos, "x" );
SetAdvLinkCode( indx, "x = 10.0 - len;" );
SearchReplaceAdvLinkCode( indx, "10.0", "12.3" );
string code = GetAdvLinkCode( indx );
Print( code );
Parameters
[in]indexint Index for advanced link
[in]fromstring Search token
[in]tostring Replace token

◆ SetAdvLinkCode()

void vsp::SetAdvLinkCode ( int index,
const string & code )
extern

Get the code from an advanced link

string pod = AddGeom( "POD", "" );
string length = FindParm( pod, "Length", "Design" );
string x_pos = GetParm( pod, "X_Rel_Location", "XForm" );
AddAdvLink( "ExampleLink" );
int indx = GetLinkIndex( "ExampleLink" );
AddAdvLinkInput( indx, length, "len" );
AddAdvLinkOutput( indx, x_pos, "x" );
SetAdvLinkCode( indx, "x = 10.0 - len;" );
Parameters
[in]indexint Index for advanced link
[in]codestring Code for advanced link

◆ ValidateAdvLinkParms()

bool vsp::ValidateAdvLinkParms ( int index)
extern

Validate the input and output parameters for an advanced link

string pod = AddGeom( "POD", "" );
string length = FindParm( pod, "Length", "Design" );
string x_pos = GetParm( pod, "X_Rel_Location", "XForm" );
AddAdvLink( "ExampleLink" );
int indx = GetLinkIndex( "ExampleLink" );
AddAdvLinkInput( indx, length, "len" );
AddAdvLinkOutput( indx, x_pos, "x" );
SetAdvLinkCode( indx, "x = 10.0 - len;" );
bool valid = ValidateAdvLinkParms( indx );
if ( valid )
{
Print( "Advanced link Parms are valid." );
}
else
{
Print( "Advanced link Parms are not valid." );
}
Parameters
[in]indexint Index for advanced link
Returns
Flag indicating whether parms are valid