OpenVSP API Documentation 3.52.0
Loading...
Searching...
No Matches
Custom Geometry Functions

This functions grouped here are used to create and manipulate Custom Components. Custom components are defined in \*.vsppart files included in the /"Custom Scripts/" directory. Examples of Custom Components are available in the directory for reference. OpenVSP looks in 3 locations for the /"Custom Scripts/" folder, where Custom Components are loaded: the root directory, the VSP executable directory, and the home directory. Note, these functions are specific to defining Custom Components and can't be called from standard API scripts (i.e. \*.vspscript). However, a Custom Component can be created as a \*.vsppart file and then accessed through secondary API scripts. Click here to return to the main page. More...

Classes

class  CustomGeomMgrSingleton
class  CustomXSec
class  CustomGeom

Functions

string CustomGeomMgrSingleton::GetCurrCustomGeom ()
string CustomGeomMgrSingleton::AddParm (int type, const string &name, const string &group)
string CustomGeomMgrSingleton::GetCustomParm (int index)
int CustomGeomMgrSingleton::AddGui (int type, const string &label=string(), const string &parm_name=string(), const string &group_name=string(), double range=10)
void CustomGeomMgrSingleton::AddUpdateGui (int gui_id, const string &parm_id)
bool CustomGeomMgrSingleton::CheckClearTriggerEvent (int gui_id)
string CustomGeomMgrSingleton::AddXSecSurf ()
void CustomGeomMgrSingleton::RemoveXSecSurf (const string &id)
void CustomGeomMgrSingleton::ClearXSecSurfs ()
void CustomGeomMgrSingleton::SkinXSecSurf (bool closed_flag)
void CustomGeomMgrSingleton::TransformSurf (int index, Matrix4d &mat)
void CustomGeomMgrSingleton::CloneSurf (int index, Matrix4d &mat)
void CustomGeomMgrSingleton::SetVspSurfType (int type, int surf_id=-1)
void CustomGeomMgrSingleton::SetVspSurfCfdType (int type, int surf_id=-1)
void CustomGeomMgrSingleton::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 CustomGeomMgrSingleton::ClearAllCustomDefaultSources ()
void CustomGeomMgrSingleton::SetCustomCenter (double x, double y, double z)
void CustomGeomMgrSingleton::SetCustomXSecLoc (const string &xsec_id, const vec3d &loc)
vec3d CustomGeomMgrSingleton::GetCustomXSecLoc (const string &xsec_id)
void CustomGeomMgrSingleton::SetCustomXSecRot (const string &xsec_id, const vec3d &rot)
vec3d CustomGeomMgrSingleton::GetCustomXSecRot (const string &xsec_id)
string CustomGeomMgrSingleton::AppendCustomXSec (const string &xsec_surf_id, int type)
void CustomGeomMgrSingleton::CutCustomXSec (const string &xsec_surf_id, int index)
void CustomGeomMgrSingleton::CopyCustomXSec (const string &xsec_surf_id, int index)
void CustomGeomMgrSingleton::PasteCustomXSec (const string &xsec_surf_id, int index)
string CustomGeomMgrSingleton::InsertCustomXSec (const string &xsec_surf_id, int type, int index)

Detailed Description


Class Documentation

◆ CustomGeomMgrSingleton

class CustomGeomMgrSingleton

CustomGeomMgrSingleton is what a custom component script talks to. Every function in this group is registered with AngelScript as a global bound to this object, so a .vsppart file calls AddParm or AddXSecSurf directly without naming the manager. Called from an ordinary script, outside the building of a component, they return an empty result and raise no error.

Definition at line 57 of file CustomGeom.h.

Public Member Functions

