OpenVSPAPI  3.20.0
Functions
Custom Geometry Functions

This functions grouped here are used to create and manipulate Custom Components. Custom components are defined in *.vspscript files included in the /"Custom Scripts/" directory. Examples of Custom Components are available in the directory for reference.

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

Functions

string AddParm (int type, const string &in name, const string &in group)
 
string GetCurrCustomGeom ()
 
string GetCustomParm (int index)
 
int AddGui (int type, const string &in label=string(), const string &in parm_name=string(), const string &in group_name=string(), double range=10.0)
 
void UpdateGui (int gui_id, const string &in parm_id)
 
string AddXSecSurf ()
 
void RemoveXSecSurf (const string &in xsec_id)
 
void ClearXSecSurfs ()
 
void SkinXSecSurf (bool closed_flag=false)
 
void CloneSurf (int index, Matrix4d &in mat)
 
void TransformSurf (int index, Matrix4d &in mat)
 
void SetVspSurfType (int type, int surf_index=- 1)
 
void SetVspSurfCfdType (int type, int surf_index=- 1)
 
void SetCustomXSecLoc (const string &in xsec_id, const vec3d &in loc)
 
vec3d GetCustomXSecLoc (const string &in xsec_id)
 
void SetCustomXSecRot (const string &in xsec_id, const vec3d &in rot)
 
vec3d GetCustomXSecRot (const string &in xsec_id)
 
bool CheckClearTriggerEvent (int gui_id)
 
void SetupCustomDefaultSource (int type, int surf_index, double l1, double r1, double u1, double w1, double l2=0, double r2=0, double u2=0, double w2=0)
 
void ClearAllCustomDefaultSources ()
 
void SetCustomCenter (double x, double y, double z)
 
string AppendXSec (const string &in xsec_surf_id, int type)
 
string AppendCustomXSec (const string &in xsec_surf_id, int type)
 
void CutCustomXSec (const string &in xsec_surf_id, int index)
 
void CopyCustomXSec (const string &in xsec_surf_id, int index)
 
void PasteCustomXSec (const string &in xsec_surf_id, int index)
 
string InsertCustomXSec (const string &in xsec_surf_id, int type, int index)
 

Detailed Description

Function Documentation

◆ AddGui()

int AddGui ( int  type,
const string &in  label = string(),
const string &in  parm_name = string(),
const string &in  group_name = string(),
double  range = 10.0 
)

Add a GUI element for the current custom Geom. Some inputs may not be used depending on the input type. The Parm name and group name are used to identify the Parm ID associated with the GUI element.

//==== InitGui Is Called Once During Each Custom Geom Construction ====//
void InitGui()
{
AddGui( GDEV_TAB, "Design" );
AddGui( GDEV_DIVIDER_BOX, "Design" );
AddGui( GDEV_SLIDER_ADJ_RANGE_INPUT, "Length", "Length", "Design" );
AddGui( GDEV_SLIDER_ADJ_RANGE_INPUT, "Diameter", "Diameter", "Design" );
}
See also
GDEV
Parameters
[in]typeGUI element type enum (i.e. GDEV_SLIDER_ADJ_RANGE)
[in]labelOptional GUI device label
[in]parm_nameOptional Parm name
[in]group_nameOptional Parm group name
[in]rangeOptional GUI element range
Returns
GUI element index

◆ AddParm()

string AddParm ( int  type,
const string &in  name,
const string &in  group 
)

Function to add a new Parm of input type, name, and group for a custom Geom component

string length = AddParm( PARM_DOUBLE_TYPE, "Length", "Design" );
SetParmValLimits( length, 10.0, 0.001, 1.0e12 );
SetParmDescript( length, "Total Length of Custom Geom" );
See also
PARM_TYPE
Parameters
[in]typeParm type enum (i.e. PARM_DOUBLE_TYPE)
[in]nameParm name
[in]groupParm group
Returns
Parm ID

◆ AddXSecSurf()

string AddXSecSurf ( )
Add an XSecSurf to the current custom Geom
/code{.cpp}

==== Add Cross Sections =====// string seat_surf = AddXSecSurf();

AppendCustomXSec( seat_surf, XS_POINT);

