OpenVSP API Documentation 3.51.3
Loading...
Searching...
No Matches
Parm Link Functions

The following functions are available for the simple Parm Link tool, which drives one Parm from another through an optional offset, scale and limits. See the Advanced Link group for links driven by a script. Click here to return to the main page. More...

Functions

int vsp::GetNumParmLinks ()
std::string vsp::GetParmLinkID (int index)
std::string vsp::GetParmLinkAParm (const std::string &link_id)
std::string vsp::GetParmLinkBParm (const std::string &link_id)
void vsp::SetParmLinkAParm (const std::string &link_id, const std::string &parm_id)
void vsp::SetParmLinkBParm (const std::string &link_id, const std::string &parm_id)
void vsp::DelParmLink (const std::string &link_id)
void vsp::DelAllParmLinks ()
void vsp::SortParmLinksByA ()
void vsp::SortParmLinksByB ()
bool vsp::LinkAllComp (const std::string &parm_a_id, const std::string &parm_b_id)
bool vsp::LinkAllGroup (const std::string &parm_a_id, const std::string &parm_b_id)
bool vsp::GetParmLinkOffsetFlag (const std::string &link_id)
void vsp::SetParmLinkOffsetFlag (const std::string &link_id, bool flag)
bool vsp::GetParmLinkScaleFlag (const std::string &link_id)
void vsp::SetParmLinkScaleFlag (const std::string &link_id, bool flag)
bool vsp::GetParmLinkLowerLimitFlag (const std::string &link_id)
void vsp::SetParmLinkLowerLimitFlag (const std::string &link_id, bool flag)
bool vsp::GetParmLinkUpperLimitFlag (const std::string &link_id)
void vsp::SetParmLinkUpperLimitFlag (const std::string &link_id, bool flag)

Detailed Description

Function Documentation

◆ DelAllParmLinks()

void vsp::DelAllParmLinks ( )
extern

Delete every simple Parm Link in the model. Advanced Links are a separate list and are left alone.

string pod1 = AddGeom( "POD", "" );
string pod2 = AddGeom( "POD", "" );
AddParmLink( GetParm( pod1, "X_Rel_Location", "XForm" ), GetParm( pod2, "X_Rel_Location", "XForm" ) );
AddParmLink( GetParm( pod1, "Y_Rel_Location", "XForm" ), GetParm( pod2, "Y_Rel_Location", "XForm" ) );
AddAdvLink( "ExampleAdvLink" );
if ( GetNumParmLinks() != 0 )
{
Print( "ERROR: DelAllParmLinks left links behind" );
__failure++;
}
if ( GetAdvLinkNames().size() != 1 )
{
Print( "ERROR: DelAllParmLinks removed an advanced link" );
__failure++;
}
std::string AddGeom(const std::string &type, const std::string &parent=std::string())
std::string GetParm(const std::string &geom_id, const std::string &name, const std::string &group)
See also
AddParmLink, DelParmLink

◆ DelParmLink()

void vsp::DelParmLink ( const std::string & link_id)
extern

Delete a single Parm Link

string pod1 = AddGeom( "POD", "" );
string pod2 = AddGeom( "POD", "" );
string first = AddParmLink( GetParm( pod1, "X_Rel_Location", "XForm" ), GetParm( pod2, "X_Rel_Location", "XForm" ) );
string second = AddParmLink( GetParm( pod1, "Y_Rel_Location", "XForm" ), GetParm( pod2, "Y_Rel_Location", "XForm" ) );
DelParmLink( first );
// Only the named link goes.
if ( GetNumParmLinks() != 1 || GetParmLinkID( 0 ) != second )
{
Print( "ERROR: DelParmLink removed the wrong link" );
__failure++;
}
// An ID that is not a link has to be rejected.
DelParmLink( "NOSUCHLINK" );
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: DelParmLink accepted a bad ID" );
__failure++;
}
// That error was raised deliberately, so take it back off the queue.
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
See also
AddParmLink, DelAllParmLinks
Parameters
[in]link_idstring Parm Link ID

◆ GetNumParmLinks()

int vsp::GetNumParmLinks ( )
extern

Get the number of simple Parm Links in the model