void InitGeom (const string &id, const string &module_name, const string &display_name)
void SetCurrCustomGeom (const string &id)
string GetCurrCustomGeom ()
void ReadCustomScripts (Vehicle *veh)
vector< GeomType > GetCustomTypes ()
string AddParm (int type, const string &name, const string &group)
string GetCustomParm (int index)
int AddGui (int type, const string &label=string(), const string &parm_name=string(), const string &group_name=string(), double range=10)
vector< GuiDef > GetGuiDefVec (const string &geom_id)
void AddUpdateGui (int gui_id, const string &parm_id)
vector< GuiUpdate > GetGuiUpdateVec ()
bool CheckClearTriggerEvent (int gui_id)
string AddXSecSurf ()
void RemoveXSecSurf (const string &id)
void ClearXSecSurfs ()
void SkinXSecSurf (bool closed_flag)
void TransformSurf (int index, Matrix4d &mat)
void CloneSurf (int index, Matrix4d &mat)
void SetVspSurfType (int type, int surf_id=-1)
void SetVspSurfCfdType (int type, int surf_id=-1)
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)
void SetCustomXSecLoc (const string &xsec_id, const vec3d &loc)
vec3d GetCustomXSecLoc (const string &xsec_id)
void SetCustomXSecRot (const string &xsec_id, const vec3d &rot)
vec3d GetCustomXSecRot (const string &xsec_id)
string AppendCustomXSec (const string &xsec_surf_id, int type)
void CutCustomXSec (const string &xsec_surf_id, int index)
void CopyCustomXSec (const string &xsec_surf_id, int index)
void PasteCustomXSec (const string &xsec_surf_id, int index)
string InsertCustomXSec (const string &xsec_surf_id, int type, int index)
vector< string > GetCustomScriptModuleNames ()

Static Public Member Functions

static CustomGeomMgrSingletongetInstance ()
static void Init ()
static int SaveScriptContentToFile (const string &module_name, const string &file_name)

Private Member Functions

 CustomGeomMgrSingleton (CustomGeomMgrSingleton const &copy)=delete
CustomGeomMgrSingletonoperator= (CustomGeomMgrSingleton const &copy)=delete

Private Attributes

string m_CurrGeom
vector< GeomType > m_CustomTypeVec
unordered_map< string, string > m_ModuleGeomIDMap

Member Function Documentation

◆ GetCustomTypes()

vector< GeomType > CustomGeomMgrSingleton::GetCustomTypes ( )
inline

Definition at line 87 of file CustomGeom.h.

◆ getInstance()

CustomGeomMgrSingleton & CustomGeomMgrSingleton::getInstance ( )
inlinestatic

Definition at line 60 of file CustomGeom.h.

◆ Init()

void CustomGeomMgrSingleton::Init ( )
inlinestatic

Definition at line 65 of file CustomGeom.h.

◆ SetCurrCustomGeom()

void CustomGeomMgrSingleton::SetCurrCustomGeom ( const string & id)
inline

Definition at line 69 of file CustomGeom.h.

Member Data Documentation

◆ m_CurrGeom

string CustomGeomMgrSingleton::m_CurrGeom
private

Definition at line 579 of file CustomGeom.h.

◆ m_CustomTypeVec

vector< GeomType > CustomGeomMgrSingleton::m_CustomTypeVec
private

Definition at line 580 of file CustomGeom.h.

◆ m_ModuleGeomIDMap

unordered_map< string, string > CustomGeomMgrSingleton::m_ModuleGeomIDMap
private

Definition at line 581 of file CustomGeom.h.

◆ CustomXSec

class CustomXSec

A cross section belonging to a custom component. Created through AppendCustomXSec or InsertCustomXSec rather than directly, and positioned with SetCustomXSecLoc and SetCustomXSecRot.

Definition at line 601 of file CustomGeom.h.

Inheritance diagram for CustomXSec:
[legend]
Collaboration diagram for CustomXSec:
[legend]

Public Member Functions

 CustomXSec (XSecCurve *xsc)
virtual void Update ()
virtual void CopyBasePos (XSec *xs)
virtual void SetLoc (const vec3d &loc)
virtual vec3d GetLoc ()
virtual void SetRot (const vec3d &rot)
virtual vec3d GetRot ()
virtual double GetScale ()

Protected Attributes

vec3d m_Loc
vec3d m_Rot

Member Function Documentation

◆ GetLoc()

virtual vec3d CustomXSec::GetLoc ( )
inlinevirtual

Definition at line 611 of file CustomGeom.h.

◆ GetRot()

virtual vec3d CustomXSec::GetRot ( )
inlinevirtual

Definition at line 613 of file CustomGeom.h.

