OpenVSP API Documentation  3.38.0
Functions
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 
)

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" );
}
@ XS_EDIT_CURVE
Definition: APIDefines.h:1390
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_idXSecSurf ID
[in]xsec_indexXsec index
[in]typeXsec type enum (i.e. XS_ELLIPSE)

◆ GetNumXSec()

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

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 );
for ( int i = 0 ; i < num_xsecs ; i++ )
{
string xsec = GetXSec( xsec_surf, i );
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
}
@ XSEC_BOTH_SIDES
Definition: APIDefines.h:1417
void SetXSecTanStrengths(const std::string &xsec_id, int side, double top, double right, double bottom, double left)
void SetXSecTanAngles(const std::string &xsec_id, int side, double top, double right, double bottom, double left)
int GetNumXSec(const std::string &xsec_surf_id)
Parameters
[in]xsec_surf_idXSecSurf ID
Returns
Number of XSecs

◆ GetNumXSecSurfs()

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

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 " ); }
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 
)

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 );
Parameters
[in]xsec_surf_idXSecSurf ID
[in]xsec_indexXsec index
Returns
Xsec ID

◆ GetXSecSurf()

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

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 );
Parameters
[in]geom_idstring Geom ID
[in]indexXSecSurf index
Returns
XSecSurf ID

◆ GetXSecSurfGlobalXForm()

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

Get the global surface transform matrix for given XSecSurf

Parameters
[in]xsec_surf_idXSecSurf ID
Returns
Transformation matrix

◆ SetXSecSurfGlobalXForm()

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

Set the global surface transform matrix for given XSecSurf

Parameters
[in]xsec_surf_idXSecSurf ID
[in]matTransformation matrix