string pod1 = AddGeom( "POD", "" );
string pod2 = AddGeom( "POD", "" );
if ( GetNumParmLinks() != 0 )
{
Print( "ERROR: a new model starts with Parm Links" );
__failure++;
}
AddParmLink( GetParm( pod1, "X_Rel_Location", "XForm" ), GetParm( pod2, "X_Rel_Location", "XForm" ) );
AddParmLink( GetParm( pod1, "Y_Rel_Location", "XForm" ), GetParm( pod2, "Y_Rel_Location", "XForm" ) );
if ( GetNumParmLinks() != 2 )
{
Print( "ERROR: GetNumParmLinks did not count both links" );
__failure++;
}
// Every link the count claims has to be findable.
for ( int i = 0; i < GetNumParmLinks(); i++ )
{
if ( GetParmLinkID( i ).length() == 0 )
{
Print( "ERROR: a counted link cannot be found" );
__failure++;
}
}
See also
AddParmLink, GetParmLinkID
Returns
int Number of Parm Links

◆ GetParmLinkAParm()

std::string vsp::GetParmLinkAParm ( const std::string & link_id)
extern

Get the driving Parm of a Parm Link

string pod1 = AddGeom( "POD", "" );
string pod2 = AddGeom( "POD", "" );
string xa = GetParm( pod1, "X_Rel_Location", "XForm" );
string xb = GetParm( pod2, "X_Rel_Location", "XForm" );
string link_id = AddParmLink( xa, xb );
if ( GetParmLinkAParm( link_id ) != xa || GetParmLinkBParm( link_id ) != xb )
{
Print( "ERROR: the link does not report the Parms it was given" );
__failure++;
}
// Pointing A at a different Parm has to take.
string ya = GetParm( pod1, "Y_Rel_Location", "XForm" );
SetParmLinkAParm( link_id, ya );
if ( GetParmLinkAParm( link_id ) != ya )
{
Print( "ERROR: SetParmLinkAParm did not take" );
__failure++;
}
// A Parm that does not exist has to be rejected.
SetParmLinkAParm( link_id, "NOSUCHPARM" );
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: SetParmLinkAParm accepted a bad Parm ID" );
__failure++;
}
// That error was raised deliberately, so take it back off the queue.
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
See also
AddParmLink, GetParmLinkBParm, SetParmLinkAParm
Parameters
[in]link_idstring Parm Link ID
Returns
string Parm ID of the driving Parm

◆ GetParmLinkBParm()

std::string vsp::GetParmLinkBParm ( const std::string & link_id)
extern

Get the driven Parm of a Parm Link

string pod1 = AddGeom( "POD", "" );
string pod2 = AddGeom( "POD", "" );
string xa = GetParm( pod1, "X_Rel_Location", "XForm" );
string xb = GetParm( pod2, "X_Rel_Location", "XForm" );
string link_id = AddParmLink( xa, xb );
if ( GetParmLinkBParm( link_id ) != xb )
{
Print( "ERROR: GetParmLinkBParm did not report the driven Parm" );
__failure++;
}
// The two ends are different Parms.
if ( GetParmLinkBParm( link_id ) == GetParmLinkAParm( link_id ) )
{
Print( "ERROR: both ends of the link report the same Parm" );
__failure++;
}
See also
AddParmLink, GetParmLinkAParm, SetParmLinkBParm
Parameters
[in]link_idstring Parm Link ID
Returns
string Parm ID of the driven Parm

◆ GetParmLinkID()

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

Get the ID of the Parm Link at the specified index

string pod1 = AddGeom( "POD", "" );
string pod2 = AddGeom( "POD", "" );
string first = AddParmLink( GetParm( pod1, "X_Rel_Location", "XForm" ), GetParm( pod2, "X_Rel_Location", "XForm" ) );
string second = AddParmLink( GetParm( pod1, "Y_Rel_Location", "XForm" ), GetParm( pod2, "Y_Rel_Location", "XForm" ) );
// Links come back in the order they were added.
if ( GetParmLinkID( 0 ) != first || GetParmLinkID( 1 ) != second )
{
Print( "ERROR: GetParmLinkID did not report the links in order" );
__failure++;
}
// An index past the end has to be rejected.
if ( GetNumTotalErrors() == 0 )
{
Print( "ERROR: GetParmLinkID accepted an index past the end" );
__failure++;
}
// That error was raised deliberately, so take it back off the queue.
while ( GetNumTotalErrors() > 0 )
{
ErrorObj err = PopLastError();
}
See also
AddParmLink, GetNumParmLinks
Parameters
[in]indexint Parm Link index
Returns
string Parm Link ID