Member Data Documentation

◆ m_Loc

vec3d CustomXSec::m_Loc
protected

Definition at line 619 of file CustomGeom.h.

◆ m_Rot

vec3d CustomXSec::m_Rot
protected

Definition at line 620 of file CustomGeom.h.

◆ CustomGeom

class CustomGeom

The component a .vsppart file builds. OpenVSP calls the script's Init function once to declare the Parms and the GUI, and its Update function whenever something changes, which is where the cross sections are placed and SkinXSecSurf is called.

Definition at line 639 of file CustomGeom.h.

Inheritance diagram for CustomGeom:
[legend]
Collaboration diagram for CustomGeom:
[legend]

Public Member Functions

 CustomGeom (Vehicle *vehicle_ptr)
void Clear ()
void InitGeom ()
void SetScriptModuleName (const string &name)
string GetScriptModuleName ()
void SetDisplayName (const string &name)
string GetDisplayName ()
string AddParm (int type, const string &name, const string &group)
string FindParmID (int index)
int AddGui (const GuiDef &gd)
vector< GuiDef > GetGuiDefVec ()
void AddGuiTriggerEvent (int gui_index)
bool CheckClearTriggerEvent (int gui_index)
void AddUpdateGui (const GuiUpdate &gu)
vector< GuiUpdate > GetGuiUpdateVec ()
string AddXSecSurf ()
void RemoveXSecSurf (const string &id)
void ClearXSecSurfs ()
virtual int GetNumXSecSurfs () const
virtual XSecSurf * GetXSecSurf (int index)
virtual void SkinXSecSurf (bool closed_flag)
virtual void CloneSurf (int index, Matrix4d &mat)
virtual void TransformSurf (int index, Matrix4d &mat)
virtual xmlNodePtr EncodeXml (xmlNodePtr &node)
virtual xmlNodePtr DecodeXml (xmlNodePtr &node)
virtual void SetVspSurfType (int type, int surf_id=-1)
virtual void SetVspSurfCfdType (int type, int surf_id=-1)
virtual void AddDefaultSources (double base_len=1.0)
virtual void SetUpDefaultSource (SourceData &sd)
virtual void ClearAllDefaultSources ()
virtual void ComputeCenter ()
virtual void ApplyScale (double currentScale)
virtual void OffsetXSecs (double off)

Protected Member Functions

virtual void UpdateSurf ()
virtual void UpdateFlags ()
virtual void ApplyConformalOffset (double off)

Protected Attributes

bool m_InitGeomFlag
string m_ScriptModuleName
string m_DisplayName
vector< Parm * > m_CustomGeomParmVec
vector< GuiDef > m_GuiDefVec
vector< GuiUpdate > m_UpdateGuiVec
vector< XSecSurf * > m_XSecSurfVec
vector< int > m_TriggerVec
vector< SourceData > m_DefaultSourceVec
int m_VspSurfType
unordered_map< int, int > m_VspSurfTypeMap
int m_VspSurfCfdType
unordered_map< int, int > m_VspSurfCfdTypeMap
bool m_ConformalFlag
double m_ConformalOffset

Member Function Documentation

◆ ClearAllDefaultSources()

virtual void CustomGeom::ClearAllDefaultSources ( )
inlinevirtual

Definition at line 689 of file CustomGeom.h.

◆ GetDisplayName()

string CustomGeom::GetDisplayName ( )
inline

Definition at line 650 of file CustomGeom.h.

◆ GetGuiDefVec()

vector< GuiDef > CustomGeom::GetGuiDefVec ( )
inline

Definition at line 658 of file CustomGeom.h.

◆ GetNumXSecSurfs()

virtual int CustomGeom::GetNumXSecSurfs ( ) const
inlinevirtual

Definition at line 670 of file CustomGeom.h.

◆ GetScriptModuleName()

string CustomGeom::GetScriptModuleName ( )
inline

Definition at line 648 of file CustomGeom.h.

◆ SetDisplayName()

void CustomGeom::SetDisplayName ( const string & name)
inline

Definition at line 649 of file CustomGeom.h.

◆ SetScriptModuleName()

void CustomGeom::SetScriptModuleName ( const string & name)
inline

