OpenVSP API Documentation 3.52.0
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++;
}
void Print(const std::string &data, bool new_line=true)
@ 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)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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)
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_idstring XSecSurf ID
Returns
int Number of XSecs
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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
Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetXSecSurfGlobalXForm()

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

Get the global surface transform matrix for given XSecSurf

string sid = AddGeom( "STACK", "" );
string xsec_surf = GetXSecSurf( sid, 0 );
Matrix4d mat = GetXSecSurfGlobalXForm( xsec_surf );
Matrix4d GetXSecSurfGlobalXForm(const std::string &xsec_surf_id)
Parameters
[in]xsec_surf_idstring XSecSurf ID
Returns
Matrix4d Transformation matrix
Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetXSecSurfGlobalXForm()

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

Set the global surface transform matrix for given XSecSurf

string sid = AddGeom( "STACK", "" );
string xsec_surf = GetXSecSurf( sid, 0 );
mat.translatef( 1.0, 2.0, 3.0 );
SetXSecSurfGlobalXForm( xsec_surf, mat );
void loadIdentity()
void translatef(const double &x, const double &y, const double &z)
void SetXSecSurfGlobalXForm(const std::string &xsec_surf_id, const Matrix4d &mat)
Parameters
[in]xsec_surf_idstring XSecSurf ID
[in]matMatrix4d Transformation matrix
Here is the call graph for this function:
Here is the caller graph for this function: