OpenVSP API Documentation 3.51.3
Loading...
Searching...
No Matches
Measure Tool Functions

This group of API functions can be used to control the Ruler Tool through the API. Click here to return to the main page. More...

Functions

void vsp::ShowAllRulers ()
void vsp::HideAllRulers ()
void vsp::ShowAllProbes ()
void vsp::HideAllProbes ()
void vsp::ShowAllProtractors ()
void vsp::HideAllProtractors ()
void vsp::ShowAllRSTProbes ()
void vsp::HideAllRSTProbes ()
std::vector< std::string > vsp::GetAllProtractors ()
void vsp::DelProtractor (const std::string &id)
void vsp::DeleteAllProtractors ()
std::string vsp::AddRSTProbe (const std::string &geomid, int surfindx, double r, double s, double t, const std::string &name)
std::vector< std::string > vsp::GetAllRSTProbes ()
void vsp::DelRSTProbe (const std::string &id)
void vsp::DeleteAllRSTProbes ()
std::vector< std::string > vsp::GetAllRulers ()
void vsp::DelRuler (const std::string &id)
void vsp::DeleteAllRulers ()
std::string vsp::AddProbe (const std::string &geomid, int surfindx, double u, double w, const std::string &name)
std::vector< std::string > vsp::GetAllProbes ()
void vsp::DelProbe (const std::string &id)
void vsp::DeleteAllProbes ()

Detailed Description

Function Documentation

◆ AddProbe()

std::string vsp::AddProbe ( const std::string & geomid,
int surfindx,
double u,
double w,
const std::string & name )
extern

Create a new Probe and add it to the Measure Tool

string pid1 = AddGeom( "POD", "" );
SetParmVal( pid1, "Y_Rel_Location", "XForm", 2.0 );
string probe_id = AddProbe( pid1, 0, 0.5, 0.8, "Probe 1" );
SetParmVal( FindParm( probe_id, "Len", "Measure" ), 3.0 );
if ( probe_id.length() == 0 || probe_id == "NONE" )
{
Print( "ERROR: AddProbe returned no id" );
__failure++;
}
std::string AddGeom(const std::string &type, const std::string &parent=std::string())
std::string AddProbe(const std::string &geomid, int surfindx, double u, double w, const std::string &name)
std::string FindParm(const std::string &parm_container_id, const std::string &parm_name, const std::string &group_name)
double SetParmVal(const std::string &parm_id, double val)
Parameters
[in]geomidstring Parent Geom ID
[in]surfindxint Main surface index from the parent Geom
[in]udouble Surface u (0 - 1) coordinate
[in]wdouble Surface w (0 - 1) coordinate
[in]namestring Probe name
Returns
string Probe ID

◆ AddRSTProbe()

std::string vsp::AddRSTProbe ( const std::string & geomid,
int surfindx,
double r,
double s,
double t,
const std::string & name )
extern

Create and add an RST Probe object to the Measure Tool. An RST Probe marks a point in the volume of a Geom rather than on its surface.

string pod1 = AddGeom( "POD", "" );
string pid = AddRSTProbe( pod1, 0, 0.5, 0.5, 0.5, "Example_RSTProbe" );
if ( pid.length() == 0 || pid == "NONE" )
{
Print( "ERROR: AddRSTProbe returned no id" );
__failure++;
}
// The new probe is the only one in the model, and it is not confused with a
// surface probe.
array< string > @probe_array = GetAllRSTProbes();
if ( probe_array.size() != 1 || probe_array[0] != pid )
{
Print( "ERROR: AddRSTProbe did not add the probe" );
__failure++;
}
if ( GetAllProbes().size() != 0 )
{
Print( "ERROR: an RST probe was counted as a surface probe" );
__failure++;
}
if ( GetContainerName( pid ) != "Example_RSTProbe" )
{
Print( "ERROR: AddRSTProbe did not name the probe" );
__failure++;
}
std::vector< std::string > GetAllRSTProbes()
std::string AddRSTProbe(const std::string &geomid, int surfindx, double r, double s, double t, const std::string &name)
std::vector< std::string > GetAllProbes()
See also
GetAllRSTProbes, DelRSTProbe, DeleteAllRSTProbes, AddProbe
Parameters
[in]geomidstring Parent Geom ID
[in]surfindxint Main surface index from the parent Geom
[in]rdouble R (0 - 1) volume coordinate
[in]sdouble S (0 - 1) volume coordinate
[in]tdouble T (0 - 1) volume coordinate
[in]namestring RST Probe name
Returns
string RST Probe ID