Definition at line 647 of file CustomGeom.h.

◆ SetUpDefaultSource()

virtual void CustomGeom::SetUpDefaultSource ( SourceData & sd)
inlinevirtual

Definition at line 688 of file CustomGeom.h.

Member Data Documentation

◆ m_ConformalFlag

bool CustomGeom::m_ConformalFlag
protected

Definition at line 721 of file CustomGeom.h.

◆ m_ConformalOffset

double CustomGeom::m_ConformalOffset
protected

Definition at line 722 of file CustomGeom.h.

◆ m_CustomGeomParmVec

vector< Parm* > CustomGeom::m_CustomGeomParmVec
protected

Definition at line 703 of file CustomGeom.h.

◆ m_DefaultSourceVec

vector< SourceData > CustomGeom::m_DefaultSourceVec
protected

Definition at line 708 of file CustomGeom.h.

◆ m_DisplayName

string CustomGeom::m_DisplayName
protected

Definition at line 701 of file CustomGeom.h.

◆ m_GuiDefVec

vector< GuiDef > CustomGeom::m_GuiDefVec
protected

Definition at line 704 of file CustomGeom.h.

◆ m_InitGeomFlag

bool CustomGeom::m_InitGeomFlag
protected

Definition at line 699 of file CustomGeom.h.

◆ m_ScriptModuleName

string CustomGeom::m_ScriptModuleName
protected

Definition at line 700 of file CustomGeom.h.

◆ m_TriggerVec

vector< int > CustomGeom::m_TriggerVec
protected

Definition at line 707 of file CustomGeom.h.

◆ m_UpdateGuiVec

vector< GuiUpdate > CustomGeom::m_UpdateGuiVec
protected

Definition at line 705 of file CustomGeom.h.

◆ m_VspSurfCfdType

int CustomGeom::m_VspSurfCfdType
protected

Definition at line 712 of file CustomGeom.h.

◆ m_VspSurfCfdTypeMap

unordered_map< int, int > CustomGeom::m_VspSurfCfdTypeMap
protected

Definition at line 713 of file CustomGeom.h.

◆ m_VspSurfType

int CustomGeom::m_VspSurfType
protected

Definition at line 710 of file CustomGeom.h.

◆ m_VspSurfTypeMap

unordered_map< int, int > CustomGeom::m_VspSurfTypeMap
protected

Definition at line 711 of file CustomGeom.h.

◆ m_XSecSurfVec

vector< XSecSurf* > CustomGeom::m_XSecSurfVec
protected

Definition at line 706 of file CustomGeom.h.

Function Documentation

◆ AddGui()

int CustomGeomMgrSingleton::AddGui ( int type,
const string & label = string(),
const string & parm_name = string(),
const string & group_name = string(),
double range = 10 )

Add a control to the custom component's GUI. The value it returns identifies the control, which matters for the ones that report back, such as a trigger button.

AddGui( GDEV_SLIDER_ADJ_RANGE, "Length", "Length", "Design", 10.0 );
int AddGui(int type, const string &label=string(), const string &parm_name=string(), const string &group_name=string(), double range=10)
See also
AddUpdateGui, CheckClearTriggerEvent
Parameters
[in]typeint GUI device type enum (GDEV_SLIDER, GDEV_SLIDER_ADJ_RANGE, GDEV_BUTTON and so on)
[in]labelstring Label shown next to the control
[in]parm_namestring Name of the Parm the control drives
[in]group_namestring Name of the group the Parm belongs to
[in]rangedouble Range of the slider
Returns
int GUI device index

◆ AddParm()

string CustomGeomMgrSingleton::AddParm ( int type,
const string & name,
const string & group )

Add a Parm to the custom component being built. Call this from the component's Init function; the ID that comes back is what SetParmVal and the GUI definitions refer to later.

string length = AddParm( PARM_DOUBLE_TYPE, "Length", "Design" );
SetParmVal( length, 10.0 );
string AddParm(int type, const string &name, const string &group)
See also
GetCustomParm, AddGui
Parameters
[in]typeint Parm type enum (PARM_DOUBLE_TYPE, PARM_INT_TYPE, PARM_BOOL_TYPE or PARM_FRACTION_TYPE)
[in]namestring Name of the Parm
[in]groupstring Name of the group the Parm belongs to
Returns
string Parm ID