AppendCustomXSec( seat_surf, XS_ROUNDED_RECTANGLE);

AppendCustomXSec( seat_surf, XS_ROUNDED_RECTANGLE);

AppendCustomXSec( seat_surf, XS_POINT); /endcode

Returns
XSecSurf ID

◆ AppendCustomXSec()

string AppendCustomXSec ( const string &in  xsec_surf_id,
int  type 
)

Append an XSec to the current custom Geom. This function is identical to AppendXSec.

//==== Add Cross Sections =====//
string xsec_surf = AddXSecSurf();
AppendCustomXSec( xsec_surf, XS_POINT);
AppendCustomXSec( xsec_surf, XS_CIRCLE );
AppendCustomXSec( xsec_surf, XS_CIRCLE );
AppendCustomXSec( xsec_surf, XS_POINT);
See also
XSEC_CRV_TYPE, AppendXSec
Parameters
[in]xsec_surf_idXSecSurf ID
[in]typeXSec type enum (i.e. XSEC_WEDGE)
Returns
XSec ID

◆ AppendXSec()

string AppendXSec ( const string &in  xsec_surf_id,
int  type 
)

Append an XSec to the current custom Geom. This function is identical to AppendCustomXSec.

//==== Add Cross Sections =====//
string xsec_surf = AddXSecSurf();
AppendXSec( xsec_surf, XS_POINT);
AppendXSec( xsec_surf, XS_CIRCLE );
AppendXSec( xsec_surf, XS_CIRCLE );
AppendXSec( xsec_surf, XS_ELLIPSE );
AppendXSec( xsec_surf, XS_POINT);
See also
XSEC_CRV_TYPE, AppendCustomXSec
Parameters
[in]xsec_surf_idXSecSurf ID
[in]typeXSec type enum (i.e. XSEC_WEDGE)
Returns
XSec ID

◆ CheckClearTriggerEvent()

bool CheckClearTriggerEvent ( int  gui_id)

Check and clear a trigger event for a custom Geom GUI element

Parameters
[in]gui_idGUI element index
Returns
True if successful, false otherwise

◆ ClearAllCustomDefaultSources()

void ClearAllCustomDefaultSources ( )

Clear all default sources for the current custom Geom

◆ ClearXSecSurfs()

void ClearXSecSurfs ( )
Clear all XSecSurf from the current custom Geom
/code{.cpp}

==== Add Cross Sections =====// string surf1 = AddXSecSurf();

string surf2 = AddXSecSurf();

ClearXSecSurfs(); /endcode

◆ CloneSurf()

void CloneSurf ( int  index,
Matrix4d &in  mat 
)

Make a copy of the current custom Geom's main surface at given index and apply a transformation

string geom_id = GetCurrCustomGeom();
//==== Get Curr Vals ====//
double width_val = GetParmVal( GetParm( geom_id, "Width", "Design" ) );
double height_val = GetParmVal( GetParm( geom_id, "Height", "Design" ) );
double y = i * width_val;
double z = j * height_val;
mat.translatef( 0.0, y, z );
CloneSurf( 0, mat );
Parameters
[in]indexMain surface index
[in]matTransformation matrix

◆ CopyCustomXSec()

void CopyCustomXSec ( const string &in  xsec_surf_id,
int  index 
)

Copy an XSec from the current custom Geom and keep it in memory

See also
PasteCustomXSec
Parameters
[in]xsec_surf_idXSecSurf ID
[in]indexXSec index

◆ CutCustomXSec()

void CutCustomXSec ( const string &in  xsec_surf_id,
int  index 
)

Remove an XSec from the current custom Geom and keep it in memory

See also
PasteCustomXSec
Parameters
[in]xsec_surf_idXSecSurf ID
[in]indexXSec index

◆ GetCurrCustomGeom()

string GetCurrCustomGeom ( )

Get the Geom ID of the current custom Geom

//==== Set Some Decent Tess Vals ====//
string geom_id = GetCurrCustomGeom();
SetParmVal( GetParm( geom_id, "Tess_U", "Shape" ), 33 );
SetParmVal( GetParm( geom_id, "Tess_W", "Shape" ), 13 );
Returns
Geom ID

◆ GetCustomParm()

