OpenVSP API Documentation 3.51.3
Loading...
Searching...
No Matches
XSecSurf Functions

This group of API functions provides capabilities related to the XSecSurf class in OpenVSP. Click here to return to the main page. More...

Functions

int vsp::GetNumXSecSurfs (const std::string &geom_id)
std::string vsp::GetXSecSurf (const std::string &geom_id, int index)
int vsp::GetNumXSec (const std::string &xsec_surf_id)
std::string vsp::GetXSec (const std::string &xsec_surf_id, int xsec_index)
void vsp::ChangeXSecShape (const std::string &xsec_surf_id, int xsec_index, int type)
void vsp::SetXSecSurfGlobalXForm (const std::string &xsec_surf_id, const Matrix4d &mat)
Matrix4d vsp::GetXSecSurfGlobalXForm (const std::string &xsec_surf_id)

Detailed Description

Function Documentation

◆ ChangeXSecShape()

void vsp::ChangeXSecShape ( const std::string & xsec_surf_id,
int xsec_index,
int type )
extern

Change the shape of a particular XSec, identified by an XSecSurf ID and XSec index

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
// Set XSec 1 & 2 to Edit Curve type
ChangeXSecShape( xsec_surf, 1, XS_EDIT_CURVE );
ChangeXSecShape( xsec_surf, 2, XS_EDIT_CURVE );
string xsec_2 = GetXSec( xsec_surf, 2 );
if ( GetXSecShape( xsec_2 ) != XS_EDIT_CURVE )
{
Print( "Error: ChangeXSecShape" );
__failure++;
}
@ XS_EDIT_CURVE
std::string AddGeom(const std::string &type, const std::string &parent=std::string())
int GetXSecShape(const std::string &xsec_id)
std::string GetXSecSurf(const std::string &geom_id, int index)
std::string GetXSec(const std::string &xsec_surf_id, int xsec_index)
void ChangeXSecShape(const std::string &xsec_surf_id, int xsec_index, int type)
See also
XSEC_CRV_TYPE
Parameters
[in]xsec_surf_idstring XSecSurf ID
[in]xsec_indexint Xsec index
[in]typeint Xsec type enum (i.e. XS_ELLIPSE)

◆ GetNumXSec()

int vsp::GetNumXSec ( const std::string & xsec_surf_id)
extern

Get number of XSecs in an XSecSurf

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
// Flatten ends
int num_xsecs = GetNumXSec( xsec_surf );
// A Stack starts with five sections, and every index below the count has to
// name a real XSec.
if ( num_xsecs != 5 )
{
Print( "ERROR: GetNumXSec did not report the sections of a new Stack" );
__failure++;
}
for ( int i = 0 ; i < num_xsecs ; i++ )
{
string xsec = GetXSec( xsec_surf, i );
if ( xsec.length() == 0 )
{
Print( "ERROR: GetNumXSec counted a section that GetXSec cannot find" );
__failure++;
}
SetXSecTanAngles( xsec, XSEC_BOTH_SIDES, 0 ); // Set Tangent Angles At Cross Section
SetXSecTanStrengths( xsec, XSEC_BOTH_SIDES, 0.0 ); // Set Tangent Strengths At Cross Section
}
// Inserting a section has to move the count.
if ( GetNumXSec( xsec_surf ) != num_xsecs + 1 )
{
Print( "ERROR: GetNumXSec did not follow InsertXSec" );
__failure++;
}
@ XSEC_BOTH_SIDES
@ XS_ROUNDED_RECTANGLE
void InsertXSec(const std::string &geom_id, int index, int type)
int GetNumXSec(const std::string &xsec_surf_id)
Parameters
[in]xsec_surf_idstring XSecSurf ID
Returns
int Number of XSecs

◆ GetNumXSecSurfs()

int vsp::GetNumXSecSurfs ( const std::string & geom_id)
extern

Get the number of XSecSurfs for the specified Geom

//==== Add Fuselage Geometry ====//
string fuseid = AddGeom( "FUSELAGE", "" );
int num_xsec_surfs = GetNumXSecSurfs( fuseid );
if ( num_xsec_surfs != 1 ) { Print( "---> Error: API GetNumXSecSurfs " ); __failure++; }
int GetNumXSecSurfs(const std::string &geom_id)
Parameters
[in]geom_idstring Geom ID
Returns
int Number of XSecSurfs

◆ GetXSec()

std::string vsp::GetXSec ( const std::string & xsec_surf_id,
int xsec_index )
extern

Get Xsec ID for a particular XSecSurf at given index

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
// Identify XSec 1
string xsec_1 = GetXSec( xsec_surf, 1 );
if ( xsec_1.length() == 0 )
{
Print( "ERROR: GetXSec returned nothing" );
__failure++;
}
Parameters
[in]xsec_surf_idstring XSecSurf ID
[in]xsec_indexint Xsec index
Returns
string Xsec ID

◆ GetXSecSurf()

std::string vsp::GetXSecSurf ( const std::string & geom_id,
int index )
extern

Get the XSecSurf ID for a particular Geom and XSecSurf index

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
if ( xsec_surf.length() == 0 )
{
Print( "ERROR: GetXSecSurf returned nothing" );
__failure++;
}
Parameters
[in]geom_idstring Geom ID
[in]indexint XSecSurf index
Returns
string XSecSurf ID

◆ GetXSecSurfGlobalXForm()

Matrix4d vsp::GetXSecSurfGlobalXForm ( const std::string & xsec_surf_id)
extern

Get the global surface transform matrix for given XSecSurf

Parameters
[in]xsec_surf_idstring XSecSurf ID
Returns
Matrix4d Transformation matrix

◆ SetXSecSurfGlobalXForm()

void vsp::SetXSecSurfGlobalXForm ( const std::string & xsec_surf_id,
const Matrix4d & mat )
extern

Set the global surface transform matrix for given XSecSurf

Parameters
[in]xsec_surf_idstring XSecSurf ID
[in]matMatrix4d Transformation matrix