◆ GetParmLinkLowerLimitFlag()

bool vsp::GetParmLinkLowerLimitFlag ( const std::string & link_id)
extern

Get whether a Parm Link applies its lower limit

string pod1 = AddGeom( "POD", "" );
string pod2 = AddGeom( "POD", "" );
string xa = GetParm( pod1, "X_Rel_Location", "XForm" );
string xb = GetParm( pod2, "X_Rel_Location", "XForm" );
string link_id = AddParmLink( xa, xb );
// A new link comes up with its offset on and the rest off.
if ( GetParmLinkLowerLimitFlag( link_id ) != false )
{
Print( "ERROR: the lower limit flag did not start where a new link starts" );
__failure++;
}
if ( GetParmLinkLowerLimitFlag( link_id ) == false )
{
Print( "ERROR: GetParmLinkLowerLimitFlag did not follow the setter" );
__failure++;
}
See also
SetParmLinkLowerLimitFlag, AddParmLink
Parameters
[in]link_idstring Parm Link ID
Returns
bool True if the lower limit is applied

◆ GetParmLinkOffsetFlag()

bool vsp::GetParmLinkOffsetFlag ( const std::string & link_id)
extern

Get whether a Parm Link applies its offset

string pod1 = AddGeom( "POD", "" );
string pod2 = AddGeom( "POD", "" );
string xa = GetParm( pod1, "X_Rel_Location", "XForm" );
string xb = GetParm( pod2, "X_Rel_Location", "XForm" );
string link_id = AddParmLink( xa, xb );
// A new link comes up with its offset on and the rest off.
if ( GetParmLinkOffsetFlag( link_id ) != true )
{
Print( "ERROR: the offset flag did not start where a new link starts" );
__failure++;
}
if ( GetParmLinkOffsetFlag( link_id ) == true )
{
Print( "ERROR: GetParmLinkOffsetFlag did not follow the setter" );
__failure++;
}
See also
SetParmLinkOffsetFlag, AddParmLink
Parameters
[in]link_idstring Parm Link ID
Returns
bool True if the offset is applied

◆ GetParmLinkScaleFlag()

bool vsp::GetParmLinkScaleFlag ( const std::string & link_id)
extern

Get whether a Parm Link applies its scale

string pod1 = AddGeom( "POD", "" );
string pod2 = AddGeom( "POD", "" );
string xa = GetParm( pod1, "X_Rel_Location", "XForm" );
string xb = GetParm( pod2, "X_Rel_Location", "XForm" );
string link_id = AddParmLink( xa, xb );
// A new link comes up with its offset on and the rest off.
if ( GetParmLinkScaleFlag( link_id ) != false )
{
Print( "ERROR: the scale flag did not start where a new link starts" );
__failure++;
}
if ( GetParmLinkScaleFlag( link_id ) == false )
{
Print( "ERROR: GetParmLinkScaleFlag did not follow the setter" );
__failure++;
}
See also
SetParmLinkScaleFlag, AddParmLink
Parameters
[in]link_idstring Parm Link ID
Returns
bool True if the scale is applied

◆ GetParmLinkUpperLimitFlag()

bool vsp::GetParmLinkUpperLimitFlag ( const std::string & link_id)
extern

Get whether a Parm Link applies its upper limit

string pod1 = AddGeom( "POD", "" );
string pod2 = AddGeom( "POD", "" );
string xa = GetParm( pod1, "X_Rel_Location", "XForm" );
string xb = GetParm( pod2, "X_Rel_Location", "XForm" );
string link_id = AddParmLink( xa, xb );
// A new link comes up with its offset on and the rest off.
if ( GetParmLinkUpperLimitFlag( link_id ) != false )
{
Print( "ERROR: the upper limit flag did not start where a new link starts" );
__failure++;
}
if ( GetParmLinkUpperLimitFlag( link_id ) == false )
{
Print( "ERROR: GetParmLinkUpperLimitFlag did not follow the setter" );
__failure++;
}
See also
SetParmLinkUpperLimitFlag, AddParmLink
Parameters
[in]link_idstring Parm Link ID
Returns
bool True if the upper limit is applied