◆ DeleteAllProbes()

void vsp::DeleteAllProbes ( )
extern

Delete all Probes from the Measure Tool

string pid1 = AddGeom( "POD", "" );
SetParmVal( pid1, "Y_Rel_Location", "XForm", 2.0 );
string probe_id_1 = AddProbe( pid1, 0, 0.5, 0.8, "Probe 1" );
string probe_id_2 = AddProbe( pid1, 0, 0.2, 0.3, "Probe 2" );
array< string > @probe_array = GetAllProbes();
if ( probe_array.size() != 0 ) { Print( "Error: DeleteAllProbes" ); __failure++; }
void DeleteAllProbes()

◆ DeleteAllProtractors()

void vsp::DeleteAllProtractors ( )
extern

Delete all Protractors from the Measure Tool

string pod1 = AddGeom( "POD", "" );
AddProtractor( pod1, 0, 0.2, 0.0, pod1, 0, 0.5, 0.0, pod1, 0, 0.8, 0.0, "Protractor_1" );
AddProtractor( pod1, 0, 0.1, 0.0, pod1, 0, 0.4, 0.0, pod1, 0, 0.7, 0.0, "Protractor_2" );
if ( GetAllProtractors().size() != 0 )
{
Print( "ERROR: DeleteAllProtractors left protractors behind" );
__failure++;
}
void DeleteAllProtractors()
std::vector< std::string > GetAllProtractors()
See also
AddProtractor, GetAllProtractors, DelProtractor

◆ DeleteAllRSTProbes()

void vsp::DeleteAllRSTProbes ( )
extern

Delete all RST Probes from the Measure Tool

string pod1 = AddGeom( "POD", "" );
AddRSTProbe( pod1, 0, 0.5, 0.5, 0.5, "RSTProbe_1" );
AddRSTProbe( pod1, 0, 0.25, 0.5, 0.5, "RSTProbe_2" );
// Surface probes are a separate list and are left alone.
AddProbe( pod1, 0, 0.5, 0.5, "Surface_Probe" );
if ( GetAllRSTProbes().size() != 0 )
{
Print( "ERROR: DeleteAllRSTProbes left probes behind" );
__failure++;
}
if ( GetAllProbes().size() != 1 )
{
Print( "ERROR: DeleteAllRSTProbes removed a surface probe" );
__failure++;
}
void DeleteAllRSTProbes()
See also
AddRSTProbe, GetAllRSTProbes, DelRSTProbe

◆ DeleteAllRulers()

void vsp::DeleteAllRulers ( )
extern

Delete all Rulers from the Measure Tool

string pid1 = AddGeom( "POD", "" );
SetParmVal( pid1, "Y_Rel_Location", "XForm", 2.0 );
string pid2 = AddGeom( "POD", "" );
SetParmVal( pid2, "Z_Rel_Location", "XForm", 4.0 );
string rid1 = AddRuler( pid1, 1, 0.2, 0.3, pid2, 0, 0.2, 0.3, "Ruler 1" );
string rid2 = AddRuler( pid1, 0, 0.4, 0.6, pid1, 1, 0.8, 0.9, "Ruler 2" );
if ( GetAllRulers().length() != 0 )
{
Print( "ERROR: DeleteAllRulers left something behind" );
__failure++;
}
void DeleteAllRulers()
std::vector< std::string > GetAllRulers()

◆ DelProbe()

void vsp::DelProbe ( const std::string & id)
extern

Delete a specific Probe from the Measure Tool