◆ AddUpdateGui()

void CustomGeomMgrSingleton::AddUpdateGui ( int gui_id,
const string & parm_id )

Tie a GUI control to a Parm, so the control follows the Parm when it changes.

string length = AddParm( PARM_DOUBLE_TYPE, "Length", "Design" );
int gid = AddGui( GDEV_SLIDER_ADJ_RANGE, "Length" );
AddUpdateGui( gid, length );
void AddUpdateGui(int gui_id, const string &parm_id)
See also
AddGui
Parameters
[in]gui_idint GUI device index, as returned by AddGui
[in]parm_idstring Parm ID

◆ AddXSecSurf()

string CustomGeomMgrSingleton::AddXSecSurf ( )

Add a cross section surface to the custom component. The cross sections appended to it become the skinned surface.

string xsec_surf = AddXSecSurf();
AppendCustomXSec( xsec_surf, XS_CIRCLE );
string AppendCustomXSec(const string &xsec_surf_id, int type)
See also
RemoveXSecSurf, ClearXSecSurfs, SkinXSecSurf
Returns
string XSecSurf ID

◆ AppendCustomXSec()

string CustomGeomMgrSingleton::AppendCustomXSec ( const string & xsec_surf_id,
int type )

Add a cross section to the end of one of the component's cross section surfaces.

string xsec_surf = AddXSecSurf();
string xsec = AppendCustomXSec( xsec_surf, XS_CIRCLE );
See also
InsertCustomXSec, CutCustomXSec
Parameters
[in]xsec_surf_idstring XSecSurf ID
[in]typeint XSec type enum (XS_CIRCLE, XS_ELLIPSE, XS_SUPER_ELLIPSE and so on)
Returns
string XSec ID

◆ CheckClearTriggerEvent()

bool CustomGeomMgrSingleton::CheckClearTriggerEvent ( int gui_id)

Test whether a trigger control has been pressed since the last check, and clear it. Returns true once per press, so it can drive an action from the component's Update function.

int tid = AddGui( GDEV_TRIGGER_BUTTON, "Reset" );
{
Print( "The Reset button was pressed" );
}
bool CheckClearTriggerEvent(int gui_id)
See also
AddGui
Parameters
[in]gui_idint GUI device index, as returned by AddGui
Returns
bool True if the trigger has fired since the last call

◆ ClearAllCustomDefaultSources()

void CustomGeomMgrSingleton::ClearAllCustomDefaultSources ( )

Remove every default CFD Mesh source from the custom component.

See also
SetupCustomDefaultSource

◆ ClearXSecSurfs()

void CustomGeomMgrSingleton::ClearXSecSurfs ( )

Remove every cross section surface from the custom component.

See also
AddXSecSurf, RemoveXSecSurf

◆ CloneSurf()

void CustomGeomMgrSingleton::CloneSurf ( int index,
Matrix4d & mat )

Copy one of the component's surfaces and place the copy by a transformation. Useful for a component made of several instances of the same shape.

mat.translatef( 0.0, 5.0, 0.0 );
CloneSurf( 0, mat );
void CloneSurf(int index, Matrix4d &mat)
void loadIdentity()
void translatef(const double &x, const double &y, const double &z)
See also
TransformSurf
Parameters
[in]indexint Index of the surface to copy
[in]matMatrix4d Transformation placing the copy

◆ CopyCustomXSec()

void CustomGeomMgrSingleton::CopyCustomXSec ( const string & xsec_surf_id,
int index )

Copy one of the component's cross sections to the clipboard, leaving it in place.

CopyCustomXSec( xsec_surf_id, 1 );
void CopyCustomXSec(const string &xsec_surf_id, int index)
See also
CutCustomXSec, PasteCustomXSec
Parameters
[in]xsec_surf_idstring XSecSurf ID
[in]indexint Index of the cross section

◆ CutCustomXSec()

void CustomGeomMgrSingleton::CutCustomXSec ( const string & xsec_surf_id,
int index )