string GetCustomParm ( int  index)

Get the Parm ID for the input Parm index of the current custom Geom

Parameters
[in]indexParm index
Returns
Parm ID

◆ GetCustomXSecLoc()

vec3d GetCustomXSecLoc ( const string &in  xsec_id)

Get the location of an XSec for the current custom Geom

string geom_id = GetCurrCustomGeom();
//==== Get The XSec Surf ====//
string xsec_surf = GetXSecSurf( geom_id, 0 );
string xsec0 = GetXSec( xsec_surf, 0 );
SetCustomXSecLoc( xsec0, vec3d( 1.0, 2.0, 3.0 ) );
vec3d loc = GetCustomXSecLoc( xsec0 );
Print( "Custom XSec Location: ", false );
Print( loc );
Parameters
[in]xsec_idXSec ID
Returns
3D location

◆ GetCustomXSecRot()

vec3d GetCustomXSecRot ( const string &in  xsec_id)

Get the rotation of an XSec for the current custom Geom

//==== Add Spine Surf ====//
string spine_surf = AddXSecSurf();
string spine_xsec = AppendXSec( spine_surf, XS_GENERAL_FUSE );
SetCustomXSecRot( spine_xsec, vec3d( 0, 0, 90 ) );
vec3d rot = GetCustomXSecRot( xsec0 );
Print( "Custom XSec Rotation: ", false );
Print( rot );
Parameters
[in]xsec_idXSec ID
Returns
3D rotation (degrees)

◆ InsertCustomXSec()

string InsertCustomXSec ( const string &in  xsec_surf_id,
int  type,
int  index 
)

Insert a new XSec at the given index for the currently selected custom Geom

See also
XSEC_CRV_TYPE
Parameters
[in]xsec_surf_idXSecSurf ID
[in]typeXSec type enum (i.e. XSEC_WEDGE)
[in]indexXSec index

◆ PasteCustomXSec()

void PasteCustomXSec ( const string &in  xsec_surf_id,
int  index 
)

Paste the XSec currently held in memory for the current custom Geom at given index

See also
CutCustomXSec, CopyCustomXSec
Parameters
[in]xsec_surf_idXSecSurf ID
[in]indexXSec index

◆ RemoveXSecSurf()

void RemoveXSecSurf ( const string &in  xsec_id)

Remove an XSecSurf from the current custom Geom

//==== Add Temp Spine Surf ====//
string spine_surf = AddXSecSurf();
string spine_xsec = AppendXSec( spine_surf, XS_GENERAL_FUSE );
SetCustomXSecRot( spine_xsec, vec3d( 0, 0, 90 ) );
//==== Get The XSec Surf ====//
string xsec_surf = GetXSecSurf( geom_id, 0 );
//==== Define XSecs ====//
int NUM_XSECS = 11;
for ( int i = 0 ; i < NUM_XSECS ; i++ )
{
string xsec = GetXSec( xsec_surf, i );
UpdateXSecLocRot( xsec, spine_xsec, i*0.10 );
}
//=== Remove Spine Surf ====//
RemoveXSecSurf( spine_surf );
Parameters
[in]xsec_idXSecSurf ID

◆ SetCustomCenter()

void SetCustomCenter ( double  x,
double  y,
double  z 
)

Set the center point of the current custom Geom

string geom_id = GetCurrCustomGeom();
double ht= GetParmVal( GetParm( geom_id, "Height", "Design" ) );
double origin = GetParmVal( GetParm( geom_id, "Origin", "XForm" ) );
SetCustomCenter( ht*origin, 0, 0 );
Parameters
[in]xX coordinate
[in]yY coordinate
[in]zZ coordinate

◆ SetCustomXSecLoc()

void SetCustomXSecLoc ( const string &in  xsec_id,
const vec3d &in  loc 
)

Set the location of an XSec for the current custom Geom

string geom_id = GetCurrCustomGeom();
//==== Get Curr Vals ====//
double diameter_val = GetParmVal( GetParm( geom_id, "Diameter", "Design" ) );
double nose_mult_val = GetParmVal( GetParm( geom_id, "NoseMult", "Design" ) );
//==== Get The XSec Surf ====//
string xsec_surf = GetXSecSurf( geom_id, 0 );
string xsec0 = GetXSec( xsec_surf, 0 );
SetCustomXSecLoc( xsec0, vec3d( 0.0, 0.0, nose_center_val*diameter_val ) );
Parameters
[in]xsec_idXSec ID
[in]loc3D location

