OpenVSPAPI  3.36.0
Functions
Advanced Link Functions

The following functions are available for the Advanced Link tool.

Click here to return to the main page. More...

Functions

string[] GetAdvLinkNames ()
 
int GetLinkIndex (const string &in name)
 
void DelAdvLink (int index)
 
void DelAllAdvLinks ()
 
void AddAdvLink (const string &in name)
 
void AddAdvLinkInput (int index, const string &in parm_id, const string &in var_name)
 
void AddAdvLinkOutput (int index, const string &in parm_id, const string &in var_name)
 
void DelAdvLinkInput (int index, const string &in var_name)
 
void DelAdvLinkOutput (int index, const string &in var_name)
 
string[] GetAdvLinkInputNames (int index)
 
string[] GetAdvLinkInputParms (int index)
 
string[] GetAdvLinkOutputNames (int index)
 
string[] GetAdvLinkOutputParms (int index)
 
bool ValidateAdvLinkParms (int index)
 
void SetAdvLinkCode (int index, const string &in code)
 
string GetAdvLinkCode (int index)
 
void SearchReplaceAdvLinkCode (int index, const string &in from, const string &in to)
 
bool BuildAdvLinkScript (int index)
 
void SetVar (const string &in var_name, double val)
 
double GetVar (const string &in var_name)
 

Detailed Description

Function Documentation

◆ AddAdvLink()

void AddAdvLink ( const string &in  name)

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;" );
Parameters
[in]stringName for advanced link

◆ AddAdvLinkInput()

void AddAdvLinkInput ( int  index,
const string &in  parm_id,
const string &in  var_name 
)

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]intAdvanced link index
[in]stringparm_id for advanced link input variable
[in]stringname for advanced link input variable

◆ AddAdvLinkOutput()

void AddAdvLinkOutput ( int  index,
const string &in  parm_id,
const string &in  var_name 
)

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]intAdvanced link index
[in]stringparm_id for advanced link output variable
[in]stringname for advanced link output variable

◆ BuildAdvLinkScript()

bool BuildAdvLinkScript ( int  index)

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]indexIndex for advanced link
Returns
Flag indicating whether advanced link build was successful

◆ DelAdvLink()

void DelAdvLink ( int  index)

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 );
// 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 DelAdvLinkInput ( int  index,
const string &in  var_name 
)

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]intAdvanced link index
[in]stringname for advanced link input variable to delete

◆ DelAdvLinkOutput()

void DelAdvLinkOutput ( int  index,
const string &in  var_name 
)

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]intAdvanced link index
[in]stringname for advanced link output variable to delete

◆ DelAllAdvLinks()

void DelAllAdvLinks ( )

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;" );
// Should print nothing.
for( int n = 0 ; n < int( link_array.length() ) ; n++ )
{
Print( link_array[n] );
}

◆ GetAdvLinkCode()

string GetAdvLinkCode ( int  index)

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]indexIndex for advanced link
Returns
String containing advanced link code

◆ GetAdvLinkInputNames()

string [] GetAdvLinkInputNames ( int  index)

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]indexAdvanced link index
Returns
Array of advanced link input names

◆ GetAdvLinkInputParms()

string [] GetAdvLinkInputParms ( int  index)

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]indexAdvanced link index
Returns
Array of advanced link input Parm IDs

◆ GetAdvLinkNames()

string [] GetAdvLinkNames ( )

Get an array of all advanced link names

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

◆ GetAdvLinkOutputNames()

string [] GetAdvLinkOutputNames ( int  index)

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]indexAdvanced link index
Returns
Array of advanced link output names

◆ GetAdvLinkOutputParms()

string [] GetAdvLinkOutputParms ( int  index)

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]indexAdvanced link index
Returns
Array of advanced link output Parm IDs

◆ GetLinkIndex()

int GetLinkIndex ( const string &in  name)

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]stringName for advanced link
Returns
index for advanced link

◆ GetVar()

double GetVar ( const string &in  var_name)

This function is used internally by OpenVSP to get an output variable's value from an advanced link script after it completes. This function should never be called by a user.

This function is only available in AngelScript and is not a part of the general API.

Parameters
[in]var_nameAdvanced Link variable name
Returns
Value for the variable

◆ SearchReplaceAdvLinkCode()

void SearchReplaceAdvLinkCode ( int  index,
const string &in  from,
const string &in  to 
)

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]indexIndex for advanced link
[in]stringCode for advanced link

◆ SetAdvLinkCode()

void SetAdvLinkCode ( int  index,
const string &in  code 
)

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]indexIndex for advanced link
[in]stringCode for advanced link

◆ SetVar()

void SetVar ( const string &in  var_name,
double  val 
)

This function is used internally by OpenVSP to pass an input variable's value into an advanced link script before it runs. This function should never be called by a user.

This function is only available in AngelScript and is not a part of the general API.

Parameters
[in]var_nameAdvanced Link variable name
[in]valValue for the variable

◆ ValidateAdvLinkParms()

bool ValidateAdvLinkParms ( int  index)

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]indexIndex for advanced link
Returns
Flag indicating whether parms are valid
FindParm
string FindParm(const string &in parm_container_id, const string &in parm_name, const string &in group_name)
array
AngelScript ScriptExtension for representing the C++ std::vector.
Definition: openvsp_as.h:249
AddGeom
string AddGeom(const string &in type, const string &in parent=string())
Print
void Print(const string &in data, bool new_line=true)
GetParm
string GetParm(const string &in container_id, const string &in name, const string &in group)