string pid1 = AddGeom( "POD", "" );
SetParmVal( pid1, "Y_Rel_Location", "XForm", 2.0 );
string probe_id_1 = AddProbe( pid1, 0, 0.5, 0.8, "Probe 1" );
string probe_id_2 = AddProbe( pid1, 0, 0.2, 0.3, "Probe 2" );
DelProbe( probe_id_1 );
array< string > @probe_array = GetAllProbes();
if ( probe_array.size() != 1 ) { Print( "Error: DelProbe" ); __failure++; }
void DelProbe(const std::string &id)
Parameters
[in]idstring Probe ID

◆ DelProtractor()

void vsp::DelProtractor ( const std::string & id)
extern

Delete a particular Protractor from the Measure Tool

string pod1 = AddGeom( "POD", "" );
string pid1 = AddProtractor( pod1, 0, 0.2, 0.0, pod1, 0, 0.5, 0.0, pod1, 0, 0.8, 0.0, "Protractor_1" );
string pid2 = AddProtractor( pod1, 0, 0.1, 0.0, pod1, 0, 0.4, 0.0, pod1, 0, 0.7, 0.0, "Protractor_2" );
DelProtractor( pid1 );
// Only the named protractor goes.
array< string > @prot_array = GetAllProtractors();
if ( prot_array.size() != 1 || prot_array[0] != pid2 )
{
Print( "ERROR: DelProtractor removed the wrong protractor" );
__failure++;
}
void DelProtractor(const std::string &id)
See also
AddProtractor, GetAllProtractors, DeleteAllProtractors
Parameters
[in]idstring Protractor ID

◆ DelRSTProbe()

void vsp::DelRSTProbe ( const std::string & id)
extern

Delete a particular RST Probe from the Measure Tool

string pod1 = AddGeom( "POD", "" );
string pid1 = AddRSTProbe( pod1, 0, 0.5, 0.5, 0.5, "RSTProbe_1" );
string pid2 = AddRSTProbe( pod1, 0, 0.25, 0.5, 0.5, "RSTProbe_2" );
DelRSTProbe( pid1 );
// Only the named probe goes.
array< string > @probe_array = GetAllRSTProbes();
if ( probe_array.size() != 1 || probe_array[0] != pid2 )
{
Print( "ERROR: DelRSTProbe removed the wrong probe" );
__failure++;
}
void DelRSTProbe(const std::string &id)
See also
AddRSTProbe, GetAllRSTProbes, DeleteAllRSTProbes
Parameters
[in]idstring RST Probe ID

◆ DelRuler()

void vsp::DelRuler ( const std::string & id)
extern

Delete a particular Ruler from the Measure Tool

string pid1 = AddGeom( "POD", "" );
SetParmVal( pid1, "Y_Rel_Location", "XForm", 2.0 );
string pid2 = AddGeom( "POD", "" );
SetParmVal( pid2, "Z_Rel_Location", "XForm", 4.0 );
string rid1 = AddRuler( pid1, 1, 0.2, 0.3, pid2, 0, 0.2, 0.3, "Ruler 1" );
string rid2 = AddRuler( pid1, 0, 0.4, 0.6, pid1, 1, 0.8, 0.9, "Ruler 2" );
array< string > @ruler_array = GetAllRulers();
int num_before_del = GetAllRulers().length();
DelRuler( ruler_array[0] );
if ( GetAllRulers().length() >= num_before_del )
{
Print( "ERROR: DelRuler removed nothing" );
__failure++;
}
void DelRuler(const std::string &id)
Parameters
[in]idstring Ruler ID

◆ GetAllProbes()

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

Get an array of all Probe IDs from the Measure Tool

string pid1 = AddGeom( "POD", "" );
SetParmVal( pid1, "Y_Rel_Location", "XForm", 2.0 );
string probe_id = AddProbe( pid1, 0, 0.5, 0.8, "Probe 1" );
array< string > @probe_array = GetAllProbes();
if ( probe_array.length() == 0 )
{
Print( "ERROR: GetAllProbes returned nothing" );
__failure++;
}
Print( "One Probe: ", false );
Print( probe_array[0] );
Returns
vector<string> Array of Probe IDs

