OpenVSPAPI  3.24.0
Functions
Edit Curve XSec Functions

Functions for modifying XSecs of type XS_EDIT_CURVE are defined here.

Click here to return to the main page. More...

Functions

void EditXSecInitShape (const string &in xsec_id)
 
void EditXSecConvertTo (const string &in xsec_id, const int &in newtype)
 
double [] GetEditXSecUVec (const string &in xsec_id)
 
vec3d [] GetEditXSecCtrlVec (const string &in xsec_id, const bool non_dimensional=true)
 
void SetEditXSecPnts (const string &in xsec_id, double[]@ u_vec, vec3d[]@ control_pts)
 
void EditXSecDelPnt (const string &in xsec_id, const int &in indx)
 
int EditXSecSplit01 (const string &in xsec_id, const double &in u)
 
void MoveEditXSecPnt (const string &in xsec_id, const int &in indx, const vec3d &in new_pnt)
 
void ConvertXSecToEdit (const string &in geom_id, const int &in indx=0)
 
bool [] GetEditXSecFixedUVec (const string &in xsec_id)
 
void SetEditXSecFixedUVec (const string &in xsec_id, bool[]@ fixed_u_vec)
 
void ReparameterizeEditXSec (const string &in xsec_id)
 

Detailed Description

Function Documentation

◆ ConvertXSecToEdit()

void ConvertXSecToEdit ( const string &in  geom_id,
const int &in  indx = 0 
)

Convert any XSec type into an EditCurveXSec. This function will work for BOR Geoms, in which case the input XSec index is ignored.

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
// Convert Rounded Rectangle to Edit Curve type XSec
// Identify XSec 1
string xsec_1 = GetXSec( xsec_surf, 1 );
// Get the control points for the default shape
array < vec3d > xsec1_pts = GetEditXSecCtrlVec( xsec_1, true ); // The returned control points will not be scaled by width and height
Parameters
[in]geom_idGeom ID
[in]indxXSec index

◆ EditXSecConvertTo()

void EditXSecConvertTo ( const string &in  xsec_id,
const int &in  newtype 
)

Convert the EditCurveXSec curve type to the specified new type. Note, EditCurveXSec uses the same enumerations for PCurve to identify curve type, but APPROX_CEDIT is not supported at this time.

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
ChangeXSecShape( xsec_surf, 1, XS_EDIT_CURVE );
// Identify XSec 1
string xsec_1 = GetXSec( xsec_surf, 1 );
// Set XSec 1 to Linear
See also
PCURV_TYPE
Parameters
[in]xsec_idXSec ID
[in]newtypeNew curve type enum (i.e. CEDIT)

◆ EditXSecDelPnt()

void EditXSecDelPnt ( const string &in  xsec_id,
const int &in  indx 
)

Delete an EditCurveXSec control point. Note, cubic Bezier intermediate control points (those not on the curve) cannot be deleted. The previous and next Bezier control point will be deleted along with the point on the curve. Regardless of curve type, the first and last points may not be deleted.

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
ChangeXSecShape( xsec_surf, 2, XS_EDIT_CURVE );
// Identify XSec 2
string xsec_2 = GetXSec( xsec_surf, 2 );
// Turn off R/L symmetry
SetParmVal( GetXSecParm( xsec_2, "SymType"), SYM_NONE );
array < vec3d > old_pnts = GetEditXSecCtrlVec( xsec_2, true ); // The returned control points will not be scaled by width and height
EditXSecDelPnt( xsec_2, 3 ); // Remove control point at bottom of circle
array < vec3d > new_pnts = GetEditXSecCtrlVec( xsec_2, true ); // The returned control points will not be scaled by width and height
if ( old_pnts.size() - new_pnts.size() != 3 )
{
Print( "Error: EditXSecDelPnt");
}
Parameters
[in]xsec_idXSec ID
[in]indxControl point index

◆ EditXSecInitShape()

void EditXSecInitShape ( const string &in  xsec_id)

Initialize the EditCurveXSec to the current value of m_ShapeType (i.e. EDIT_XSEC_ELLIPSE)

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
ChangeXSecShape( xsec_surf, 2, XS_EDIT_CURVE );
// Identify XSec 2
string xsec_2 = GetXSec( xsec_surf, 2 );
// Set XSec 2 to linear
EditXSecInitShape( xsec_2 ); // Change back to default ellipse
See also
INIT_EDIT_XSEC_TYPE
Parameters
[in]xsec_idXSec ID

◆ EditXSecSplit01()

int EditXSecSplit01 ( const string &in  xsec_id,
const double &in  u 
)