◆ SetCustomXSecRot()

void SetCustomXSecRot ( const string &in  xsec_id,
const vec3d &in  rot 
)

Set the rotation of an XSec for the current custom Geom

//==== Add Spine Surf ====//
string spine_surf = AddXSecSurf();
string spine_xsec = AppendXSec( spine_surf, XS_GENERAL_FUSE );
SetCustomXSecRot( spine_xsec, vec3d( 0, 0, 90 ) );
Parameters
[in]xsec_idXSec ID
[in]rotAngle of rotation about the X, Y and Z axes (degrees)

◆ SetupCustomDefaultSource()

void SetupCustomDefaultSource ( int  type,
int  surf_index,
double  l1,
double  r1,
double  u1,
double  w1,
double  l2 = 0,
double  r2 = 0,
double  u2 = 0,
double  w2 = 0 
)

Add a CFD Mesh default source for the current custom Geom. Note, certain input params may not be used depending on the source type.

void Init()
{
//==== Add Cross Sections =====//
string xsec_surf = AddXSecSurf();
AppendCustomXSec( xsec_surf, XS_POINT);
//==== Add A Default Point Source At Nose ====//
SetupCustomDefaultSource( POINT_SOURCE, 0, 0.1, 1.0, 1.0, 1.0 );
}
See also
CFD_MESH_SOURCE_TYPE
Parameters
[in]typeCFD Mesh source type enum (i.e. BOX_SOURCE)
[in]surf_indexMain surface index
[in]l1Source first edge length
[in]r1Source first radius
[in]u1Source first U location
[in]w1Source first W location
[in]l2Source second edge length
[in]r2Source second radius
[in]u2Source second U location
[in]w2Source second W location

◆ SetVspSurfCfdType()

void SetVspSurfCfdType ( int  type,
int  surf_index = - 1 
)

Set the surface CFD type for the current custom Geom at given surface index

//==== UpdateSurf Is Called Every Time The Geom is Updated ====//
void UpdateSurf()
{
}
See also
VSP_SURF_CFD_TYPE
Parameters
[in]typeCFD surface type enum (i.e. CFD_TRANSPARENT)
[in]surf_indexMain surface index. The default value of -1 is used to indicate all main surfaces are the same type.

◆ SetVspSurfType()

void SetVspSurfType ( int  type,
int  surf_index = - 1 
)

Set the surface type for the current custom Geom at given surface index

//==== UpdateSurf Is Called Every Time The Geom is Updated ====//
void UpdateSurf()
{
}
See also
VSP_SURF_TYPE
Parameters
[in]typeSurface type enum (i.e DISK_SURF)
[in]surf_indexMain surface index. The default value of -1 is used to indicate all main surfaces are the same type.

◆ SkinXSecSurf()

void SkinXSecSurf ( bool  closed_flag = false)

Perform a skinning update for the current custom Geom. This is typically the last call in the UpdateSurf function that gets called every time the Geom is updated.

//==== UpdateSurf Is Called Every Time The Geom is Updated ====//
void UpdateSurf()
{
string geom_id = GetCurrCustomGeom();
//==== Get Curr Vals ====//
double length_val = GetParmVal( GetParm( geom_id, "Length", "Design" ) );
//==== Get The XSec Surf ====//
string xsec_surf = GetXSecSurf( geom_id, 0 );
//==== Define The First/Last XSec Placement ====//
string xsec3 = GetXSec( xsec_surf, 3 );
SetCustomXSecLoc( xsec3, vec3d( length_val, 0, 0 ) );
}
Parameters
[in]closed_flagFlag to set the last XSec equal to the first

◆ TransformSurf()

void TransformSurf ( int  index,
Matrix4d &in  mat 
)

Perform a transformation for the main surface at input index for the current custom Geom

Parameters
[in]indexMain surface index
[in]matTransformation matrix

◆ UpdateGui()