◆ GetAllProtractors()

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

Get an array of all Protractor IDs from the Measure Tool

string pod1 = AddGeom( "POD", "" );
AddProtractor( pod1, 0, 0.2, 0.0, pod1, 0, 0.5, 0.0, pod1, 0, 0.8, 0.0, "Protractor_1" );
AddProtractor( pod1, 0, 0.1, 0.0, pod1, 0, 0.4, 0.0, pod1, 0, 0.7, 0.0, "Protractor_2" );
array< string > @prot_array = GetAllProtractors();
if ( prot_array.size() != 2 )
{
Print( "ERROR: GetAllProtractors did not report both protractors" );
__failure++;
}
if ( prot_array.size() == 2 && prot_array[0] == prot_array[1] )
{
Print( "ERROR: GetAllProtractors reported the same protractor twice" );
__failure++;
}
See also
AddProtractor, DelProtractor, DeleteAllProtractors
Returns
vector<string> Array of Protractor IDs

◆ GetAllRSTProbes()

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

Get an array of all RST Probe IDs from the Measure Tool

string pod1 = AddGeom( "POD", "" );
AddRSTProbe( pod1, 0, 0.5, 0.5, 0.5, "RSTProbe_1" );
AddRSTProbe( pod1, 0, 0.25, 0.5, 0.5, "RSTProbe_2" );
array< string > @probe_array = GetAllRSTProbes();
if ( probe_array.size() != 2 )
{
Print( "ERROR: GetAllRSTProbes did not report both probes" );
__failure++;
}
if ( probe_array.size() == 2 && probe_array[0] == probe_array[1] )
{
Print( "ERROR: GetAllRSTProbes reported the same probe twice" );
__failure++;
}
See also
AddRSTProbe, DelRSTProbe, DeleteAllRSTProbes
Returns
vector<string> Array of RST Probe IDs

◆ GetAllRulers()

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

Get an array of all Ruler IDs from the Measure Tool

string pid1 = AddGeom( "POD", "" );
SetParmVal( pid1, "Y_Rel_Location", "XForm", 2.0 );
string pid2 = AddGeom( "POD", "" );
SetParmVal( pid2, "Z_Rel_Location", "XForm", 4.0 );
string rid1 = AddRuler( pid1, 1, 0.2, 0.3, pid2, 0, 0.2, 0.3, "Ruler 1" );
string rid2 = AddRuler( pid1, 0, 0.4, 0.6, pid1, 1, 0.8, 0.9, "Ruler 2" );
array< string > @ruler_array = GetAllRulers();
if ( ruler_array.length() == 0 )
{
Print( "ERROR: GetAllRulers returned nothing" );
__failure++;
}
Print("Two Rulers");
for( int n = 0 ; n < int( ruler_array.length() ) ; n++ )
{
Print( ruler_array[n] );
}
Returns
vector<string> Vector of Ruler IDs

◆ HideAllProbes()

void vsp::HideAllProbes ( )
extern

Hide every Probe in the Measure Tool.

See also
ShowAllProbes

◆ HideAllProtractors()

void vsp::HideAllProtractors ( )
extern

Hide every Protractor in the Measure Tool.

See also
ShowAllProtractors

◆ HideAllRSTProbes()

void vsp::HideAllRSTProbes ( )
extern

Hide every RST Probe in the Measure Tool.

See also
ShowAllRSTProbes

◆ HideAllRulers()

void vsp::HideAllRulers ( )
extern

Hide every Ruler in the Measure Tool.

See also
ShowAllRulers

◆ ShowAllProbes()

void vsp::ShowAllProbes ( )
extern

Show every Probe in the Measure Tool.

See also
HideAllProbes

◆ ShowAllProtractors()

void vsp::ShowAllProtractors ( )
extern

Show every Protractor in the Measure Tool.

See also
HideAllProtractors

◆ ShowAllRSTProbes()

void vsp::ShowAllRSTProbes ( )
extern

Show every RST Probe in the Measure Tool.

See also
HideAllRSTProbes