◆ LinkAllComp()

bool vsp::LinkAllComp ( const std::string & parm_a_id,
const std::string & parm_b_id )
extern

Link every Parm of the container holding the first Parm to the matching Parm of the container holding the second. This is the Link screen's "Link All Comp" button.

string pod1 = AddGeom( "POD", "" );
string pod2 = AddGeom( "POD", "" );
LinkAllComp( GetParm( pod1, "X_Rel_Location", "XForm" ), GetParm( pod2, "X_Rel_Location", "XForm" ) );
// A Pod carries many Parms, so this makes many links at once.
if ( GetNumParmLinks() < 2 )
{
Print( "ERROR: LinkAllComp did not link the containers" );
__failure++;
}
// Every link it made joins two real Parms.
for ( int i = 0; i < GetNumParmLinks(); i++ )
{
string lid = GetParmLinkID( i );
if ( GetParmLinkAParm( lid ).length() == 0 || GetParmLinkBParm( lid ).length() == 0 )
{
Print( "ERROR: LinkAllComp made a link with no Parms" );
__failure++;
}
}
See also
AddParmLink, LinkAllGroup
Parameters
[in]parm_a_idstring Parm ID naming the driving container
[in]parm_b_idstring Parm ID naming the driven container
Returns
bool True if any link was made

◆ LinkAllGroup()

bool vsp::LinkAllGroup ( const std::string & parm_a_id,
const std::string & parm_b_id )
extern

Link every Parm of the group holding the first Parm to the matching Parm of the group holding the second. This is the Link screen's "Link All Group" button.

string pod1 = AddGeom( "POD", "" );
string pod2 = AddGeom( "POD", "" );
LinkAllGroup( GetParm( pod1, "X_Rel_Location", "XForm" ), GetParm( pod2, "X_Rel_Location", "XForm" ) );
// The XForm group carries several Parms, so this makes several links.
int num_group = GetNumParmLinks();
if ( num_group < 2 )
{
Print( "ERROR: LinkAllGroup did not link the groups" );
__failure++;
}
// A group is part of the container, so linking the whole container makes at
// least as many links.
LinkAllComp( GetParm( pod1, "X_Rel_Location", "XForm" ), GetParm( pod2, "X_Rel_Location", "XForm" ) );
if ( GetNumParmLinks() < num_group )
{
Print( "ERROR: LinkAllGroup linked more than LinkAllComp" );
__failure++;
}
See also
AddParmLink, LinkAllComp
Parameters
[in]parm_a_idstring Parm ID naming the driving group
[in]parm_b_idstring Parm ID naming the driven group
Returns
bool True if any link was made

◆ SetParmLinkAParm()

void vsp::SetParmLinkAParm ( const std::string & link_id,
const std::string & parm_id )
extern

Set the driving Parm of a Parm Link

string pod1 = AddGeom( "POD", "" );
string pod2 = AddGeom( "POD", "" );
string xa = GetParm( pod1, "X_Rel_Location", "XForm" );
string xb = GetParm( pod2, "X_Rel_Location", "XForm" );
string link_id = AddParmLink( xa, xb );
string ya = GetParm( pod1, "Y_Rel_Location", "XForm" );
SetParmLinkAParm( link_id, ya );
if ( GetParmLinkAParm( link_id ) != ya )
{
Print( "ERROR: SetParmLinkAParm did not take" );
__failure++;
}
// The driven end is left alone.
if ( GetParmLinkBParm( link_id ) != xb )
{
Print( "ERROR: SetParmLinkAParm disturbed the driven Parm" );
__failure++;
}
See also
AddParmLink, GetParmLinkAParm
Parameters
[in]link_idstring Parm Link ID
[in]parm_idstring Parm ID of the driving Parm

◆ SetParmLinkBParm()