Cut a cross section out of one of the component's cross section surfaces and put it on the clipboard, from where PasteCustomXSec can retrieve it.

CutCustomXSec( xsec_surf_id, 1 );
void CutCustomXSec(const string &xsec_surf_id, int index)
See also
CopyCustomXSec, PasteCustomXSec
Parameters
[in]xsec_surf_idstring XSecSurf ID
[in]indexint Index of the cross section

◆ GetCurrCustomGeom()

string CustomGeomMgrSingleton::GetCurrCustomGeom ( )
inline

Get the ID of the custom component currently being built. Empty when no component is being built, which is the case in an ordinary script.

string gid = GetCurrCustomGeom();
Returns
string Geom ID of the current custom component

Definition at line 84 of file CustomGeom.h.

◆ GetCustomParm()

string CustomGeomMgrSingleton::GetCustomParm ( int index)

Get the ID of a Parm of the custom component by the order it was added in.

string pid = GetCustomParm( 0 );
string GetCustomParm(int index)
See also
AddParm
Parameters
[in]indexint Index of the Parm, in the order the Parms were added
Returns
string Parm ID

◆ GetCustomXSecLoc()

vec3d CustomGeomMgrSingleton::GetCustomXSecLoc ( const string & xsec_id)

Get the location of one of the component's cross sections.

vec3d loc = GetCustomXSecLoc( xsec_id );
vec3d GetCustomXSecLoc(const string &xsec_id)
Definition Vec3d.h:238
See also
SetCustomXSecLoc
Parameters
[in]xsec_idstring XSec ID
Returns
vec3d Location of the cross section

◆ GetCustomXSecRot()

vec3d CustomGeomMgrSingleton::GetCustomXSecRot ( const string & xsec_id)

Get the rotation of one of the component's cross sections.

vec3d rot = GetCustomXSecRot( xsec_id );
vec3d GetCustomXSecRot(const string &xsec_id)
See also
SetCustomXSecRot
Parameters
[in]xsec_idstring XSec ID
Returns
vec3d Rotation angles about X, Y and Z, in degrees

◆ InsertCustomXSec()

string CustomGeomMgrSingleton::InsertCustomXSec ( const string & xsec_surf_id,
int type,
int index )

Insert a cross section into one of the component's cross section surfaces, after a given index.

string xsec = InsertCustomXSec( xsec_surf_id, XS_CIRCLE, 1 );
string InsertCustomXSec(const string &xsec_surf_id, int type, int index)
See also
AppendCustomXSec
Parameters
[in]xsec_surf_idstring XSecSurf ID
[in]typeint XSec type enum (XS_CIRCLE, XS_ELLIPSE, XS_SUPER_ELLIPSE and so on)
[in]indexint Index to insert after
Returns
string XSec ID

◆ PasteCustomXSec()

void CustomGeomMgrSingleton::PasteCustomXSec ( const string & xsec_surf_id,
int index )

Paste the cross section on the clipboard over one of the component's cross sections.

CopyCustomXSec( xsec_surf_id, 1 );
PasteCustomXSec( xsec_surf_id, 2 );
void PasteCustomXSec(const string &xsec_surf_id, int index)
See also
CutCustomXSec, CopyCustomXSec
Parameters
[in]xsec_surf_idstring XSecSurf ID
[in]indexint Index of the cross section to paste over

◆ RemoveXSecSurf()

void CustomGeomMgrSingleton::RemoveXSecSurf ( const string & id)

Remove one cross section surface from the custom component.

string xsec_surf = AddXSecSurf();
RemoveXSecSurf( xsec_surf );
void RemoveXSecSurf(const string &id)
See also
AddXSecSurf, ClearXSecSurfs
Parameters
[in]idstring XSecSurf ID

◆ SetCustomCenter()

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

Set the centre of rotation of the custom component.

SetCustomCenter( 0.0, 0.0, 0.0 );
void SetCustomCenter(double x, double y, double z)
Parameters
[in]xdouble X coordinate of the centre
[in]ydouble Y coordinate of the centre
[in]zdouble Z coordinate of the centre

◆ SetCustomXSecLoc()

void CustomGeomMgrSingleton::SetCustomXSecLoc ( const string & xsec_id,
const vec3d & loc )