◆ ShowAllRulers()

void vsp::ShowAllRulers ( )
extern

Create a new Ruler and add it to the Measure Tool

string pid1 = AddGeom( "POD", "" );
SetParmVal( pid1, "Y_Rel_Location", "XForm", 2.0 );
string pid2 = AddGeom( "POD", "" );
SetParmVal( pid2, "Z_Rel_Location", "XForm", 4.0 );
string rid = AddRuler( pid1, 1, 0.2, 0.3, pid2, 0, 0.2, 0.3, "Ruler 1" );
SetParmVal( FindParm( rid, "X_Offset", "Measure" ), 6.0 );
if ( rid.length() == 0 || rid == "NONE" )
{
Print( "ERROR: AddRuler returned no id" );
__failure++;
}
Parameters
[in]startgeomidstring Start parent Geom ID
[in]startsurfindxint Main surface index from the staring parent Geom
[in]startudouble Surface u (0 - 1) start coordinate
[in]startwdouble Surface w (0 - 1) start coordinate
[in]endgeomidstring End parent Geom ID
[in]endsurfindxint Main surface index on the end parent Geom
[in]endudouble Surface u (0 - 1) end coordinate
[in]endwdouble Surface w (0 - 1) end coordinate
[in]namestring Ruler name
Returns
string Ruler ID

Create and add a Protractor object from three points on Geom surfaces. The angle is measured at the middle point, between the legs running out to the start and end points.

string pod1 = AddGeom( "POD", "" );
string pid = AddProtractor( pod1, 0, 0.2, 0.0, pod1, 0, 0.5, 0.0, pod1, 0, 0.8, 0.0, "Example_Protractor" );
if ( pid.length() == 0 || pid == "NONE" )
{
Print( "ERROR: AddProtractor returned no id" );
__failure++;
}
// The new protractor is the only one in the model.
array< string > @prot_array = GetAllProtractors();
if ( prot_array.size() != 1 || prot_array[0] != pid )
{
Print( "ERROR: AddProtractor did not add the protractor" );
__failure++;
}
// Protractors are their own Parm Containers, so the name is readable.
if ( GetContainerName( pid ) != "Example_Protractor" )
{
Print( "ERROR: AddProtractor did not name the protractor" );
__failure++;
}
See also
GetAllProtractors, DelProtractor, DeleteAllProtractors, AddRuler
Parameters
[in]startgeomidstring Start parent Geom ID
[in]startsurfindxint Start surface index from the start parent Geom
[in]startudouble Start U (0 - 1) surface coordinate
[in]startwdouble Start W (0 - 1) surface coordinate
[in]midgeomidstring Middle parent Geom ID
[in]midsurfindxint Middle surface index from the middle parent Geom
[in]midudouble Middle U (0 - 1) surface coordinate
[in]midwdouble Middle W (0 - 1) surface coordinate
[in]endgeomidstring End parent Geom ID
[in]endsurfindxint End surface index from the end parent Geom
[in]endudouble End U (0 - 1) surface coordinate
[in]endwdouble End W (0 - 1) surface coordinate
[in]namestring Protractor name
Returns
string Protractor ID

Show every Ruler in the Measure Tool. This is the Measure screen's Show All button for rulers.

string pod1 = AddGeom( "POD", "" );
string rid = AddRuler( pod1, 0, 0.2, 0.0, pod1, 0, 0.8, 0.0, "Example_Ruler" );
// Visibility is a Parm on the ruler itself.
if ( !closeTo( GetParmVal( FindParm( rid, "Visible", "Measure" ) ), 0.0, 1e-12 ) )
{
Print( "ERROR: HideAllRulers did not hide the ruler" );
__failure++;
}
if ( !closeTo( GetParmVal( FindParm( rid, "Visible", "Measure" ) ), 1.0, 1e-12 ) )
{
Print( "ERROR: ShowAllRulers did not show the ruler" );
__failure++;
}
void ShowAllRulers()
void HideAllRulers()
double GetParmVal(const std::string &parm_id)
See also
HideAllRulers, AddRuler