void vsp::SetParmLinkBParm ( const std::string & link_id,
const std::string & parm_id )
extern

Set the driven Parm of a Parm Link

string pod1 = AddGeom( "POD", "" );
string pod2 = AddGeom( "POD", "" );
string xa = GetParm( pod1, "X_Rel_Location", "XForm" );
string xb = GetParm( pod2, "X_Rel_Location", "XForm" );
string link_id = AddParmLink( xa, xb );
string yb = GetParm( pod2, "Y_Rel_Location", "XForm" );
SetParmLinkBParm( link_id, yb );
if ( GetParmLinkBParm( link_id ) != yb )
{
Print( "ERROR: SetParmLinkBParm did not take" );
__failure++;
}
// The driving end is left alone.
if ( GetParmLinkAParm( link_id ) != xa )
{
Print( "ERROR: SetParmLinkBParm disturbed the driving Parm" );
__failure++;
}
See also
AddParmLink, GetParmLinkBParm
Parameters
[in]link_idstring Parm Link ID
[in]parm_idstring Parm ID of the driven Parm

◆ SetParmLinkLowerLimitFlag()

void vsp::SetParmLinkLowerLimitFlag ( const std::string & link_id,
bool flag )
extern

Set whether a Parm Link applies its lower limit. The value itself is the link's LowerLimit Parm, reached with FindParm on the link ID.

string pod1 = AddGeom( "POD", "" );
string pod2 = AddGeom( "POD", "" );
string link_id = AddParmLink( GetParm( pod1, "X_Rel_Location", "XForm" ), GetParm( pod2, "X_Rel_Location", "XForm" ) );
SetParmLinkLowerLimitFlag( link_id, true );
if ( !GetParmLinkLowerLimitFlag( link_id ) )
{
Print( "ERROR: the lower limit flag did not take" );
__failure++;
}
SetParmLinkLowerLimitFlag( link_id, false );
if ( GetParmLinkLowerLimitFlag( link_id ) )
{
Print( "ERROR: the lower limit flag did not clear" );
__failure++;
}
// The value it applies is a Parm on the link itself.
if ( FindParm( link_id, "LowerLimit", "Link" ).length() == 0 )
{
Print( "ERROR: the link carries no LowerLimit Parm" );
__failure++;
}
std::string FindParm(const std::string &parm_container_id, const std::string &parm_name, const std::string &group_name)
See also
GetParmLinkLowerLimitFlag, AddParmLink
Parameters
[in]link_idstring Parm Link ID
[in]flagbool True to apply the lower limit

◆ SetParmLinkOffsetFlag()

void vsp::SetParmLinkOffsetFlag ( const std::string & link_id,
bool flag )
extern

Set whether a Parm Link applies its offset. The value itself is the link's Offset Parm, reached with FindParm on the link ID.

string pod1 = AddGeom( "POD", "" );
string pod2 = AddGeom( "POD", "" );
string link_id = AddParmLink( GetParm( pod1, "X_Rel_Location", "XForm" ), GetParm( pod2, "X_Rel_Location", "XForm" ) );
SetParmLinkOffsetFlag( link_id, true );
if ( !GetParmLinkOffsetFlag( link_id ) )
{
Print( "ERROR: the offset flag did not take" );
__failure++;
}
SetParmLinkOffsetFlag( link_id, false );
if ( GetParmLinkOffsetFlag( link_id ) )
{
Print( "ERROR: the offset flag did not clear" );
__failure++;
}
// The value it applies is a Parm on the link itself.
if ( FindParm( link_id, "Offset", "Link" ).length() == 0 )
{
Print( "ERROR: the link carries no Offset Parm" );
__failure++;
}
See also
GetParmLinkOffsetFlag, AddParmLink
Parameters
[in]link_idstring Parm Link ID
[in]flagbool True to apply the offset

◆ SetParmLinkScaleFlag()

void vsp::SetParmLinkScaleFlag ( const std::string & link_id,
bool flag )
extern

Set whether a Parm Link applies its scale. The value itself is the link's Scale Parm, reached with FindParm on the link ID.