void UpdateGui ( int  gui_id,
const string &in  parm_id 
)
Update the GUI element with an associated Parm
/code{.cpp}

==== UpdateGui Is Called Every Time The Gui is Updated ====// void UpdateGui() { string geom_id = GetCurrCustomGeom();

UpdateGui( WidthSlider, GetParm( geom_id, "Width", "Design" ) );

UpdateGui( SeatHeightSlider, GetParm( geom_id, "SeatHeight", "Design" ) );

UpdateGui( SeatLengthSlider, GetParm( geom_id, "SeatLength", "Design" ) );

UpdateGui( BackHeightSlider, GetParm( geom_id, "BackHeight", "Design" ) );

} /endcode

Parameters
[in]gui_idIndex of the GUI element
[in]parm_idParm ID
SetVspSurfCfdType
void SetVspSurfCfdType(int type, int surf_index=- 1)
GetCurrCustomGeom
string GetCurrCustomGeom()
POINT_SOURCE
Definition: openvsp_as.h:1183
RemoveXSecSurf
void RemoveXSecSurf(const string &in xsec_id)
GDEV_TAB
Definition: openvsp_as.h:1551
Matrix4d
A class for representing 4x4 matricies.
Definition: openvsp_as.h:781
SetVspSurfType
void SetVspSurfType(int type, int surf_index=- 1)
GetParm
string GetParm(const string &in geom_id, const string &in name, const string &in group)
XS_POINT
Definition: openvsp_as.h:2112
XS_GENERAL_FUSE
Definition: openvsp_as.h:2117
AppendXSec
string AppendXSec(const string &in xsec_surf_id, int type)
GetCustomXSecLoc
vec3d GetCustomXSecLoc(const string &in xsec_id)
AddGui
int AddGui(int type, const string &in label=string(), const string &in parm_name=string(), const string &in group_name=string(), double range=10.0)
GDEV_SLIDER_ADJ_RANGE_INPUT
Definition: openvsp_as.h:1568
DISK_SURF
Definition: openvsp_as.h:2039
AddParm
string AddParm(int type, const string &in name, const string &in group)
GetParmVal
double GetParmVal(const string &in parm_id)
CloneSurf
void CloneSurf(int index, Matrix4d &in mat)
AddXSecSurf
string AddXSecSurf()
Matrix4d::translatef
void translatef(const double &in x, const double &in y, const double &in z)
GetXSec
string GetXSec(const string &in xsec_surf_id, int xsec_index)
SetCustomXSecLoc
void SetCustomXSecLoc(const string &in xsec_id, const vec3d &in loc)
SetCustomXSecRot
void SetCustomXSecRot(const string &in xsec_id, const vec3d &in rot)
SetParmVal
double SetParmVal(const string &in parm_id, double val)
vec3d
A class for representing 3D vectors.
Definition: openvsp_as.h:341
ClearAllCustomDefaultSources
void ClearAllCustomDefaultSources()
SkinXSecSurf
void SkinXSecSurf(bool closed_flag=false)
SetParmDescript
void SetParmDescript(const string &in parm_id, const string &in desc)
AppendCustomXSec
string AppendCustomXSec(const string &in xsec_surf_id, int type)
GetCustomXSecRot
vec3d GetCustomXSecRot(const string &in xsec_id)
SetParmValLimits
double SetParmValLimits(const string &in parm_id, double val, double lower_limit, double upper_limit)
GetXSecSurf
string GetXSecSurf(const string &in geom_id, int index)
Print
void Print(const string &in data, bool new_line=true)
GDEV_YGAP
Definition: openvsp_as.h:1574
XS_CIRCLE
Definition: openvsp_as.h:2113
SetupCustomDefaultSource
void SetupCustomDefaultSource(int type, int surf_index, double l1, double r1, double u1, double w1, double l2=0, double r2=0, double u2=0, double w2=0)
CFD_TRANSPARENT
Definition: openvsp_as.h:2025
XS_ELLIPSE
Definition: openvsp_as.h:2114
PARM_DOUBLE_TYPE
Definition: openvsp_as.h:1666
SetCustomCenter
void SetCustomCenter(double x, double y, double z)
GDEV_DIVIDER_BOX
Definition: openvsp_as.h:1575