Split the EditCurveXSec at the specified U value

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
ChangeXSecShape( xsec_surf, 2, XS_EDIT_CURVE );
// Identify XSec 2
string xsec_2 = GetXSec( xsec_surf, 2 );
// Turn off R/L symmetry
SetParmVal( GetXSecParm( xsec_2, "SymType"), SYM_NONE );
array < vec3d > old_pnts = GetEditXSecCtrlVec( xsec_2, true ); // The returned control points will not be scaled by width and height
int new_pnt_ind = EditXSecSplit01( xsec_2, 0.375 );
array < vec3d > new_pnts = GetEditXSecCtrlVec( xsec_2, true ); // The returned control points will not be scaled by width and height
if ( new_pnts.size() - old_pnts.size() != 3 )
{
Print( "Error: EditXSecSplit01");
}
Parameters
[in]xsec_idXSec ID
[in]uU value to split the curve at (0 - 1)
Returns
Index of the point added from the split

◆ GetEditXSecCtrlVec()

vec3d [] GetEditXSecCtrlVec ( const string &in  xsec_id,
const bool  non_dimensional = true 
)

Get the control point vector for an EditCurveXSec. Note, the returned array of vec3d values will be represented in 2D with Z set to 0.

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
ChangeXSecShape( xsec_surf, 1, XS_EDIT_CURVE );
// Identify XSec 1
string xsec_1 = GetXSec( xsec_surf, 1 );
// Get the control points for the default shape
array < vec3d > xsec1_pts = GetEditXSecCtrlVec( xsec_1, true ); // The returned control points will not be scaled by width and height
Print( "Normalized Bottom Point of XSecCurve: " + xsec1_pts[3].x() + ", " + xsec1_pts[3].y() + ", " + xsec1_pts[3].z() );
Parameters
[in]xsec_idXSec ID
[in]non_dimensionalTrue to get the points non-dimensionalized, False to get them scaled by m_Width and m_Height
Returns
Array of control points

◆ GetEditXSecFixedUVec()

bool [] GetEditXSecFixedUVec ( const string &in  xsec_id)

Get the vector of fixed U flags for each control point in an EditCurveXSec. The fixed U flag is used to hold the U parameter of the control point constant when performing an equal arc length reparameterization of the curve.