string pod1 = AddGeom( "POD", "" );
string pod2 = AddGeom( "POD", "" );
string link_id = AddParmLink( GetParm( pod1, "X_Rel_Location", "XForm" ), GetParm( pod2, "X_Rel_Location", "XForm" ) );
SetParmLinkScaleFlag( link_id, true );
if ( !GetParmLinkScaleFlag( link_id ) )
{
Print( "ERROR: the scale flag did not take" );
__failure++;
}
SetParmLinkScaleFlag( link_id, false );
if ( GetParmLinkScaleFlag( link_id ) )
{
Print( "ERROR: the scale flag did not clear" );
__failure++;
}
// The value it applies is a Parm on the link itself.
if ( FindParm( link_id, "Scale", "Link" ).length() == 0 )
{
Print( "ERROR: the link carries no Scale Parm" );
__failure++;
}
See also
GetParmLinkScaleFlag, AddParmLink
Parameters
[in]link_idstring Parm Link ID
[in]flagbool True to apply the scale

◆ SetParmLinkUpperLimitFlag()

void vsp::SetParmLinkUpperLimitFlag ( const std::string & link_id,
bool flag )
extern

Set whether a Parm Link applies its upper limit. The value itself is the link's UpperLimit Parm, reached with FindParm on the link ID.

string pod1 = AddGeom( "POD", "" );
string pod2 = AddGeom( "POD", "" );
string link_id = AddParmLink( GetParm( pod1, "X_Rel_Location", "XForm" ), GetParm( pod2, "X_Rel_Location", "XForm" ) );
SetParmLinkUpperLimitFlag( link_id, true );
if ( !GetParmLinkUpperLimitFlag( link_id ) )
{
Print( "ERROR: the upper limit flag did not take" );
__failure++;
}
SetParmLinkUpperLimitFlag( link_id, false );
if ( GetParmLinkUpperLimitFlag( link_id ) )
{
Print( "ERROR: the upper limit flag did not clear" );
__failure++;
}
// The value it applies is a Parm on the link itself.
if ( FindParm( link_id, "UpperLimit", "Link" ).length() == 0 )
{
Print( "ERROR: the link carries no UpperLimit Parm" );
__failure++;
}
See also
GetParmLinkUpperLimitFlag, AddParmLink
Parameters
[in]link_idstring Parm Link ID
[in]flagbool True to apply the upper limit

◆ SortParmLinksByA()

void vsp::SortParmLinksByA ( )
extern

Sort the Parm links by the Parm each one reads from, ordering on container name, then group name, then Parm name. This is the Sort A button on the Parm Link screen.

string pod = AddGeom( "POD", "" );
string length = FindParm( pod, "Length", "Design" );
string fine = FindParm( pod, "FineRatio", "Design" );
string x_pos = FindParm( pod, "X_Rel_Location", "XForm" );
string y_pos = FindParm( pod, "Y_Rel_Location", "XForm" );
// Add the links out of order, reading from Length first.
string link1 = AddParmLink( length, x_pos );
string link2 = AddParmLink( fine, y_pos );
// FineRatio sorts ahead of Length, so its link comes first.
if ( GetParmLinkID( 0 ) != link2 )
{
Print( "ERROR: SortParmLinksByA did not sort the links" );
__failure++;
}
See also
SortParmLinksByB, AddParmLink

◆ SortParmLinksByB()

void vsp::SortParmLinksByB ( )
extern

Sort the Parm links by the Parm each one drives, ordering on container name, then group name, then Parm name. This is the Sort B button on the Parm Link screen.

string pod = AddGeom( "POD", "" );
string length = FindParm( pod, "Length", "Design" );
string fine = FindParm( pod, "FineRatio", "Design" );
string x_pos = FindParm( pod, "X_Rel_Location", "XForm" );
string y_pos = FindParm( pod, "Y_Rel_Location", "XForm" );
// Add the links so that the one driving Y_Rel_Location comes first.
string link1 = AddParmLink( length, y_pos );
string link2 = AddParmLink( fine, x_pos );
// X_Rel_Location sorts ahead of Y_Rel_Location, so its link comes first.
if ( GetParmLinkID( 0 ) != link2 )
{
Print( "ERROR: SortParmLinksByB did not sort the links" );
__failure++;
}
See also
SortParmLinksByA, AddParmLink