Move one of the component's cross sections to a location.

string xsec_surf = AddXSecSurf();
string xsec = AppendCustomXSec( xsec_surf, XS_CIRCLE );
SetCustomXSecLoc( xsec, vec3d( 1.0, 0.0, 0.0 ) );
void SetCustomXSecLoc(const string &xsec_id, const vec3d &loc)
See also
GetCustomXSecLoc, SetCustomXSecRot
Parameters
[in]xsec_idstring XSec ID
[in]locvec3d Location to move the cross section to

◆ SetCustomXSecRot()

void CustomGeomMgrSingleton::SetCustomXSecRot ( const string & xsec_id,
const vec3d & rot )

Rotate one of the component's cross sections.

SetCustomXSecRot( xsec_id, vec3d( 0.0, 90.0, 0.0 ) );
void SetCustomXSecRot(const string &xsec_id, const vec3d &rot)
See also
GetCustomXSecRot, SetCustomXSecLoc
Parameters
[in]xsec_idstring XSec ID
[in]rotvec3d Rotation angles about X, Y and Z, in degrees

◆ SetupCustomDefaultSource()

void CustomGeomMgrSingleton::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 )

Give the custom component a default CFD Mesh source, so a mesh of it is refined sensibly without the user having to add sources by hand.

SetupCustomDefaultSource( POINT_SOURCE, 0, 0.1, 1.0, 0.5, 0.5 );
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)
See also
ClearAllCustomDefaultSources
Parameters
[in]typeint Source type enum (POINT_SOURCE, LINE_SOURCE, BOX_SOURCE)
[in]surf_indexint Index of the surface the source belongs to
[in]l1double Source length at the first end
[in]r1double Source radius at the first end
[in]u1double U location of the first end
[in]w1double W location of the first end
[in]l2double Source length at the second end, for a line or box source
[in]r2double Source radius at the second end, for a line or box source
[in]u2double U location of the second end, for a line or box source
[in]w2double W location of the second end, for a line or box source

◆ SetVspSurfCfdType()

void CustomGeomMgrSingleton::SetVspSurfCfdType ( int type,
int surf_id = -1 )

Set how one of the component's surfaces is treated by CFD Mesh – as a normal surface, as a transparent one, or as something to be stamped out of another.

SetVspSurfCfdType( CFD_TRANSPARENT, 0 );
void SetVspSurfCfdType(int type, int surf_id=-1)
See also
SetVspSurfType
Parameters
[in]typeint CFD surface type enum (CFD_NORMAL, CFD_NEGATIVE, CFD_TRANSPARENT and so on)
[in]surf_idint Index of the surface, or -1 for all of them

◆ SetVspSurfType()

void CustomGeomMgrSingleton::SetVspSurfType ( int type,
int surf_id = -1 )

Set the surface type of one of the component's surfaces, or of all of them. The type is what tells the rest of OpenVSP whether the surface is a wing, a body, or something else.

SetVspSurfType( WING_SURF, 0 );
void SetVspSurfType(int type, int surf_id=-1)
See also
SetVspSurfCfdType
Parameters
[in]typeint Surface type enum (NORMAL_SURF, WING_SURF, DISK_SURF, PROP_SURF)
[in]surf_idint Index of the surface, or -1 for all of them

◆ SkinXSecSurf()

void CustomGeomMgrSingleton::SkinXSecSurf ( bool closed_flag)

Skin a surface through the cross sections that have been appended, which is what turns them into geometry. Call this from the component's Update function.

SkinXSecSurf( false );
void SkinXSecSurf(bool closed_flag)
See also
AddXSecSurf, AppendCustomXSec
Parameters
[in]closed_flagbool True to close the surface back onto the first cross section

◆ TransformSurf()

void CustomGeomMgrSingleton::TransformSurf ( int index,
Matrix4d & mat )

Apply a transformation to one of the component's surfaces.

mat.translatef( 0.0, 0.0, 5.0 );
TransformSurf( 0, mat );
void TransformSurf(int index, Matrix4d &mat)
See also
CloneSurf
Parameters
[in]indexint Index of the surface
[in]matMatrix4d Transformation to apply