OpenVSPAPI  3.20.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)
 

Detailed Description

Function Documentation

◆ 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.

// 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 Cubic Bezier (default)
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 );
EditXSecDelPnt( xsec_2, 3 ); // Remove control point at bottom of circle
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 );
// Identify XSec 2
string xsec_2 = GetXSec( xsec_surf, 2 );
int new_pnt_ind = EditXSecSplit01( xsec_2, 0.375 );
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
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

◆ 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
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 );
// 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 );
Parameters
[in]xsec_idXSec ID
[in]indxControl point index
[in]new_pntCoordinate of the new point

◆ 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 XSec is nondimentionalized and 2D, so the input control points wil be scaled by m_Width and m_Height and the Z values will be ignored.

// 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
// Define a square
array < vec3d > xsec2_pts(5);
xsec2_pts[0] = vec3d( 1.5, 1.5, 0.0 );
xsec2_pts[1] = vec3d( 1.5, -1.5, 0.0 );
xsec2_pts[2] = vec3d( -1.5, -1.5, 0.0 );
xsec2_pts[3] = vec3d( -1.5, 1.5, 0.0 );
xsec2_pts[4] = vec3d( 1.5, 1.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
Parameters
[in]xsec_idXSec ID
[in]u_vecArray of U parameter values
[in]control_ptsArray of control points
EditXSecConvertTo
void EditXSecConvertTo(const string &in xsec_id, const int &in newtype)
EditXSecDelPnt
void EditXSecDelPnt(const string &in xsec_id, const int &in indx)
MoveEditXSecPnt
void MoveEditXSecPnt(const string &in xsec_id, const int &in indx, const vec3d &in new_pnt)
XS_EDIT_CURVE
Definition: openvsp_as.h:2123
GetEditXSecUVec
double[] GetEditXSecUVec(const string &in xsec_id)
CEDIT
Definition: openvsp_as.h:1696
GetXSec
string GetXSec(const string &in xsec_surf_id, int xsec_index)
EditXSecSplit01
int EditXSecSplit01(const string &in xsec_id, const double &in u)
EditXSecInitShape
void EditXSecInitShape(const string &in xsec_id)
SetEditXSecPnts
void SetEditXSecPnts(const string &in xsec_id, double[]@ u_vec, vec3d[]@ control_pts)
GetEditXSecCtrlVec
vec3d[] GetEditXSecCtrlVec(const string &in xsec_id, const bool non_dimensional=true)
vec3d
A class for representing 3D vectors.
Definition: openvsp_as.h:341
LINEAR
Definition: openvsp_as.h:1694
ChangeXSecShape
void ChangeXSecShape(const string &in xsec_surf_id, int xsec_index, int type)
array
AngelScript ScriptExtension for representing the C++ std::vector.
Definition: openvsp_as.h:244
GetXSecSurf
string GetXSecSurf(const string &in geom_id, int index)
AddGeom
string AddGeom(const string &in type, const string &in parent=string())