// Add Wing
string wid = AddGeom( "WING" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( wid, 0 );
ChangeXSecShape( xsec_surf, 1, XS_EDIT_CURVE );
// Identify XSec 1
string xsec_1 = GetXSec( xsec_surf, 1 );
array < bool > @ fixed_u_vec = GetEditXSecFixedUVec( xsec_1 );
fixed_u_vec[3] = true; // change a flag
SetEditXSecFixedUVec( xsec_1, fixed_u_vec );
See also
SetEditXSecFixedUVec, ReparameterizeEditXSec
Parameters
[in]xsec_idXSec ID
Returns
Array of bool values for each control point

◆ GetEditXSecUVec()

double [] GetEditXSecUVec ( const string &in  xsec_id)

Get the U parameter vector for an EditCurveXSec. The vector will be in increasing order with a range of 0 - 1.

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
ChangeXSecShape( xsec_surf, 2, XS_EDIT_CURVE );
// Identify XSec 2
string xsec_2 = GetXSec( xsec_surf, 2 );
// Set XSec 2 to linear
if ( u_vec[1] - 0.25 > 1e-6 )
{
Print( "Error: GetEditXSecUVec" );
}
Parameters
[in]xsec_idXSec ID
Returns
Array of U parameter values

◆ MoveEditXSecPnt()

void MoveEditXSecPnt ( const string &in  xsec_id,
const int &in  indx,
const vec3d &in  new_pnt 
)

Move an EditCurveXSec control point. The XSec points are nondimensionalized by m_Width and m_Height and defined in 2D, so the Z value of the new coordinate point will be ignored.

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
ChangeXSecShape( xsec_surf, 1, XS_EDIT_CURVE );
// Identify XSec 1
string xsec_1 = GetXSec( xsec_surf, 1 );
// Turn off R/L symmetry
SetParmVal( GetXSecParm( xsec_1, "SymType"), SYM_NONE );
// Get the control points for the default shape
array < vec3d > xsec1_pts = GetEditXSecCtrlVec( xsec_1, true ); // The returned control points will not be scaled by width and height
// Identify a control point that lies on the curve and shift it in Y
int move_pnt_ind = 3;
vec3d new_pnt = vec3d( xsec1_pts[move_pnt_ind].x(), 2 * xsec1_pts[move_pnt_ind].y(), 0.0 );
// Move the control point
MoveEditXSecPnt( xsec_1, move_pnt_ind, new_pnt );
array < vec3d > new_pnts = GetEditXSecCtrlVec( xsec_1, true ); // The returned control points will not be scaled by width and height
if ( dist( new_pnt, new_pnts[move_pnt_ind] ) > 1e-6 )
{
Print( "Error: MoveEditXSecPnt" );
}
Parameters
[in]xsec_idXSec ID
[in]indxControl point index
[in]new_pntCoordinate of the new point

◆ ReparameterizeEditXSec()

void ReparameterizeEditXSec ( const string &in  xsec_id)

Perform an equal arc length repareterization on an EditCurveXSec. The reparameterization is performed between specific U values if the Fixed U flag is true. This allows corners, such as at 0.25, 0.5, and 0.75 U, to be held constant while everything between them is reparameterized.

// Add Wing
string wid = AddGeom( "WING" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( wid, 0 );
ChangeXSecShape( xsec_surf, 1, XS_EDIT_CURVE );
// Identify XSec 1
string xsec_1 = GetXSec( xsec_surf, 1 );
array < bool > @ fixed_u_vec = GetEditXSecFixedUVec( xsec_1 );
fixed_u_vec[3] = true; // change a flag
SetEditXSecFixedUVec( xsec_1, fixed_u_vec );
See also
SetEditXSecFixedUVec, GetEditXSecFixedUVec
Parameters
[in]xsec_idXSec ID

◆ SetEditXSecFixedUVec()

void SetEditXSecFixedUVec ( const string &in  xsec_id,
bool@ []  fixed_u_vec 
)

Set the vector of fixed U flags for each control point in an EditCurveXSec. The fixed U flag is used to hold the U parameter of the control point constant when performing an equal arc length reparameterization of the curve.

// Add Wing
string wid = AddGeom( "WING" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( wid, 0 );
ChangeXSecShape( xsec_surf, 1, XS_EDIT_CURVE );
// Identify XSec 1
string xsec_1 = GetXSec( xsec_surf, 1 );
array < bool > @ fixed_u_vec = GetEditXSecFixedUVec( xsec_1 );
fixed_u_vec[3] = true; // change a flag
SetEditXSecFixedUVec( xsec_1, fixed_u_vec );
See also
GetEditXSecFixedUVec, ReparameterizeEditXSec
Parameters
[in]xsec_idXSec ID
[in]fixed_u_vecArray of fixed U flags

◆ SetEditXSecPnts()

void SetEditXSecPnts ( const string &in  xsec_id,
double@ []  u_vec,
vec3d@ []  control_pts 
)

Set the U parameter vector and the control point vector for an EditCurveXSec. The arrays must be of equal length, with the values for U defined in increasing order and range 0 - 1. The input control points to SetEditXSecPnts must be nondimensionalized in the approximate range of [-0.5, 0.5].

// Add Stack
string sid = AddGeom( "STACK", "" );
// Get First (and Only) XSec Surf
string xsec_surf = GetXSecSurf( sid, 0 );
ChangeXSecShape( xsec_surf, 2, XS_EDIT_CURVE );
// Identify XSec 2
string xsec_2 = GetXSec( xsec_surf, 2 );
// Set XSec 2 to linear
// Turn off R/L symmetry
SetParmVal( GetXSecParm( xsec_2, "SymType"), SYM_NONE );
// Define a square
array < vec3d > xsec2_pts(5);
xsec2_pts[0] = vec3d( 0.5, 0.5, 0.0 );
xsec2_pts[1] = vec3d( 0.5, -0.5, 0.0 );
xsec2_pts[2] = vec3d( -0.5, -0.5, 0.0 );
xsec2_pts[3] = vec3d( -0.5, 0.5, 0.0 );
xsec2_pts[4] = vec3d( 0.5, 0.5, 0.0 );
// u vec must start at 0.0 and end at 1.0
u_vec[0] = 0.0;
u_vec[1] = 0.25;
u_vec[2] = 0.5;
u_vec[3] = 0.75;
u_vec[4] = 1.0;
SetEditXSecPnts( xsec_2, u_vec, xsec2_pts ); // Note: points are unscaled by the width and height parms
array < vec3d > new_pnts = GetEditXSecCtrlVec( xsec_2, true ); // The returned control points will not be scaled by width and height
if ( dist( new_pnts[3], xsec2_pts[3] ) > 1e-6 )
{
Print( "Error: SetEditXSecPnts");
}
Parameters
[in]xsec_idXSec ID
[in]u_vecArray of U parameter values
[in]control_ptsNondimensionalized array of control points